Reputation: 107
I have following U-Boot environment variables:
nas220> printenv
autoload=no
autostart=no
baudrate=115200
bootargs=console=ttyS0,115200
bootargs_base=console=ttyS0,115200
bootcmd=run bootcmd_nand
bootcmd_nand=setenv bootargs console=ttyS0,115200 cmdlinepart.mtdparts=orion_nand:0xa0000@0x0(uboot),0x010000@0xa0000(env),0x500000@0xc0000(uimage),0x1a40000@0x5c0000(rootfs)
bootcmd_rescue=setenv bootargs_extra rescue/enable=true; run bootcmd_usb
bootcmd_usb=setenv bootargs ${bootargs_base} ${mtdparts} ${bootargs_extra}; usb start; fatload usb 0:1 0x40000 uImage-dtb; fatload usb 0:1 0x800000 uInitrd; bootm 0x40000 0x800000
bootdelay=3
ethact=egiga0
ethaddr=00:10:75:07:0D:8D
ethadr=00:10:75:07:0D:8D
mtdids=nand0=orion_nand
mtdparts=cmdlinepart.mtdparts=orion_nand:0xa0000@0x0(uboot),0x010000@0xa0000(env),0x500000@0xc0000(uimage),0x1a40000@0x5c0000(rootfs)
stderr=serial
stdin=serial
stdout=serial
Environment size: 876/65532 bytes
I need to change the bootcmd_nand
variable from:
setenv bootargs console=ttyS0,115200 cmdlinepart.mtdparts=orion_nand:0xa0000@0x0(uboot),0x010000@0xa0000(env),0x500000@0xc0000(uimage),0x1a40000@0x5c0000(rootfs)
to
setenv bootargs console=ttyS0,115200 cmdlinepart.mtdparts=orion_nand:0xa0000@0x0(uboot),0x010000@0xa0000(env),0x500000@0xc0000(uimage),0x1a30000@0x5c0000(rootfs)
however when I try to run:
setenv bootcmd_nand setenv bootargs console=ttyS0,115200 cmdlinepart.mtdparts=orion_nand:0xa0000@0x0(uboot),0x010000@0xa0000(env),0x500000@0xc0000(uimage),0x1a30000@0x5c0000(rootfs)
The system reads from the nand and boots so I'm not able to run the saveenv
command to save the changes persistently.
How to I make the change without the system booting?
Upvotes: 4
Views: 11055
Reputation: 107
I figured out my mistake, but leaving the question up in case anyone else comes across this. To run a setenv
command without actually running the code you just have the enclose the variable in single quotes. For example running,
setenv bootcmd_nand setenv bootargs console=ttyS0,115200 cmdlinepart.mtdparts=orion_nand:0xa0000@0x0(uboot),0x010000@0xa0000(env),0x500000@0xc0000(uimage),0x1a30000@0x5c0000(rootfs)
will run the code and read from the nand not saving the variable permanently. However running,
setenv bootcmd_nand 'setenv bootargs console=ttyS0,115200 cmdlinepart.mtdparts=orion_nand:0xa0000@0x0(uboot),0x010000@0xa0000(env),0x500000@0xc0000(uimage),0x1a30000@0x5c0000(rootfs)'
Sets the variable without running the code so I can run the saveenv
and save permanently.
Upvotes: 5