mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* root= kernel cmdline parameter
@ 2018-07-31 11:20 Giorgio Dal Molin
  2018-08-06 18:15 ` Uwe Kleine-König
  2018-08-08  7:52 ` Sascha Hauer
  0 siblings, 2 replies; 7+ messages in thread
From: Giorgio Dal Molin @ 2018-07-31 11:20 UTC (permalink / raw)
  To: barebox

Hi all,

I'm trying to find out the best method to define the root=
parameter when booting the linux kernel from barebox.

My system boots from an sd card partitioned with a GPT.
The sd card has two independent set of partitions with
the following labels:

1)   boot_1 + rootfs_1
2)   boot_2 + rootfs_2

for redondance in case one set gets damaged while updating.

'boot_1' is formatted with ext4 and contains the kernel + dtb images
for the userland in 'rootfs_1'; and the same for 'boot_2' and 'rootfs_2'.

Currently I hardcode the 'root' parameter to '/dev/mmcblk0p3' or
'/dev/mmcblk0p4' corresponding to the kernel in 'boot_1' or
'boot_2' and it actually works but is there a better way to do
this ?

Using the global var. 'bootm.appendroot' does not work because the
userland image is not in the same partition as the kernel.

giorgio

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: root= kernel cmdline parameter
  2018-07-31 11:20 root= kernel cmdline parameter Giorgio Dal Molin
@ 2018-08-06 18:15 ` Uwe Kleine-König
  2018-08-06 19:30   ` Giorgio Dal Molin
  2018-08-08  7:52 ` Sascha Hauer
  1 sibling, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2018-08-06 18:15 UTC (permalink / raw)
  To: Giorgio Dal Molin; +Cc: barebox

On Tue, Jul 31, 2018 at 01:20:12PM +0200, Giorgio Dal Molin wrote:
> Hi all,
> 
> I'm trying to find out the best method to define the root=
> parameter when booting the linux kernel from barebox.
> 
> My system boots from an sd card partitioned with a GPT.
> The sd card has two independent set of partitions with
> the following labels:
> 
> 1)   boot_1 + rootfs_1
> 2)   boot_2 + rootfs_2
> 
> for redondance in case one set gets damaged while updating.
> 
> 'boot_1' is formatted with ext4 and contains the kernel + dtb images
> for the userland in 'rootfs_1'; and the same for 'boot_2' and 'rootfs_2'.
> 
> Currently I hardcode the 'root' parameter to '/dev/mmcblk0p3' or
> '/dev/mmcblk0p4' corresponding to the kernel in 'boot_1' or
> 'boot_2' and it actually works but is there a better way to do
> this ?
> 
> Using the global var. 'bootm.appendroot' does not work because the
> userland image is not in the same partition as the kernel.

What is the blocker to put kernel and dtb in rootfs_X?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: root= kernel cmdline parameter
  2018-08-06 18:15 ` Uwe Kleine-König
@ 2018-08-06 19:30   ` Giorgio Dal Molin
  2018-08-06 19:44     ` Uwe Kleine-König
  0 siblings, 1 reply; 7+ messages in thread
From: Giorgio Dal Molin @ 2018-08-06 19:30 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox


[-- Attachment #1.1.1: Type: text/plain, Size: 1427 bytes --]

On 08/06/2018 08:15 PM, Uwe Kleine-König wrote:
> On Tue, Jul 31, 2018 at 01:20:12PM +0200, Giorgio Dal Molin wrote:
>> Hi all,
>>
>> I'm trying to find out the best method to define the root=
>> parameter when booting the linux kernel from barebox.
>>
>> My system boots from an sd card partitioned with a GPT.
>> The sd card has two independent set of partitions with
>> the following labels:
>>
>> 1)   boot_1 + rootfs_1
>> 2)   boot_2 + rootfs_2
>>
>> for redondance in case one set gets damaged while updating.
>>
>> 'boot_1' is formatted with ext4 and contains the kernel + dtb images
>> for the userland in 'rootfs_1'; and the same for 'boot_2' and 'rootfs_2'.
>>
>> Currently I hardcode the 'root' parameter to '/dev/mmcblk0p3' or
>> '/dev/mmcblk0p4' corresponding to the kernel in 'boot_1' or
>> 'boot_2' and it actually works but is there a better way to do
>> this ?
>>
>> Using the global var. 'bootm.appendroot' does not work because the
>> userland image is not in the same partition as the kernel.
> 
> What is the blocker to put kernel and dtb in rootfs_X?
> 
> Best regards
> Uwe
> 
Hi,

thank you for answering.

I would like to keep kernel and userland separate to be flexible about
how to pack the userland. The kernel supports more filesystems as the
bootloader so I prefer to keep kernel+dtb in a small ext? partition and
the rest in a separate part.

giorgio


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 899 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: root= kernel cmdline parameter
  2018-08-06 19:30   ` Giorgio Dal Molin
@ 2018-08-06 19:44     ` Uwe Kleine-König
  0 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2018-08-06 19:44 UTC (permalink / raw)
  To: Giorgio Dal Molin; +Cc: barebox

Hello,

On Mon, Aug 06, 2018 at 09:30:30PM +0200, Giorgio Dal Molin wrote:
> On 08/06/2018 08:15 PM, Uwe Kleine-König wrote:
> > On Tue, Jul 31, 2018 at 01:20:12PM +0200, Giorgio Dal Molin wrote:
> >> Hi all,
> >>
> >> I'm trying to find out the best method to define the root=
> >> parameter when booting the linux kernel from barebox.
> >>
> >> My system boots from an sd card partitioned with a GPT.
> >> The sd card has two independent set of partitions with
> >> the following labels:
> >>
> >> 1)   boot_1 + rootfs_1
> >> 2)   boot_2 + rootfs_2
> >>
> >> for redondance in case one set gets damaged while updating.
> >>
> >> 'boot_1' is formatted with ext4 and contains the kernel + dtb images
> >> for the userland in 'rootfs_1'; and the same for 'boot_2' and 'rootfs_2'.
> >>
> >> Currently I hardcode the 'root' parameter to '/dev/mmcblk0p3' or
> >> '/dev/mmcblk0p4' corresponding to the kernel in 'boot_1' or
> >> 'boot_2' and it actually works but is there a better way to do
> >> this ?
> >>
> >> Using the global var. 'bootm.appendroot' does not work because the
> >> userland image is not in the same partition as the kernel.
> > 
> > What is the blocker to put kernel and dtb in rootfs_X?
> 
> I would like to keep kernel and userland separate to be flexible about
> how to pack the userland. The kernel supports more filesystems as the
> bootloader so I prefer to keep kernel+dtb in a small ext? partition and
> the rest in a separate part.

Is this a theoretical flexibility? i.e. do you use something for
rootfs_X that isn't supported in barebox? If no: You're making your life
unnecessary hard. If yes: why not teach barebox about it?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: root= kernel cmdline parameter
  2018-07-31 11:20 root= kernel cmdline parameter Giorgio Dal Molin
  2018-08-06 18:15 ` Uwe Kleine-König
@ 2018-08-08  7:52 ` Sascha Hauer
  2018-08-09  7:45   ` Giorgio Dal Molin
  1 sibling, 1 reply; 7+ messages in thread
From: Sascha Hauer @ 2018-08-08  7:52 UTC (permalink / raw)
  To: Giorgio Dal Molin; +Cc: barebox

On Tue, Jul 31, 2018 at 01:20:12PM +0200, Giorgio Dal Molin wrote:
> Hi all,
> 
> I'm trying to find out the best method to define the root=
> parameter when booting the linux kernel from barebox.
> 
> My system boots from an sd card partitioned with a GPT.
> The sd card has two independent set of partitions with
> the following labels:
> 
> 1)   boot_1 + rootfs_1
> 2)   boot_2 + rootfs_2
> 
> for redondance in case one set gets damaged while updating.
> 
> 'boot_1' is formatted with ext4 and contains the kernel + dtb images
> for the userland in 'rootfs_1'; and the same for 'boot_2' and 'rootfs_2'.
> 
> Currently I hardcode the 'root' parameter to '/dev/mmcblk0p3' or
> '/dev/mmcblk0p4' corresponding to the kernel in 'boot_1' or
> 'boot_2' and it actually works but is there a better way to do
> this ?

You could use bootloader spec. That would at least allow you to store a
suitable root= parameter in the config files in the boot_1 and boot_2
partitions.

Not sure if that's what you are looking for though.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: root= kernel cmdline parameter
  2018-08-08  7:52 ` Sascha Hauer
@ 2018-08-09  7:45   ` Giorgio Dal Molin
  2018-08-31 13:43     ` Giorgio Dal Molin
  0 siblings, 1 reply; 7+ messages in thread
From: Giorgio Dal Molin @ 2018-08-09  7:45 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, u.kleine-koenig

Hi,

> On August 8, 2018 at 9:52 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
> 
> 
> On Tue, Jul 31, 2018 at 01:20:12PM +0200, Giorgio Dal Molin wrote:
> > Hi all,
> > 
> > I'm trying to find out the best method to define the root=
> > parameter when booting the linux kernel from barebox.
> > 
> > My system boots from an sd card partitioned with a GPT.
> > The sd card has two independent set of partitions with
> > the following labels:
> > 
> > 1)   boot_1 + rootfs_1
> > 2)   boot_2 + rootfs_2
> > 
> > for redondance in case one set gets damaged while updating.
> > 
> > 'boot_1' is formatted with ext4 and contains the kernel + dtb images
> > for the userland in 'rootfs_1'; and the same for 'boot_2' and 'rootfs_2'.
> > 
> > Currently I hardcode the 'root' parameter to '/dev/mmcblk0p3' or
> > '/dev/mmcblk0p4' corresponding to the kernel in 'boot_1' or
> > 'boot_2' and it actually works but is there a better way to do
> > this ?
> 
> You could use bootloader spec. That would at least allow you to store a
> suitable root= parameter in the config files in the boot_1 and boot_2
> partitions.
> 
> Not sure if that's what you are looking for though.
> 
> Sascha
> 

as I already wrote to Uwe Kleine-Koenig I wanted to keep the kernel
image and the dtb in a separate partition because these are the files
the bootloader *must* be able to read to boot the system. Having the
userland in a separate partition lets me choose an image format for it
independently from what barebox supports; as an example I could pack
my userland in a btrfs image. Moreover I can be more selective when
updating the firmware: I can update only the kernel+dtb or only the
userland image.

What I would like to have is an automatic way to set the root= kernel
command line parameter similar to what barebox does with the 'bootm.appendroot'
but a bit more flexible.
Looking at the kernel function name_to_dev_t() in the source init/do_mounts.c,
it accepts also the format 'PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF':
my idea was to somehow tell barebox 'use the partition with label "rootfs_1"
for the "root" parameter' and barebox should be able to match my label with
the partition UUID and automatically generate the root= value.

giorgio

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: root= kernel cmdline parameter
  2018-08-09  7:45   ` Giorgio Dal Molin
@ 2018-08-31 13:43     ` Giorgio Dal Molin
  0 siblings, 0 replies; 7+ messages in thread
From: Giorgio Dal Molin @ 2018-08-31 13:43 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, u.kleine-koenig

Hi,

> On August 9, 2018 at 9:45 AM Giorgio Dal Molin <giorgio.nicole@arcor.de> wrote:
> 
> 
> Hi,
> 
> > On August 8, 2018 at 9:52 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > 
> > 
> > On Tue, Jul 31, 2018 at 01:20:12PM +0200, Giorgio Dal Molin wrote:
> > > Hi all,
> > > 
> > > I'm trying to find out the best method to define the root=
> > > parameter when booting the linux kernel from barebox.
> > > 
> > > My system boots from an sd card partitioned with a GPT.
> > > The sd card has two independent set of partitions with
> > > the following labels:
> > > 
> > > 1)   boot_1 + rootfs_1
> > > 2)   boot_2 + rootfs_2
> > > 
> > > for redondance in case one set gets damaged while updating.
> > > 
> > > 'boot_1' is formatted with ext4 and contains the kernel + dtb images
> > > for the userland in 'rootfs_1'; and the same for 'boot_2' and 'rootfs_2'.
> > > 
> > > Currently I hardcode the 'root' parameter to '/dev/mmcblk0p3' or
> > > '/dev/mmcblk0p4' corresponding to the kernel in 'boot_1' or
> > > 'boot_2' and it actually works but is there a better way to do
> > > this ?
> > 
> > You could use bootloader spec. That would at least allow you to store a
> > suitable root= parameter in the config files in the boot_1 and boot_2
> > partitions.
> > 
> > Not sure if that's what you are looking for though.
> > 
> > Sascha
> > 
> 
> as I already wrote to Uwe Kleine-Koenig I wanted to keep the kernel
> image and the dtb in a separate partition because these are the files
> the bootloader *must* be able to read to boot the system. Having the
> userland in a separate partition lets me choose an image format for it
> independently from what barebox supports; as an example I could pack
> my userland in a btrfs image. Moreover I can be more selective when
> updating the firmware: I can update only the kernel+dtb or only the
> userland image.
> 
> What I would like to have is an automatic way to set the root= kernel
> command line parameter similar to what barebox does with the 'bootm.appendroot'
> but a bit more flexible.
> Looking at the kernel function name_to_dev_t() in the source init/do_mounts.c,
> it accepts also the format 'PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF':
> my idea was to somehow tell barebox 'use the partition with label "rootfs_1"
> for the "root" parameter' and barebox should be able to match my label with
> the partition UUID and automatically generate the root= value.
> 
> giorgio

grepping a bit through the barebox sources I've found that what I need is
actually already implemented!

I know that at least one of 'rootfs_1' and 'rootfs_2' must contain a valid
userland image (a squashfs image); now, in my 'init' I try to 'mount -t squashfs'
rootfs_1: if it works I found that barebox defines a global variable '$squashfs0.linux.bootargs'
with exactly the content I need (root=PARTUUID=...). I just have to use this var.
to define my global linux.bootarg:

global linux.bootargs.root=$squashfs0.linux.bootargs

giorgio

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2018-08-31 13:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31 11:20 root= kernel cmdline parameter Giorgio Dal Molin
2018-08-06 18:15 ` Uwe Kleine-König
2018-08-06 19:30   ` Giorgio Dal Molin
2018-08-06 19:44     ` Uwe Kleine-König
2018-08-08  7:52 ` Sascha Hauer
2018-08-09  7:45   ` Giorgio Dal Molin
2018-08-31 13:43     ` Giorgio Dal Molin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox