I believe U-Boot statically assigns IDs to specific host controllers; on
Seaboard, ID 0 is internal MMC, and ID 1 is SD slot.
The kernel dynamically assigns mmcblk device IDs to whichever device is
identified first.
In practice, at least on Seaboard, I believe through some timing fluke,
kernel chromeos-2.6.37 usually identifies the devices in the same order
as U-Boot's ID assignments, and hence ends up with the same numbering as
U-Boot. However, this isn't always true; occasionally this kernel will
identify things "backwards".
In practice, at least with my Seaboard clamshell, kernel chromeos-2.6.38
usually identifies the devices in the reverse order to U-Boot.
When U-Boot and kernel order happen to match, everything just works.
When U-Boot and kernel order mismatch, two things can happen: (a) the
kernel mounts the root fs from a device other than expected, but the
system then probably boots OK, or (b) the other device has no filesystem
on it, and the kernel panics when it attempts to mount the root filesystem
from there, and can never boot.
I started a discussion on the linux-mmc mailing list re: whether the
mmcblk device IDs could be assigned statically; see
http://comments.gmane.org/gmane.linux.kernel.mmc/7140. In that thread,
Chris Ball (MMC maintainer) indicated that this is typically solved by
an initrd rather than the kernel.
So, should ChromeOS start to use an initrd to solve this? Or, should
ChromeOS carry something like that patch I mentioned, which causes the
kernel to assign mmcblk device IDs statically based on the host controller
that contains the block device? Note that with that patch, for Seaboard,
the mapping from U-Boot to kernel device IDs isn't exactly 1:1, even though
it is static:
U-Boot ID Kernel ID
0 2
1 1
(perhaps a more complex patch could be both static and fix the mapping
table to be 1:1)
I'd be pleased to hear anyone's thoughts on this.
Note: I've observed similar issues on our Ventana boards when using
mainline kernels there too.
--
nvpublic
On Mon, Apr 4, 2011 at 2:25 PM, Stephen Warren <swa...@nvidia.com> wrote:
[description of how having dynamic block device numbers makes life complicated]
> I started a discussion on the linux-mmc mailing list re: whether the
> mmcblk device IDs could be assigned statically; see
> http://comments.gmane.org/gmane.linux.kernel.mmc/7140. In that thread,
> Chris Ball (MMC maintainer) indicated that this is typically solved by
> an initrd rather than the kernel.
>
> So, should ChromeOS start to use an initrd to solve this? Or, should
> ChromeOS carry something like that patch I mentioned, which causes the
> kernel to assign mmcblk device IDs statically based on the host controller
> that contains the block device? Note that with that patch, for Seaboard,
> the mapping from U-Boot to kernel device IDs isn't exactly 1:1, even though
> it is static:
[...]
> I'd be pleased to hear anyone's thoughts on this.
Yeah, this is a generic issue with anyone trying to assume which
device will probe first on the kernel. For SATA and USB, there's
similar issues (but there might be less runtime variation there).
We had some long discussions over this on x86 back when we first
started looking at recovery mode booting, etc.
On a chromeos build, we have a uuid specifier for the filesystem to
use, so there are no references to actual device names. This is
similar to how ramdisks handle it, but it's done in-kernel.
We don't want a ramdisk for boottime performance reasons (and for the
hassle of having one).
The problem still exists for developer builds where you build your
image with --noenable_rootfs_verification. We have not yet worried
about solving this, but I guess there's some need to do so now.. :)
-Olof
Hi,
On Mon, Apr 4, 2011 at 2:25 PM, Stephen Warren <swa...@nvidia.com> wrote:
[description of how having dynamic block device numbers makes life complicated]
> I started a discussion on the linux-mmc mailing list re: whether the
> mmcblk device IDs could be assigned statically; see
> http://comments.gmane.org/gmane.linux.kernel.mmc/7140. In that thread,
> Chris Ball (MMC maintainer) indicated that this is typically solved by
> an initrd rather than the kernel.
>
> So, should ChromeOS start to use an initrd to solve this? Or, should
> ChromeOS carry something like that patch I mentioned, which causes the
> kernel to assign mmcblk device IDs statically based on the host controller
> that contains the block device? Note that with that patch, for Seaboard,
> the mapping from U-Boot to kernel device IDs isn't exactly 1:1, even though
> it is static:
[...]
> I'd be pleased to hear anyone's thoughts on this.
On Tegra, U-Boot assumes that its SD/MMC device numbering exactly matches
kernel mmcblk device numbering. This assumption is encoded into the kernel
command-line root= options that U-Boot (and the ChromeOS U-Boot scripts on
disk) generate. In practice, this is not always true.
See comment about ramdisk -- the UUID to block device translation has
traditionally been done from userspace on a ramdisk. And we don't want
one.
There's been recent work to do it in-kernel though. Not sure if it's
all in place though, I haven't keep track of it.
-Olof
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en
Note that this all works using the UUID from the GPT itself, not from any filesystem-specific UUIDs. As long as the UUIDs are really unique, there should only be one matching partition on the system, which will be correctly identified by both the bootloader and the kernel.
Yeah - I haven't tried to push up a root=PARTUUID=%U+n yet, but
support for PARTUUID=%U is upstream. The code in the kernel is
implemented in two parts:
1. the root= parser
2. partition scanner.
When the partitions are scanned, we add extra metadata about the
partition UUID if supplied. I only landed support for EFI upstream
but the mechanism is generic. Then during root=[device] resolution,
the [device] scan is forked based on whether it looks like a UUID and
punts it over to the uuid parser then walks all registered block
devices looking for a matching partition uuid. First-come-first serve
since they're unique... right :)
that's kinda where it's at :/
will
Thanks! Jens cleaned up some messed up attributes I had in that
patch, but on the whole that is it. It's a pretty easy hack to add +n
to the change. Just change the length check for PARTUUID to < 36
(instead of !=) then add a parser to the split for the offset (+/-%u)
like we did in dm-verity.
cheers!
will
Thanks! Jens cleaned up some messed up attributes I had in thatpatch, but on the whole that is it. It's a pretty easy hack to add +n
to the change. Just change the length check for PARTUUID to < 36
(instead of !=) then add a parser to the split for the offset (+/-%u)
like we did in dm-verity.