linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* No /dev/root with devtmpfs?
@ 2012-02-06 11:18 Kirill Smelkov
  2012-02-06 12:10 ` Paul Parsons
  2012-02-06 19:45 ` Kay Sievers
  0 siblings, 2 replies; 17+ messages in thread
From: Kirill Smelkov @ 2012-02-06 11:18 UTC (permalink / raw)
  To: linux-kernel; +Cc: Kay Sievers

Hello up there.

Recently I've reworked my system not to use udev, but use devtmpfs
instead and discovered there is no /dev/root symlink in devtmpfs case.

My setup uses /dev/root early to know what is the boot device and then
do some operations on it like checksumming, etc...

Now when /dev/root is gone the best workaround I could come up with is
to   grep /proc/partitions for '[hs]d[a-z]1'  but it's ugly and will
break when there are several block devices attached.


Is it somehow possible to add /dev/root to devtmpfs?


Thanks,
Kirill

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

* Re: No /dev/root with devtmpfs?
  2012-02-06 11:18 No /dev/root with devtmpfs? Kirill Smelkov
@ 2012-02-06 12:10 ` Paul Parsons
  2012-02-06 12:52   ` Kirill Smelkov
  2012-02-06 19:45 ` Kay Sievers
  1 sibling, 1 reply; 17+ messages in thread
From: Paul Parsons @ 2012-02-06 12:10 UTC (permalink / raw)
  To: linux-kernel, Kirill Smelkov; +Cc: Kay Sievers

--- On Mon, 6/2/12, Kirill Smelkov <kirr@mns.spb.ru> wrote:
> Is it somehow possible to add /dev/root to devtmpfs?

Or alternatively have /proc/mounts report the actual root device
instead of "/dev/root" ?

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

* Re: No /dev/root with devtmpfs?
  2012-02-06 12:10 ` Paul Parsons
@ 2012-02-06 12:52   ` Kirill Smelkov
  0 siblings, 0 replies; 17+ messages in thread
From: Kirill Smelkov @ 2012-02-06 12:52 UTC (permalink / raw)
  To: Paul Parsons; +Cc: linux-kernel, Kay Sievers

On Mon, Feb 06, 2012 at 12:10:27PM +0000, Paul Parsons wrote:
> --- On Mon, 6/2/12, Kirill Smelkov <kirr@mns.spb.ru> wrote:
> > Is it somehow possible to add /dev/root to devtmpfs?
> 
> Or alternatively have /proc/mounts report the actual root device
> instead of "/dev/root" ?

Sorry, I have not included that info originally. No, it shows /dev/root
there too:

    root@(none):/# cat /proc/mounts 
    rootfs / rootfs rw 0 0
    /dev/root / ext3 ro,relatime,barrier=0,data=writeback 0 0
    devtmpfs /dev devtmpfs rw,relatime,size=61564k,nr_inodes=15391,mode=755 0 0
    tmpfs /lib/init/rw tmpfs rw,nosuid,relatime,mode=755 0 0
    proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
    sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0

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

* Re: No /dev/root with devtmpfs?
  2012-02-06 11:18 No /dev/root with devtmpfs? Kirill Smelkov
  2012-02-06 12:10 ` Paul Parsons
@ 2012-02-06 19:45 ` Kay Sievers
  2012-02-07  7:55   ` Kirill Smelkov
  1 sibling, 1 reply; 17+ messages in thread
From: Kay Sievers @ 2012-02-06 19:45 UTC (permalink / raw)
  To: Kirill Smelkov; +Cc: linux-kernel

On Mon, Feb 6, 2012 at 12:18, Kirill Smelkov <kirr@mns.spb.ru> wrote:
> Recently I've reworked my system not to use udev, but use devtmpfs
> instead and discovered there is no /dev/root symlink in devtmpfs case.
>
> My setup uses /dev/root early to know what is the boot device and then
> do some operations on it like checksumming, etc...
>
> Now when /dev/root is gone the best workaround I could come up with is
> to   grep /proc/partitions for '[hs]d[a-z]1'  but it's ugly and will
> break when there are several block devices attached.
>
> Is it somehow possible to add /dev/root to devtmpfs?

No, devtmpfs has no business in knowing anything about the rootfs or
who mounted what ans where. I can not create such links.

The entire concept of /dev/root is flawed anyway, and nothing should
really depend on that.

Modern filesystems will not offer a direct relation to a single block
device, they allocate an superblock which has a major == 0, so there
can be by definition never such a link. Better get rid of all uses of
/dev/root, it will just fail in the future.

Kay

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

* Re: No /dev/root with devtmpfs?
  2012-02-06 19:45 ` Kay Sievers
@ 2012-02-07  7:55   ` Kirill Smelkov
  2012-02-07 10:05     ` Kay Sievers
  0 siblings, 1 reply; 17+ messages in thread
From: Kirill Smelkov @ 2012-02-07  7:55 UTC (permalink / raw)
  To: Kay Sievers; +Cc: linux-kernel

On Mon, Feb 06, 2012 at 08:45:24PM +0100, Kay Sievers wrote:
> On Mon, Feb 6, 2012 at 12:18, Kirill Smelkov <kirr@mns.spb.ru> wrote:
> > Recently I've reworked my system not to use udev, but use devtmpfs
> > instead and discovered there is no /dev/root symlink in devtmpfs case.
> >
> > My setup uses /dev/root early to know what is the boot device and then
> > do some operations on it like checksumming, etc...
> >
> > Now when /dev/root is gone the best workaround I could come up with is
> > to   grep /proc/partitions for '[hs]d[a-z]1'  but it's ugly and will
> > break when there are several block devices attached.
> >
> > Is it somehow possible to add /dev/root to devtmpfs?
> 
> No, devtmpfs has no business in knowing anything about the rootfs or
> who mounted what ans where. I can not create such links.
> 
> The entire concept of /dev/root is flawed anyway, and nothing should
> really depend on that.
> 
> Modern filesystems will not offer a direct relation to a single block
> device, they allocate an superblock which has a major == 0, so there
> can be by definition never such a link. Better get rid of all uses of
> /dev/root, it will just fail in the future.

Kay, thanks for explanation.

Though now I'm confused about how to know on what "place" root
filesystem was mounted... To me the question makes sense, but you say
with modern filesystems there by definition is no answer (or did I
misunderstood you?) Strange...

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

* Re: No /dev/root with devtmpfs?
  2012-02-07  7:55   ` Kirill Smelkov
@ 2012-02-07 10:05     ` Kay Sievers
  2012-02-08  7:35       ` Kirill Smelkov
  0 siblings, 1 reply; 17+ messages in thread
From: Kay Sievers @ 2012-02-07 10:05 UTC (permalink / raw)
  To: Kirill Smelkov; +Cc: linux-kernel

On Tue, Feb 7, 2012 at 08:55, Kirill Smelkov <kirr@mns.spb.ru> wrote:
> On Mon, Feb 06, 2012 at 08:45:24PM +0100, Kay Sievers wrote:
>> On Mon, Feb 6, 2012 at 12:18, Kirill Smelkov <kirr@mns.spb.ru> wrote:
>> > Recently I've reworked my system not to use udev, but use devtmpfs
>> > instead and discovered there is no /dev/root symlink in devtmpfs case.
>> >
>> > My setup uses /dev/root early to know what is the boot device and then
>> > do some operations on it like checksumming, etc...
>> >
>> > Now when /dev/root is gone the best workaround I could come up with is
>> > to   grep /proc/partitions for '[hs]d[a-z]1'  but it's ugly and will
>> > break when there are several block devices attached.
>> >
>> > Is it somehow possible to add /dev/root to devtmpfs?
>>
>> No, devtmpfs has no business in knowing anything about the rootfs or
>> who mounted what ans where. I can not create such links.
>>
>> The entire concept of /dev/root is flawed anyway, and nothing should
>> really depend on that.
>>
>> Modern filesystems will not offer a direct relation to a single block
>> device, they allocate an superblock which has a major == 0, so there
>> can be by definition never such a link. Better get rid of all uses of
>> /dev/root, it will just fail in the future.
>
> Kay, thanks for explanation.
>
> Though now I'm confused about how to know on what "place" root
> filesystem was mounted... To me the question makes sense, but you say
> with modern filesystems there by definition is no answer (or did I
> misunderstood you?) Strange...

The root filesystem will still be mounted at /, but you can not
identify by a device. Check the difference between:
  $ mountpoint -d /
  8:1
which is a classic ext4 sda1 device behind "/".

With 'btrfs' it will just look like 'tmpfs' looks today:
  $ mountpoint -d /dev/shm
  0:17

and while the 'btrfs' file system is surely backed by a
disk/partition, just like ext4 is, there can still never be a symlink
to the disk device.

Tools need to work without in the future without having a /dev/root symlink

Kay

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

* Re: No /dev/root with devtmpfs?
  2012-02-07 10:05     ` Kay Sievers
@ 2012-02-08  7:35       ` Kirill Smelkov
  2012-02-08 16:44         ` Paul Parsons
  0 siblings, 1 reply; 17+ messages in thread
From: Kirill Smelkov @ 2012-02-08  7:35 UTC (permalink / raw)
  To: Kay Sievers; +Cc: linux-kernel

On Tue, Feb 07, 2012 at 11:05:42AM +0100, Kay Sievers wrote:
> On Tue, Feb 7, 2012 at 08:55, Kirill Smelkov <kirr@mns.spb.ru> wrote:
> > On Mon, Feb 06, 2012 at 08:45:24PM +0100, Kay Sievers wrote:
> >> On Mon, Feb 6, 2012 at 12:18, Kirill Smelkov <kirr@mns.spb.ru> wrote:
> >> > Recently I've reworked my system not to use udev, but use devtmpfs
> >> > instead and discovered there is no /dev/root symlink in devtmpfs case.
> >> >
> >> > My setup uses /dev/root early to know what is the boot device and then
> >> > do some operations on it like checksumming, etc...
> >> >
> >> > Now when /dev/root is gone the best workaround I could come up with is
> >> > to   grep /proc/partitions for '[hs]d[a-z]1'  but it's ugly and will
> >> > break when there are several block devices attached.
> >> >
> >> > Is it somehow possible to add /dev/root to devtmpfs?
> >>
> >> No, devtmpfs has no business in knowing anything about the rootfs or
> >> who mounted what ans where. I can not create such links.
> >>
> >> The entire concept of /dev/root is flawed anyway, and nothing should
> >> really depend on that.
> >>
> >> Modern filesystems will not offer a direct relation to a single block
> >> device, they allocate an superblock which has a major == 0, so there
> >> can be by definition never such a link. Better get rid of all uses of
> >> /dev/root, it will just fail in the future.
> >
> > Kay, thanks for explanation.
> >
> > Though now I'm confused about how to know on what "place" root
> > filesystem was mounted... To me the question makes sense, but you say
> > with modern filesystems there by definition is no answer (or did I
> > misunderstood you?) Strange...
> 
> The root filesystem will still be mounted at /, but you can not
> identify by a device. Check the difference between:
>   $ mountpoint -d /
>   8:1
> which is a classic ext4 sda1 device behind "/".
> 
> With 'btrfs' it will just look like 'tmpfs' looks today:
>   $ mountpoint -d /dev/shm
>   0:17
> 
> and while the 'btrfs' file system is surely backed by a
> disk/partition, just like ext4 is, there can still never be a symlink
> to the disk device.

Kay, thanks again for explanation.

I understand that in case filesystems allocate major 0 there could not
be a well-defined /dev/root, but I don't understand the rationale for
doing so.

Maybe allocating major=0 is a good thing, but look at it this way:

"On what disk/partition was / mounted?" is a well-defined question for
cases when backing store is local hdd, so there should be well-defined
answer.

Previously it was /dev/root, but if /dev/root is not good there should be
some other way for getting the answer. With ext2 I've switched to
`mountpoint -d /` and then grepping major/minor in /proc/partitions, but
with major=0 case I suspect this won't work.


My use case is to check md5 sum of mbr + bootloader area +
root-partition early right after the boot, to verify whether software is
not corrupt, and for doing so it was useful to know / -> root-partition
-> whole block device. It's not tivo, just checking for medium damage. (I
understand this would be better done in the early bootloader but that
part is out of my control)



Sorry for maybe repeating myself and thanks again,
Kirill

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

* Re: No /dev/root with devtmpfs?
  2012-02-08  7:35       ` Kirill Smelkov
@ 2012-02-08 16:44         ` Paul Parsons
  2012-02-08 17:20           ` H. Peter Anvin
  2012-02-10  9:04           ` Kirill Smelkov
  0 siblings, 2 replies; 17+ messages in thread
From: Paul Parsons @ 2012-02-08 16:44 UTC (permalink / raw)
  To: Kay Sievers, Kirill Smelkov; +Cc: linux-kernel

--- On Wed, 8/2/12, Kirill Smelkov <kirr@mns.spb.ru> wrote:
> "On what disk/partition was / mounted?" is a well-defined
> question for
> cases when backing store is local hdd, so there should be
> well-defined
> answer.
> 
> Previously it was /dev/root, but if /dev/root is not good
> there should be
> some other way for getting the answer. With ext2 I've
> switched to
> `mountpoint -d /` and then grepping major/minor in
> /proc/partitions, but
> with major=0 case I suspect this won't work.
> 
> 
> My use case is to check md5 sum of mbr + bootloader area +
> root-partition early right after the boot, to verify whether
> software is
> not corrupt, and for doing so it was useful to know / ->
> root-partition
> -> whole block device. It's not tivo, just checking for
> medium damage. (I
> understand this would be better done in the early bootloader
> but that
> part is out of my control)

Could you simply use /etc/fstab to identify the root partition?


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

* Re: No /dev/root with devtmpfs?
  2012-02-08 16:44         ` Paul Parsons
@ 2012-02-08 17:20           ` H. Peter Anvin
  2012-02-08 17:25             ` Kay Sievers
  2012-02-10  9:04           ` Kirill Smelkov
  1 sibling, 1 reply; 17+ messages in thread
From: H. Peter Anvin @ 2012-02-08 17:20 UTC (permalink / raw)
  To: Paul Parsons; +Cc: Kay Sievers, Kirill Smelkov, linux-kernel

On 02/08/2012 08:44 AM, Paul Parsons wrote:
> 
> Could you simply use /etc/fstab to identify the root partition?
> 

That's not a very good thing, as it is much more likely to be wrong.

It would be a good thing to have the /dev/root symlink *IF* a valid root
device exists (defined as a device node appearing which has the same
device number as reported by stat on the root directory), if nothing
else because we have had one available for a very long time and this is
needless breakage.

Obviously, if such a device doesn't exist (btrfs, NFS, tmpfs) then don't.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* Re: No /dev/root with devtmpfs?
  2012-02-08 17:20           ` H. Peter Anvin
@ 2012-02-08 17:25             ` Kay Sievers
  2012-02-08 17:36               ` H. Peter Anvin
  0 siblings, 1 reply; 17+ messages in thread
From: Kay Sievers @ 2012-02-08 17:25 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Paul Parsons, Kirill Smelkov, linux-kernel

On Wed, Feb 8, 2012 at 18:20, H. Peter Anvin <hpa@zytor.com> wrote:
> On 02/08/2012 08:44 AM, Paul Parsons wrote:
>>
>> Could you simply use /etc/fstab to identify the root partition?
>>
>
> That's not a very good thing, as it is much more likely to be wrong.
>
> It would be a good thing to have the /dev/root symlink *IF* a valid root
> device exists (defined as a device node appearing which has the same
> device number as reported by stat on the root directory), if nothing
> else because we have had one available for a very long time and this is
> needless breakage.
>
> Obviously, if such a device doesn't exist (btrfs, NFS, tmpfs) then don't.

Tools should just do the equivalent of:
  $ ls -l /sys/dev/block/$(mountpoint -d /)
  /sys/dev/block/8:1 ->
../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1

and all is fine. I'm convinced, that determining the root device is a
job for *running code* not to expect a symlink to be around.

Kay

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

* Re: No /dev/root with devtmpfs?
  2012-02-08 17:25             ` Kay Sievers
@ 2012-02-08 17:36               ` H. Peter Anvin
  0 siblings, 0 replies; 17+ messages in thread
From: H. Peter Anvin @ 2012-02-08 17:36 UTC (permalink / raw)
  To: Kay Sievers; +Cc: Paul Parsons, Kirill Smelkov, linux-kernel

On 02/08/2012 09:25 AM, Kay Sievers wrote:
> On Wed, Feb 8, 2012 at 18:20, H. Peter Anvin <hpa@zytor.com> wrote:
>> On 02/08/2012 08:44 AM, Paul Parsons wrote:
>>>
>>> Could you simply use /etc/fstab to identify the root partition?
>>>
>>
>> That's not a very good thing, as it is much more likely to be wrong.
>>
>> It would be a good thing to have the /dev/root symlink *IF* a valid root
>> device exists (defined as a device node appearing which has the same
>> device number as reported by stat on the root directory), if nothing
>> else because we have had one available for a very long time and this is
>> needless breakage.
>>
>> Obviously, if such a device doesn't exist (btrfs, NFS, tmpfs) then don't.
> 
> Tools should just do the equivalent of:
>   $ ls -l /sys/dev/block/$(mountpoint -d /)
>   /sys/dev/block/8:1 ->
> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1
> 
> and all is fine. I'm convinced, that determining the root device is a
> job for *running code* not to expect a symlink to be around.
> 
> Kay

Okay, first of all, this is a service (you can think of it as such)
which has been provided for a long time.  It can be done with minimal
effort as devices appear, so you don't need to scan the /dev directory
to find the device node that corresponds to the above (as you know,
there are deliberately no device nodes in /sys, although *most* of the
time you obviously have the name right there.)

I'm not saying you're wrong, I'm saying you should consider it a
backwards compatibility solution for an interface which has been
provided for a long time already.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* Re: No /dev/root with devtmpfs?
  2012-02-08 16:44         ` Paul Parsons
  2012-02-08 17:20           ` H. Peter Anvin
@ 2012-02-10  9:04           ` Kirill Smelkov
  2012-02-10 13:10             ` Paul Parsons
  1 sibling, 1 reply; 17+ messages in thread
From: Kirill Smelkov @ 2012-02-10  9:04 UTC (permalink / raw)
  To: Paul Parsons; +Cc: H. Peter Anvin, Kay Sievers, linux-kernel

On Wed, Feb 08, 2012 at 04:44:00PM +0000, Paul Parsons wrote:
> --- On Wed, 8/2/12, Kirill Smelkov <kirr@mns.spb.ru> wrote:
> > "On what disk/partition was / mounted?" is a well-defined
> > question for
> > cases when backing store is local hdd, so there should be
> > well-defined
> > answer.
> > 
> > Previously it was /dev/root, but if /dev/root is not good
> > there should be
> > some other way for getting the answer. With ext2 I've
> > switched to
> > `mountpoint -d /` and then grepping major/minor in
> > /proc/partitions, but
> > with major=0 case I suspect this won't work.
> > 
> > 
> > My use case is to check md5 sum of mbr + bootloader area +
> > root-partition early right after the boot, to verify whether
> > software is
> > not corrupt, and for doing so it was useful to know / ->
> > root-partition
> > -> whole block device. It's not tivo, just checking for
> > medium damage. (I
> > understand this would be better done in the early bootloader
> > but that
> > part is out of my control)
> 
> Could you simply use /etc/fstab to identify the root partition?

Unfortunately no, because /etc/fstab can't know where the card will be
inserted to boot this time - i.e. either in compactflash slot on
motherboard, or through usb via cardreader. So root has to be determined
at runtime.

Personally I'm ok with no /dev/root symlink as long as there is another
way to detect root blkdev reliably. And I'm still confised what's the
rationale about why this can't be done for modern filesysems.


Thanks,
Kirill

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

* Re: No /dev/root with devtmpfs?
  2012-02-10  9:04           ` Kirill Smelkov
@ 2012-02-10 13:10             ` Paul Parsons
  2012-02-13  8:25               ` Kirill Smelkov
  0 siblings, 1 reply; 17+ messages in thread
From: Paul Parsons @ 2012-02-10 13:10 UTC (permalink / raw)
  To: Kirill Smelkov; +Cc: H. Peter Anvin, Kay Sievers, linux-kernel

--- On Fri, 10/2/12, Kirill Smelkov <kirr@mns.spb.ru> wrote:
> > Could you simply use /etc/fstab to identify the root
> partition?
> 
> Unfortunately no, because /etc/fstab can't know where the
> card will be
> inserted to boot this time - i.e. either in compactflash
> slot on
> motherboard, or through usb via cardreader. So root has to
> be determined
> at runtime.
> 
> Personally I'm ok with no /dev/root symlink as long as there
> is another
> way to detect root blkdev reliably. And I'm still confised
> what's the
> rationale about why this can't be done for modern
> filesysems.

Here's another suggestion: /proc/cmdline

The bootloader might pass the root partition to the kernel via the
"root=" kernel parameter; these can be read at /proc/cmdline.
For example, on an HP iPAQ hx4700: root=/dev/mtdblock2


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

* Re: No /dev/root with devtmpfs?
  2012-02-10 13:10             ` Paul Parsons
@ 2012-02-13  8:25               ` Kirill Smelkov
  2012-02-13 18:48                 ` H. Peter Anvin
  0 siblings, 1 reply; 17+ messages in thread
From: Kirill Smelkov @ 2012-02-13  8:25 UTC (permalink / raw)
  To: Paul Parsons; +Cc: H. Peter Anvin, Kay Sievers, linux-kernel

On Fri, Feb 10, 2012 at 01:10:37PM +0000, Paul Parsons wrote:
> --- On Fri, 10/2/12, Kirill Smelkov <kirr@mns.spb.ru> wrote:
> > > Could you simply use /etc/fstab to identify the root
> > partition?
> > 
> > Unfortunately no, because /etc/fstab can't know where the
> > card will be
> > inserted to boot this time - i.e. either in compactflash
> > slot on
> > motherboard, or through usb via cardreader. So root has to
> > be determined
> > at runtime.
> > 
> > Personally I'm ok with no /dev/root symlink as long as there
> > is another
> > way to detect root blkdev reliably. And I'm still confised
> > what's the
> > rationale about why this can't be done for modern
> > filesysems.
> 
> Here's another suggestion: /proc/cmdline
> 
> The bootloader might pass the root partition to the kernel via the
> "root=" kernel parameter; these can be read at /proc/cmdline.
> For example, on an HP iPAQ hx4700: root=/dev/mtdblock2

This does not work universally either, for example for

    root=PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF


the kernel scans partitions and finds one for root by partition uuid
(see name_to_dev_t() in init/do_mounts.c).

That's exactly my situation - I have universal flash image which can
bee booted via CF slot (on several boards, thus will have different
/dev/hd? or /dev/sd?) and via usb/cardreader (again different /dev/
entry), and root is mounted by partition id.

The kernel has no problem finding root partition and mounting it. I just
needed a sane and robust way to know its choice.


Thanks,
Kirill

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

* Re: No /dev/root with devtmpfs?
  2012-02-13  8:25               ` Kirill Smelkov
@ 2012-02-13 18:48                 ` H. Peter Anvin
  2012-02-13 19:30                   ` Kay Sievers
  0 siblings, 1 reply; 17+ messages in thread
From: H. Peter Anvin @ 2012-02-13 18:48 UTC (permalink / raw)
  To: Kirill Smelkov; +Cc: Paul Parsons, Kay Sievers, linux-kernel

On 02/13/2012 12:25 AM, Kirill Smelkov wrote:
>>
>> The bootloader might pass the root partition to the kernel via the
>> "root=" kernel parameter; these can be read at /proc/cmdline.
>> For example, on an HP iPAQ hx4700: root=/dev/mtdblock2
> 
> This does not work universally either, for example for
> 
>     root=PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF
> 
> 
> the kernel scans partitions and finds one for root by partition uuid
> (see name_to_dev_t() in init/do_mounts.c).
> 
> That's exactly my situation - I have universal flash image which can
> bee booted via CF slot (on several boards, thus will have different
> /dev/hd? or /dev/sd?) and via usb/cardreader (again different /dev/
> entry), and root is mounted by partition id.
> 
> The kernel has no problem finding root partition and mounting it. I just
> needed a sane and robust way to know its choice.
> 

In this case it's not the kernel, but the initramfs which does this
lookup.  In that case the initramfs could/should create /dev/root.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* Re: No /dev/root with devtmpfs?
  2012-02-13 18:48                 ` H. Peter Anvin
@ 2012-02-13 19:30                   ` Kay Sievers
  2012-02-13 19:32                     ` H. Peter Anvin
  0 siblings, 1 reply; 17+ messages in thread
From: Kay Sievers @ 2012-02-13 19:30 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Kirill Smelkov, Paul Parsons, linux-kernel

On Mon, Feb 13, 2012 at 19:48, H. Peter Anvin <hpa@zytor.com> wrote:
> On 02/13/2012 12:25 AM, Kirill Smelkov wrote:
>>>
>>> The bootloader might pass the root partition to the kernel via the
>>> "root=" kernel parameter; these can be read at /proc/cmdline.
>>> For example, on an HP iPAQ hx4700: root=/dev/mtdblock2
>>
>> This does not work universally either, for example for
>>
>>     root=PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF
>>
>>
>> the kernel scans partitions and finds one for root by partition uuid
>> (see name_to_dev_t() in init/do_mounts.c).
>>
>> That's exactly my situation - I have universal flash image which can
>> bee booted via CF slot (on several boards, thus will have different
>> /dev/hd? or /dev/sd?) and via usb/cardreader (again different /dev/
>> entry), and root is mounted by partition id.
>>
>> The kernel has no problem finding root partition and mounting it. I just
>> needed a sane and robust way to know its choice.
>
> In this case it's not the kernel, but the initramfs which does this
> lookup.

root=PARTUUID= is in-kernel mount GTP support, which works without an initramfs.

> In that case the initramfs could/should create /dev/root.

We dropped all that in initramfs for the earlier in this thread
mentioned reasons.

/dev/root is not what we want, or what tools should expect to be there
today; it will not work with modern filesystems, which have no
single-device relationship.

Kay

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

* Re: No /dev/root with devtmpfs?
  2012-02-13 19:30                   ` Kay Sievers
@ 2012-02-13 19:32                     ` H. Peter Anvin
  0 siblings, 0 replies; 17+ messages in thread
From: H. Peter Anvin @ 2012-02-13 19:32 UTC (permalink / raw)
  To: Kay Sievers; +Cc: Kirill Smelkov, Paul Parsons, linux-kernel

On 02/13/2012 11:30 AM, Kay Sievers wrote:
>
> root=PARTUUID= is in-kernel mount GTP support, which works without an initramfs.
>

Oh joy, let's grow more stuff into the kernel...

	-hpa


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

end of thread, other threads:[~2012-02-13 19:32 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-06 11:18 No /dev/root with devtmpfs? Kirill Smelkov
2012-02-06 12:10 ` Paul Parsons
2012-02-06 12:52   ` Kirill Smelkov
2012-02-06 19:45 ` Kay Sievers
2012-02-07  7:55   ` Kirill Smelkov
2012-02-07 10:05     ` Kay Sievers
2012-02-08  7:35       ` Kirill Smelkov
2012-02-08 16:44         ` Paul Parsons
2012-02-08 17:20           ` H. Peter Anvin
2012-02-08 17:25             ` Kay Sievers
2012-02-08 17:36               ` H. Peter Anvin
2012-02-10  9:04           ` Kirill Smelkov
2012-02-10 13:10             ` Paul Parsons
2012-02-13  8:25               ` Kirill Smelkov
2012-02-13 18:48                 ` H. Peter Anvin
2012-02-13 19:30                   ` Kay Sievers
2012-02-13 19:32                     ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).