This shows you the differences between two versions of the page.
|
ass:labs-2025:03:tasks:01 [2025/08/06 12:56] florin.stancu |
ass:labs-2025:03:tasks:01 [2026/07/15 11:22] (current) florin.stancu |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| You are probably be tired of using u-boot CLI to load the Linux FIT uImage into RAM and booting it manually. | You are probably be tired of using u-boot CLI to load the Linux FIT uImage into RAM and booting it manually. | ||
| - | Surely, there must be something to be done to automate this... and you're right! Let's learn to do this! | + | Surely, there must be something to be done to automate this (yep, there is!). |
| - | First, boot your board into ''u-boot'' prompt. Enter ''env print''... | + | First, let's learn about u-boot environment more... Start your board to a ''u-boot'' prompt and enter ''env print''... |
| <spoiler env print output...> | <spoiler env print output...> | ||
| Line 114: | Line 114: | ||
| console=ttyLP0 | console=ttyLP0 | ||
| bootargs=console=ttyLP0,115200 earlycon,115200 rdinit=/linuxrc clk_ignore_unused | bootargs=console=ttyLP0,115200 earlycon,115200 rdinit=/linuxrc clk_ignore_unused | ||
| - | # TODO: this is the command executed automatically when uboot starts... | + | # This is the command executed automatically when uboot starts... |
| bootcmd=echo Fastboot mode... press Ctrl-C to exit; fastboot auto | bootcmd=echo Fastboot mode... press Ctrl-C to exit; fastboot auto | ||
| # This runs instead of bootcmd when booted using `uuu` via USB | # This runs instead of bootcmd when booted using `uuu` via USB | ||
| bootcmd_mfg=run bootcmd | bootcmd_mfg=run bootcmd | ||
| - | bootdelay=2 | + | bootdelay=3 |
| - | image=linux.itb | + | # TODO: enter a valid uImage file DRAM load address (the one used with 'bootm') |
| loadaddr=TODO | loadaddr=TODO | ||
| + | # TODO: enter the 'load mmc 0 ...' script (will be executed using 'run loadimage') | ||
| loadimage=TODO | loadimage=TODO | ||
| + | image=linux.itb | ||
| + | # this can be executed using 'run linux' to boot your Linux kernel! | ||
| linux=echo Booting Linux ...; run loadimage; bootm ${loadaddr}; | linux=echo Booting Linux ...; run loadimage; bootm ${loadaddr}; | ||
| </code> | </code> | ||
| Line 134: | Line 137: | ||
| Enter your boot script inside the ''bootcmd'' var and let's proceed with overwriting the default environment. | Enter your boot script inside the ''bootcmd'' var and let's proceed with overwriting the default environment. | ||
| - | Recall the ''DEFAULT_ENV'' menuconfig item? Modify it to point to your ''mydefault.env'' (you can simply use a relative path). Note that you need to enable ''USE_DEFAULT_ENV_FILE'' checkbox first to let you supply your value! | + | Recall the ''ENV_DEFAULT_ENV_TEXT_FILE'' menuconfig item? Modify it to point to your ''mydefault.env'' (you can simply use a relative path to ''u-boot''s source dir). Note that you need to enable ''ENV_USE_DEFAULT_ENV_TEXT_FILE'' checkbox first to let you modify that value! |
| - | Afterwards, [re]compile u-boot, copy the u-boot ''.bin'' files again to the ''imx-mkimage'' directory and regenerate your ''flash.bin''. | + | For advanced use cases / build automation, you can override any config items by creating extra .config files and using the included ''./scripts/kconfig/merge_config.sh'' u-boot host script! |
| + | |||
| + | Afterwards, [re]compile u-boot, copy the newly compiled u-boot ''.bin'' files to ''imx-mkimage'' directory again (if not doing it automatically using a Makefile) and regenerate your ''flash.bin''. | ||
| + | |||
| + | Test it by booting your new firmware using ''uuu''. | ||
| + | Always check the UBoot version and build time printed on the serial console during the boot process to ensure you loaded your latest firmware image! | ||
| - | Test it by booting your new firmware using ''uuu''. | ||
| Try using ''run linux'' to run the ''linux'' script (if you used that), otherwise edit the ''bootcmd'' to do that automatically after the timeout! | Try using ''run linux'' to run the ''linux'' script (if you used that), otherwise edit the ''bootcmd'' to do that automatically after the timeout! | ||
| Did it work? if not, you may need to repeat this process (this is where a script comes in handy!). | Did it work? if not, you may need to repeat this process (this is where a script comes in handy!). | ||
| - | Note that real devices have their uboot configuration proceed automatically with booting the OS if a physical button is NOT pressed (remember those old Android phones? you could stop this process by holding several volume keys together!). You can script this using GPIO, but it's out of scope for today. | + | Note that real devices have their uboot configuration proceed automatically with booting the OS if a physical button is NOT pressed (remember those old Android phones? you could stop this process by holding several volume keys together!). You can script this using GPIO (try the ''gpio'' command!), but it's out of scope for today (we don't have any physical buttons). |