有時候u-boot的環境變量須要在燒錄後再設置,在燒錄以後都會有一些默認的環境變量好比bootarg等,若是在編譯u-boot以前就把本身須要的變量設置好,燒錄的時候直接就獲得本身想要的變量,這在量產中是很方便的。tcp
在哪裏配置呢?找到了,在這裏include/configs/<你的板子名稱>.h,如include/configs/mx6dl_sabresd.h,環境變量的部分配置以下:server
#define CONFIG_EXTRA_ENV_SETTINGS \
"netdev=eth0\0" \
"ethprime=FEC0\0" \
"uboot=u-boot.bin\0" \
"kernel=uImage\0" \
"nfsroot=/opt/eldk/arm\0" \
"bootargs_base=setenv bootargs console=ttymxc0,115200\0"\
"bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs "\
"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0"\
"bootcmd_net=run bootargs_base bootargs_nfs; " \
"tftpboot ${loadaddr} ${kernel}; bootm\0" \
"bootargs_mmc=setenv bootargs ${bootargs} ip=dhcp " \
"root=/dev/mmcblk0p1 rootwait\0" \
"bootcmd_mmc=run bootargs_base bootargs_mmc; " \
"mmc dev 3; " \
"mmc read ${loadaddr} 0x800 0x2000; bootm\0" \
"bootcmd=run bootcmd_net\0" \ip