Skip to contentSkip to conversation

Multiple kernels and boot partitions selection

DISCUSSION gianluca 2 participants 3 messages Oct 10, 2022

lore
Share & tools
lore

gianluca

author
#0 lore raw

Hello,
I was wondering if there is/are some standard way(s) to achieve a multiple boot selection on u-boot startup.

Let's say I have a bunch of partitions:

1- /dev/mmcblk0p7 with Debian 11 Bullseye

2- /dev/mmcblk0p5 with Debian 10 Buster

All of these partitions have the /boot/uImage kernel images, the /lib/modules/$(uname -r) drivers folders and /boot/dtb device-trees into their partition section.

u-boot has NOT the specific environment partition, i.e. it is located in the end of bootloader itself up to the maximum size of the bootloader partition. So, to be clear the /dev/mmcblk0p1 contains u-boot code & envar space.

If needed I can have a MB85RC64 a 24LC64 FRAM/EEPROM compatible memory chip to store information on boot.

Regards,
Gianluca

Signature · 4 lines
Eurek s.r.l.                          |
Electronic Engineering                | http://www.eurek.it
via Celletta 8/B, 40026 Imola, Italy  | Phone: +39-(0)542-609120
p.iva 00690621206 - c.f. 04020030377  | Fax:   +39-(0)542-609212
#1 lore raw

Hi Gianluca,

Quoted 7 lines · gianluca

Hello,
I was wondering if there is/are some standard way(s) to achieve a multiple boot selection on u-boot startup.

Let's say I have a bunch of partitions:

1- /dev/mmcblk0p7 with Debian 11 Bullseye

Quoted 8 lines

2- /dev/mmcblk0p5 with Debian 10 Buster

All of these partitions have the /boot/uImage kernel images, the /lib/modules/$(uname -r) drivers folders and /boot/dtb device-trees into their partition section.

u-boot has NOT the specific environment partition, i.e. it is located in the end of bootloader itself up to the maximum size of the bootloader partition. So, to be clear the /dev/mmcblk0p1 contains u-boot code & envar space.

If needed I can have a MB85RC64 a 24LC64 FRAM/EEPROM compatible memory chip to store information on boot.

You can modify the U-Boot environment from userspace with fw_setenv from libubootenv (formerly u-boot(-fw)-tools). You can store from there which partition to use for the next boot in an environment variable.

Cheers,
Quentin

author
#2 lore raw
Quoted 12 lines · Quentin Schulz

Hi Gianluca,

Quoted 9 lines · gianluca

Hello,
I was wondering if there is/are some standard way(s) to achieve a multiple boot selection on u-boot startup.

Let's say I have a bunch of partitions:

1- /dev/mmcblk0p7 with Debian 11 Bullseye

2- /dev/mmcblk0p5 with Debian 10 Buster

Quoted 9 lines
Quoted 6 lines

All of these partitions have the /boot/uImage kernel images, the /lib/modules/$(uname -r) drivers folders and /boot/dtb device-trees into their partition section.

u-boot has NOT the specific environment partition, i.e. it is located in the end of bootloader itself up to the maximum size of the bootloader partition. So, to be clear the /dev/mmcblk0p1 contains u-boot code & envar space.

If needed I can have a MB85RC64 a 24LC64 FRAM/EEPROM compatible memory chip to store information on boot.

You can modify the U-Boot environment from userspace with fw_setenv from libubootenv (formerly u-boot(-fw)-tools). You can store from there which partition to use for the next boot in an environment variable.

As far as I know, I suppose I need an extra (let's say FAT) partition with the uboot.env transcoded file. Then, with the u-boot(-fw)-tools I can access them from userspace to change some envar like:

from:

loadimage=mmc 0:5 ${loadaddr} ${bootfile}

to:

loadimage=mmc 0:7 ${loadaddr} ${bootfile}

Quoted 1 line

fw_setenv loadimage 'mmc 0:7 ${loadaddr} ${bootfile}'

Is it right?

Regards

Signature · 4 lines
Eurek s.r.l.                          |
Electronic Engineering                | http://www.eurek.it
via Celletta 8/B, 40026 Imola, Italy  | Phone: +39-(0)542-609120
p.iva 00690621206 - c.f. 04020030377  | Fax:   +39-(0)542-609212