ska89
ska89

Reputation: 29

How to override U-Boot "bootcmd" variable

I am trying to compile u-boot for my BeagleBone Black (am335x) and would like to tweak what the "bootcmd" command does. I see that in my am334x_evm_defconfig that there is a config that looks like this:

CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd"

But when I try to add any change ex.

CONFIG_BOOTCOMMAND="echo this is my bootcmd; if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd"

The bootcmd does not show up in my default environment and my echo does not show up when booting. Where in the build process is CONFIG_BOOTCOMMAND getting ignored? Or is there another place that it can be defined?

For clarification, I store my environment on my eMMC so I made sure to zero it out so that U-boot does not read any variables from previous compilations of u-boot and uses the default one that it compiled.

Upvotes: 2

Views: 6503

Answers (1)

sawdust
sawdust

Reputation: 17067

I see that in my am334x_evm_defconfig ...
...
But when I try to add any change ...

When you perform any edits to a xxx_defconfig file, a make command after such edits will not apply those modifications to the .config file, so those changes will not show up in subsequent builds.
The only way to get those changes into your next build would require a completely fresh build, that is, a make distclean (or make mrproper) command, followed with a make xxx_defconfig.


Rather than directly editing a xxx_defconfig file, you would probably be better off making changes using the more reliable make menuconfig command, which will respect dependencies.
For CONFIG_BOOTCOMMAND, there are top-level entries for Enable a default value for bootcmd and the command string.
The modified and saved configuration can then be used in subequent builds with a simple make, or turned into a new ./defconfig file with the make savedefconfig command.


Where in the build process is CONFIG_BOOTCOMMAND getting ignored?

Your changes are only ignored because they have not been applied to the build configuration, which is the .config file.

Or is there another place that it can be defined?

Not a concern if proper build procedure is followed.

Upvotes: 3

Related Questions