unable to set environment variable in compile time of uBoot

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

unable to set environment variable in compile time of uBoot

ソリューションへジャンプ
2,873件の閲覧回数
aravindchakrava
Contributor II

Hi, 

I am trying to bring net-console in uboot. For that, I first added 'ncip' in "uboot-imx/include/configs/imx8mm_evk.h" as following. Later, DFMC_SWUG is called at the end of CONFIG_EXTRA_ENV_SETTINGS

 

#define DFMC_SWUG \
	"setenv ncip 192.168.100.98 \0" \
	"ethaddr=00:80:A3:CA:B5:77 \0" \
	"swugip=192.168.100.16 \0" \
	"ipaddr=192.168.100.2 \0" \
	"serverip=192.168.100.16 \0" \
	"bootdelay=3\0" \

 

 

 

#define CONFIG_EXTRA_ENV_SETTINGS		\
	CONFIG_MFG_ENV_SETTINGS \
	JAILHOUSE_ENV \
	"script=boot.scr\0" \
	--
        --
        --
        "fi;\0" \
        DFMC_SWUG

 

 

 Interestingly, I was able to set 'ethaddr', "swugip" and other variables except "ncip". I guess, I am doing some formatting mistakes in line --> "setenv ncip 192.168.100.98 \0" \

Later I tried setting some dummy variables named dummy_var_1dummy_var_2, dummy_var_3. Even they are not getting set. 

aravindchakrava_1-1638967803130.png

Can some one please guide me here?

Regards, 

Aravind

 

ラベル(2)
タグ(2)
0 件の賞賛
返信
1 解決策
2,847件の閲覧回数
BiyongSUN
NXP Employee
NXP Employee

 

my colleague has given you very clear example.

you use the "setenv ncip 192.168.100.98" in imx8mm_evk.h 

because you think you are still at runtime in front of i.mx8mm board's debug console. and type the command

"setenv ncip 192.168.100.98" to change the variable ncip using setenv command. 

now you are at compile time, you should use the "=" as my colleague's previous reply. 

in the header file imx8mm_evk.h , you should use "ncip=192.168.100.98".

If you want to use the command, you should create your own command then chain to the bootcmd.

like this,  "set_ncip=setenv ncip 192.168.100.98". then use the "run set_ncip" in bootcmd chain.

or directly use setenv ncip 192.168.100.98  in bootcmd. 

u-boot only runs bootcmd. and like mmcboot is in the chain of the bootcmd. 

 

run mmcargs  of mmc boot is an example 

 

"mmcargs=setenv bootargs ${jh_clk} console=${console} root=${mmcroot}\0 " \
"loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bsp_script};\0" \
"bootscript=echo Running bootscript from mmc ...; " \
"source\0" \
"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}\0" \
"mmcboot=echo Booting from mmc ...; " \
"run mmcargs; " \
"if test ${boot_fit} = yes || test ${boot_fit} = try; then " \

 

 

元の投稿で解決策を見る

5 返答(返信)
2,857件の閲覧回数
AldoG
NXP TechSupport
NXP TechSupport

Hello,

I think you shouldn’t use setenv and just create the variable as is, i.e.

#define DFMC_SWUG \
        "ncip=192.168.100.98 \0" \
        "ethaddr=00:80:A3:CA:B5:77 \0" \
        "swugip=192.168.100.16 \0" \
        "ipaddr=192.168.100.2 \0" \
        "serverip=192.168.100.16 \0" \
        "bootdelay=3\0" \

Best regards,
Aldo.

0 件の賞賛
返信
2,829件の閲覧回数
aravindchakrava
Contributor II

Hi Aldo, 

Thank you very much! It worked!

- Aravind

2,861件の閲覧回数
aravindchakrava
Contributor II

Basically my requirement is to bring 'netconsole' straight after u-boot booting. I will not have serial cable in the end product.

0 件の賞賛
返信
2,848件の閲覧回数
BiyongSUN
NXP Employee
NXP Employee

 

my colleague has given you very clear example.

you use the "setenv ncip 192.168.100.98" in imx8mm_evk.h 

because you think you are still at runtime in front of i.mx8mm board's debug console. and type the command

"setenv ncip 192.168.100.98" to change the variable ncip using setenv command. 

now you are at compile time, you should use the "=" as my colleague's previous reply. 

in the header file imx8mm_evk.h , you should use "ncip=192.168.100.98".

If you want to use the command, you should create your own command then chain to the bootcmd.

like this,  "set_ncip=setenv ncip 192.168.100.98". then use the "run set_ncip" in bootcmd chain.

or directly use setenv ncip 192.168.100.98  in bootcmd. 

u-boot only runs bootcmd. and like mmcboot is in the chain of the bootcmd. 

 

run mmcargs  of mmc boot is an example 

 

"mmcargs=setenv bootargs ${jh_clk} console=${console} root=${mmcroot}\0 " \
"loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bsp_script};\0" \
"bootscript=echo Running bootscript from mmc ...; " \
"source\0" \
"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}\0" \
"mmcboot=echo Booting from mmc ...; " \
"run mmcargs; " \
"if test ${boot_fit} = yes || test ${boot_fit} = try; then " \

 

 

2,824件の閲覧回数
aravindchakrava
Contributor II

Hi BiyongSUN,

You caught my mistake!! You are absolutely correct. 

I was thinking that, the commands/statements entered in between Quotation marks ("   ") gets executed during run time! 

But your answer helped me! 

Thanks, 

Aravind

0 件の賞賛
返信