0

Currently I try to implement A/B partitioning so I can perform system updates with Mender and rollback if necessary. One problem is, that the device numbers can change randomly and I need to consider this.

# lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
mmcblk0      179:0    0  7.3G  0 disk              # This can became mmcblk1
|-mmcblk0p1  179:1    0  250M  0 part /            # rootfsA, rootfsB not implemented yet
`-mmcblk0p2  179:2    0   50M  0 part /mnt         # Data partition, persistent
mmcblk0boot0 179:32   0    4M  1 disk              
mmcblk0boot1 179:64   0    4M  1 disk 

At the moment I handle this way.

set_bootargs=env set bootargs root=PARTUUID=00000000-0${bootpart} rootfstype=ext4 rootwait ${console} rw panic=5

After I performed the update (custom script overwrites rootfsB), I need to perform fw_setenv upgrade_available 1. Afterwards if boot to rootfsB was successful I will set fw_setenv upgrade_available 0 and fw_setenv bootcount 0.

My fw_config.cfg looks like this

# U-Boot environment is stored on the data partition
/mnt/uboot.env      0x0000      0x1000

What do I need to do in order to load /mnt/uboot.env into U-Boot and, write to it from OS and keep this changes so if bootcount == bootlimit my altbootcmd will control which partition to boot?

uboot.config

Component Specification
SBC Radxa Zero v1.51, 2GB RAM, 8GB eMMC, 4 Cores
SOC S905Y2
Processor ARM Cortex-A53
Architecture ARMv8-A
WiFi/BT AP6256, BCM43456/BCM4345C5, b/g/n/a/ac - BT5.0
OS Buildroot 2022.11, System V
Kernel Latest CIP SLTS version (5.10.145-cip17)
Bootloader Custom U-Boot 2021.01 with vendor FIP
Pinout Link
Quick Reference Manual Link
  • I've set `BOOTCOUNT_ENV [=y]` so `bootcount` is stored in env. – mister_kanister Jun 14 '23 at 14:29
  • Right, `BOOTCOUNT_ENV [=y]` is set so `bootcount` will be counted if `upgrade_available=1`. Furthermore I need to set `bootlimit=5` in my U-Boot env. I also managed to write U-Boot env from OS when set `CONFIG_ENV_IS_IN_EXT4=y`. The U-Boot env is now stored on my persisten data partition. – mister_kanister Jul 05 '23 at 09:25

0 Answers0