Read/modify Omnia bootloader environment

Turris Omnia - rtrom01
Turris OS 3.9.6
Kernel 4.4.119-082ea0f4a4e204b99821bedcb349ed54-0
uboot-envtools 2014.10-3

Is the Omnia repo utilizing the same uboot_env as the openWRT upstream repo?

With uboot-envtools installed supposeldy the bootloader environment can be viewed/manipulated though SSH CL after having fw_env.config setup.

cat /proc/mtd produces

dev: size erasesize name
mtd0: 00100000 00010000 "U-Boot"
mtd1: 00700000 00010000 “Rescue system”

What seems to be missing is "uboot_env" - is it hidden or am I missing something , because other value supposed to be present are not showing either, e.g.

"firmware" "kernel" "rootfs" "rootfs_data" "board_config" :confused:

there is apparently a script (/lib/ in place for producing etc/fw_env.config but for some reason root has not permission to execute it

You have to configure uboot-envtools first.

echo "/dev/mtd0 0xC0000 0x10000 0x40000" > /etc/fw_env.config

But in default there is no configuration set in environment (bad CRC is reported in such case). To save default configuration you have to boot with serial console attached. Enter uboot cli and type saveenv that saves default configuration. Then you should be able to use fw_printenv and fw_setenv.


mtd0 is already assigned to "U-Boot" and reading here it would be my understanding that "uboot_env" should be a separate mtd, should it not?

Accessing U-Boot environment variables in OpenWrt

The relevant tools to manipulate the U-Boot environment are contained in the opkg-package uboot-envtools. Inside a working system consult the file /proc/mtd that should contain the mapping of the flash of the router. We can thus determine the partition where the U-Boot environment is stored.

Some devices seem not to have the uboot_env section and the environment appears with an offset in the section containing uboot (/dev/mtd0) here. In the latter case expect that the environment address (offset) is a multiple of Flash sector size.

mtd is just virtual division for Linux system. In reality it really doesn’t matter. You can flash what ever you want and then partition it how ever you want. In case of uboot you can set offset (that is second value in fw_env.config file). So no unless you have for some reason need to have it separate then it really doesn’t have to be separate.

1 Like

Just for those searching around and used the provided uboot-envtools configuration without success, the new uboot environment uses different values:

echo "/dev/mtd0 0xf0000 0x10000 0x10000" > /etc/fw_env.config

As discussed here: [U-Boot 2019.07 | uboot-envtools] mtd space layout mismatch (#603) · Issues · Turris / Turris OS / Turris OS packages · GitLab