diff options
author | Martin Michlmayr <tbm@cyrius.com> | 2010-06-13 17:23:14 +0100 |
---|---|---|
committer | Michael Prokop <mika@debian.org> | 2010-06-16 16:48:06 +0200 |
commit | bb66fc2a8b40d6c8ecd093cf1b358d4476ab1e1c (patch) | |
tree | adb3f1eba8cec96f11666e6e25145909a87be388 | |
parent | 3054e3ed58dee5a70bcd462c71573d380f03bd7a (diff) | |
download | initramfs-tools-bb66fc2a8b40d6c8ecd093cf1b358d4476ab1e1c.tar.gz initramfs-tools-bb66fc2a8b40d6c8ecd093cf1b358d4476ab1e1c.zip |
hook-functions/init/scripts/local: add support for ubifs.
MODULES=dep fails when / is ubifs. This patch adds support for
something like root=ubi0:rootfs when ubi is modular.
Quoting Martin:
It essentially does three things:
- adds the correct modules to the ramdisk (for MODULES=dep and MODULES=most)
- reads ubi.mtd= from the command line
- loads ubi with the ubi.mtd info and ignores the "Waiting for root" check
I've successfully tested this with a kernel with modular ubi and with
the following boot variants:
console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs
console=ttyS0,115200 ubi.mtd=2 root=ubi0_0 rootfstype=ubifs
With
console=ttyS0,115200 ubi.mtd=2 root=/dev/ubi0_0 rootfstype=ubifs
I get an error that it cannot mount root but I suspect this is an
ubifs error and has nothing to do with i-t (since at this point I can
manually mount it with -t ubifs ubi0_0 whereas the /dev/ variant
doesn't work).
Tested with MODULES=dep and MODULES=most as well as with a kernel that
has ubifs built in.
Closes: #582858
Thanks: Martin Michlmayr <tbm@cyrius.com>
Signed-off-by: Martin Michlmayr <tbm@cyrius.com>
Reviewed-by: Michael Prokop <mika@debian.org>
-rw-r--r-- | hook-functions | 10 | ||||
-rwxr-xr-x | init | 5 | ||||
-rw-r--r-- | scripts/local | 7 |
3 files changed, 22 insertions, 0 deletions
diff --git a/hook-functions b/hook-functions index 1a0e097..3ce081d 100644 --- a/hook-functions +++ b/hook-functions @@ -237,6 +237,10 @@ dep_add_modules() # most of the commands below only work with block devices. if [ "${FSTYPE}" = "ubifs" ]; then manual_add_modules "${FSTYPE}" + # add some modules required by ubifs on which it doesn's depend + manual_add_modules deflate + manual_add_modules zlib + manual_add_modules lzo return fi @@ -415,6 +419,11 @@ auto_add_modules() block) copy_modules_dir kernel/drivers/block ;; + ubi) + for x in deflate zlib lzo ubi ubifs; do + manual_add_modules "${x}" + done + ;; ieee1394) for x in ohci1394 sbp2; do manual_add_modules "${x}" @@ -447,6 +456,7 @@ auto_add_modules() auto_add_modules ata auto_add_modules i2o auto_add_modules dasd + auto_add_modules ubi auto_add_modules ieee1394 auto_add_modules firewire auto_add_modules mmc @@ -43,6 +43,7 @@ export ROOTFSTYPE= export IP= export BOOT= export BOOTIF= +export UBIMTD= export break= export init=/sbin/init export quiet=n @@ -127,6 +128,9 @@ for x in $(cat /proc/cmdline); do boot=*) BOOT=${x#boot=} ;; + ubi.mtd=*) + UBIMTD=${x#ubi.mtd=} + ;; resume=*) RESUME="${x#resume=}" ;; @@ -258,6 +262,7 @@ unset ROOT unset IP unset BOOT unset BOOTIF +unset UBIMTD unset blacklist unset break unset noresume diff --git a/scripts/local b/scripts/local index 98464f9..9b51174 100644 --- a/scripts/local +++ b/scripts/local @@ -8,6 +8,13 @@ pre_mountroot() wait_for_udev 10 + # Load ubi with the correct MTD partition and return since fstype + # doesn't work with a char device like ubi. + if [ -n "$UBIMTD" ]; then + modprobe ubi mtd=$UBIMTD + return + fi + # Don't wait for a root device that doesn't have a corresponding # device in /dev (ie, mtd0) if [ "${ROOT#/dev}" = "${ROOT}" ]; then |