0

There are two u-boot partition in my NAND:

0: boot 0x00400000 0x00000000 0

1: ubootenv 0x00100000 0x00400000 0

I defined bootaugs and bootcmd in #define CONFIG_EXTRA_ENV_SETTINGS of the board header file, built the u=boot and installed u-boot to NAND boot partition, but during NAND boot that does not automatically set up bootaugs and bootcmd to ubootenv partition, if the CONFIG_EXTRA_ENV_SETTINGS cannot be used to set boot parameters automatically, what it is useful? How can i set u-boot parameters automatically for NAND boot without manual setup in u-boot?

Thank you.

Kind regards

user157912
  • 39
  • 1
  • 8
  • *"but during NAND boot that does not automatically set up bootaugs and bootcmd to ubootenv partition,"* -- That's a negative description. Instead of mentioning just one of the infinite things that did not happen, describe what did happen and why that is not sufficient. BTW what is *"bootaugs"*? Do you mean **bootargs**? – sawdust May 11 '20 at 21:32

1 Answers1

0

Method-1: You can set the environment in the file "./include/env_default.h" within the scope DEFAULT_ENV_INSTANCE_EMBEDDED and as the member of the array const uchar default_environment[] in the project U-boot. Here is an example.

#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED

const uchar default_environment[] = {
#define IP "10.1.1.245"
#define N_MSK "255.255.255.0"
#define S_IP "10.1.1.159"

"ipaddr="IP"\0"
"netmask="N_MSK"\0"
"serverip="S_IP"\0"
}
#endif

Method-2 : U-boot provides another way to set the environment variable permanently. The idea here is to set the variable in U-boot prompt and then save it to the U-boot environment partition. In each boot-up time, the variables will be invoked from the U-boot environment. Here is the procedure.

=> env set net_args "setenv bootargs console=ttyO0,115200 root=/dev/nfs ip=10.1.1.245 nfsroot=10.1.1.169:/nfsroot_am335,v3,tcp"
=> env set net_boot "run ld_lnx_tftp; run net_args; bootz ${loadaddr} - ${fdtaddr}"
=> env save