All of lore.kernel.org
 help / color / mirror / Atom feed
* Multiple kernels and boot partitions selection
@ 2022-10-10  7:06 gianluca
  2022-10-10  8:06 ` Quentin Schulz
  0 siblings, 1 reply; 3+ messages in thread
From: gianluca @ 2022-10-10  7:06 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Multiple kernels and boot partitions selection
  2022-10-10  7:06 Multiple kernels and boot partitions selection gianluca
@ 2022-10-10  8:06 ` Quentin Schulz
  2022-10-10  8:38   ` gianluca
  0 siblings, 1 reply; 3+ messages in thread
From: Quentin Schulz @ 2022-10-10  8:06 UTC (permalink / raw)
  To: gianluca, u-boot

Hi Gianluca,

On 10/10/22 09:06, gianluca wrote:
> 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.
> 

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Multiple kernels and boot partitions selection
  2022-10-10  8:06 ` Quentin Schulz
@ 2022-10-10  8:38   ` gianluca
  0 siblings, 0 replies; 3+ messages in thread
From: gianluca @ 2022-10-10  8:38 UTC (permalink / raw)
  To: Quentin Schulz, u-boot

On 10/10/22 10:06, Quentin Schulz wrote:
> Hi Gianluca,
> 
> On 10/10/22 09:06, gianluca wrote:
>> 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.
>>
> 
> 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}


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


Is it right?

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-10  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10  7:06 Multiple kernels and boot partitions selection gianluca
2022-10-10  8:06 ` Quentin Schulz
2022-10-10  8:38   ` gianluca

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.