Choosing the correct kernel booted in the an A/B multi partition setup

I have my microSD card setup with 3 partitions:

  • Partition 1: containing just uEnv.txt. Defined uenv_root=/dev/mmcblk0p3, mmcdev=0 mmcpart=3. Undefined: uname_r
  • Partition 2: root partition installed only kernel 4.4.113-ti-r149. In /boot/uEnv.txt, defined: uname_r=4.4.113-ti-r149. Undefined uenv_root, mmcpart, mmcdev
  • Partition 3: root partition installed only kernel 4.4.113-ti-r145. In /boot/uEnv.txt, defined: uname_r=4.4.113-ti-r145. Undefined uenv_root, mmcpart, mmcdev

On boot, the BBB boots to partition 3 and is accessible via serial console. However, there is no USB network connectivity. This is presumably caused by the wrong kernel as uname -a shows that 4.4.113-ti-r149 is booted instead of 4.4.113-ti-r145.

I have looked at the uboot patch[1] and verified that leaving uname_r undefined will result in a correct kernel boot in partition 3. However this will affect the booting to partition 2 when I wish to toggle the booted root partition

Question: are there less hackish ways to boot to the correct kernel in partition 3? Thanks!

–Luther

[1] https://github.com/eewiki/u-boot-patches/blob/master/v2018.05-rc1/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch#L1063-L1068