[PATCH v2 0/2] uboot-envtools: support for multiple config partitions

Bjørn Mork bjorn at mork.no
Wed Dec 16 09:14:20 EST 2020


Stijn Segers <foss at volatilesystems.org> writes:

> I'm giving this a spin (since I have a Realtek switch now :^)

Great! Thanks for testing

> ). Fw_printenv prints info as expected but fw_printsys comes up
> empty. Not sure if this is expected behaviour. There's no
> /etc/fw_sys.config after installing the new uboot-envtools package
> (revision 10).
>
> # fw_printenv
> baudrate=115200
> boardmodel=ZyXEL_GS1900_10HP
> bootargs=console=ttyS0,115200 mem=64M quiet
> bootcmd=cst fcTest; boota
> bootdelay=0
> ethact=rtl8380#0
> ethaddr=BC:CF:4F:74:3C:15
> ipaddr=192.168.1.1
> netmask=255.255.255.0
> serverip=192.168.1.111
> stderr=serial
> stdin=serial
> stdout=serial
> # fw_printsys
> # ls /etc/fw*
> /etc/fw_env.config
>
> Calling 'fw_setsys bootpartition 0' e.g. exits silently. No
> /etc/fw_sys.config gets created.

The /etc/fw_sys.config is supposed to be created on first installation,
just like the /etc/fw_env.config. I wasn't quite sure what to do in the
wrapper if it doesn't exist. The wrapper cannot know if the config is
supposed to be there or not. So the current version will just exit
silently, as you've observed.  Maybe not the best solution?  I am open
to ideas.

Anyway, the config files will only be generated if /etc/config/ubootenv
doesn't exist. If you installed to flash you can look at

  /rom/etc/uci-defaults/30_uboot-envtools

The first line is "[ -e /etc/config/ubootenv ] && exit 0"

This is how the package has been working all the time.  It should
probably be fixed.  But I guess the assumption was that the environment
partition config is a hardware property which will not change?


> When I create /etc/fw_sys.config manually then try to set a value
> again, it errors:
>
> # fw_setsys bootpartition 0
> Cannot parse config file '/etc/fw_sys.config': Invalid argument
> Error: environment not initialized
> root at OpenWrt:~# ls /etc/fw_sys.config
> /etc/fw_sys.config
> #
>


That's strange.  What does the file look like?  FWIW, here is mine from
the same switch model:

root at gs1900-10hp:/# cat /etc/fw_sys.config 
/dev/mtd2 0x0 0x1000 0x10000 

And it works:

root at gs1900-10hp:/# fw_printsys
resetdefault=0
mac_start=BC:CF:4F:D1:6B:32
mac_end=BC:CF:4F:D1:6B:3C
sn=S202L28001735
dualfname1=2.60(AAZI.2)C0.bix
dualfname0=x.bin
bootpartition=0



This is my ubootenv (which is irrelevant as it isn't be used by
anything after first install):

root at gs1900-10hp:/# cat /etc/config/ubootenv 

config ubootenv
        option dev '/dev/mtd1'
        option offset '0x0'
        option envsize '0x400'
        option secsize '0x10000'

config ubootsys
        option dev '/dev/mtd2'
        option offset '0x0'
        option envsize '0x1000'
        option secsize '0x10000'



Bjørn



More information about the openwrt-devel mailing list