[U-Boot] fw_(printenv/setenv) and serial console have different env variables

Suriyan Ramasami suriyan.r at gmail.com
Sun Apr 13 21:53:42 CEST 2014


On Sat, Apr 12, 2014 at 5:57 AM, Andrei Mihut <andrei.mihut at gmail.com> wrote:
> Greetings everyone,
>
> I stumbled over something worth telling.
>
> It started as the bad crc using defaults issue when I tried to use
> fw_printenv on my debian iconnect box. I tought it was the fw_env.config.
> it wasn't. After hours of researching and compiling from source and the
> whole lot of trouble shooting I took the chance to use fw_setenv.
>
> Bingo! it worked. Now fw_printenv gives me no bad crc and prints the
> variables including the new ones even after reboot.
>
My thoughts are that your u-boot is storing the env in a different
area than what your fw_env.config is pointing to in debian. Hence the
crc error. Of course you can get rid of the crc error by running
fw_setenv, as it just dumps the default env in the space defined in
the config file.

> NOW HERE IS THE ISSUE
>
> The env variables printed from linux don't show on the serial and viceversa.
> It looks like there are 2 sets of them. Needless to say that it's
> frustrating.
>
> Anyone has seen anything similar?
>
> ************** printouts
> on the iconnect box >>>
> root at ico1:~# fw_printenv
> bootcmd=bootp; setenv bootargs root=/dev/nfs
> nfsroot=${serverip}:${rootpath}
> ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
> bootdelay=5
> baudrate=115200
> firsttest=firsttest1
> root at ico1:~# fw_setenv secondtest secondtest
> root at ico1:~# fw_printenv
> bootcmd=bootp; setenv bootargs root=/dev/nfs
> nfsroot=${serverip}:${rootpath}
> ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
> bootdelay=5
> baudrate=115200
> firsttest=firsttest1
> secondtest=secondtest
> root at ico1:~#
> <<<iconnect
>
> on the serial console>>>
> Environment size: 1633/131068 bytes
> iconnect =>
> iconnect => version
>
> U-Boot 2013.10 (Mar 26 2014 - 18:44:17) Iomega iConnect
> arm-openwrt-linux-uclibcgnueabi-gcc (OpenWrt/Linaro GCC 4.8-2014.01 r40028)
> 4.8.3
> GNU ld (GNU Binutils) 2.22
> iconnect =>
> +++++++++++++++++++++++++++
> just in case last working
> iconnect => printenv
> arcNumber=2870
> baudrate=115200
> bootargs=console=ttyS0,115200 root=/dev/sda4 rootdelay=10
> bootargs_console=console=ttyS0,115200 root=/dev/sda4 rootdelay=10
> bootargs_root=root=/dev/mtdblock2 rootfstype=jffs2
> bootcmd=setenv bootargs $(bootargs_console); run bootcmd_usb;run
> preboot;bootm 0x00800000
> bootcmd_usb=usb start; ext2load usb 0:1 0x00800000 /uImageJmybuildiscsi
> bootdelay=10
> console=console=ttyS0,115200 panic=20
> download_kernel=mw $(loadaddr) 0xffff 0x300000; fatload usb 0:1 $(loadaddr)
> $(kernel_name);
> download_rootfs=mw $(loadaddr) 0xffff 0x200000; fatload usb 0:1 $(loadaddr)
> $(rootfs_name);
> ethact=egiga0
> ethaddr=00:D0:B8:0C:FE:6C
> filesize=2dc1b1
> flash_kernel=nand erase 0x100000 0x400000; nand write.e $(loadaddr)
> 0x100000 0x400000;
> flash_rootfs=nand erase 0x500000 0xfb00000; nand write.e $(loadaddr)
> 0x500000 0x200000;
> if_netconsole=ping $(serverip)
> ipaddr=10.243.1.239
> kernel_name=openwrt-kirkwood-uImage
> load_openwrt=setenv bootargs $(console) $(bootargs_root); nand read
> $(loadaddr) 0x100000 0x400000; bootm $(loadaddr)
> loadaddr=0x6400000
> machid=B36
> mainlineLinux=yes
> ncip=10.243.1.251
> preboot=run set_eth_parms if_netconsole set_netconsole start_netconsole
> rootfs_name=openwrt-kirkwood--jffs2-64k.img
> serverip=10.243.1.251
> set_eth_parms=mii write 0xb 0 3200
> set_netconsole=setenv ncip $(serverip); setenv bootdelay 10
> start_netconsole=setenv stdin nc; setenv stdout nc; setenv stderr nc;
> version; sleep 10;
> stderr=nc
> stdin=nc
> stdout=nc
> <<<serial console
>
> /etc/fw_env.config >>>
> root at ico1:~# cat /etc/fw_env.config
> # Configuration file for fw_(printenv/saveenv) utility.
> # Up to two entries are valid, in this case the redundand
> # environment sector is assumed present.
> # MTD device name       Device offset   Env. size       Flash sector size
> # iomega iconnect
> /dev/mtd0               0xa0000         0x20000         0x20000
> root at ico1:~#
> <<< /etc/fw_env.config
>
Here I see that Device offset is 0xa0000 (which fw_printenv works
with), and looking at include/configs/iconnect.h CONFIG_ENV_OFFSET is
0x80000. The sizes do match.
Hence, can you try to change fw_env.config to have a device offset of
0x80000 and see if you get same envs?

Thanks
- Suriyan

> How do I merge this two?
> Thanks and regards.
>
> A.
> --
> ენდრიუ მე ქოხი اندريه ميهوت  אנדריי מיהו 安德魯 アンドルー Андрей  Михут אַנדרעי
> מיהוט اندرو میهو
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>


More information about the U-Boot mailing list