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

Stijn Segers foss at volatilesystems.org
Wed Dec 16 18:04:08 EST 2020


Hi,

Op woensdag 16 december 2020 om 15u14 schreef Bjørn Mork 
<bjorn at mork.no>:
> 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?


Yeah I reckon that's the issue. It doesn't check for any settings,so 
technically
even an empty file would do. Which is pretty coarse. One could do a 
nested check
to see first if ubootenv UCI values exist, and only then probe for UCI 
ubootsys
values - but that would mean more lines of code for checks etc.?

On the other hand, the situation I was in is one that won't be too 
widespread -
switches aren't as hot as 802.11ax devices, so this is probably an edge 
case. The
curse of the early adopter :-).

> 
> 
>>  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
> 

Yeah mine was completely empty (I just touched it to see if I'd get any 
meaningful output).

> 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
> 

Yeah, after filling /etc/fw_sys.config with the right values, it works 
here too. Thanks for
pointing me at the /rom/etc/uci-defaults/ script. It was staring me in 
the face in the file
list of uboot-envtools but still.

> 
> 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
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel





More information about the openwrt-devel mailing list