* Martin Michlmayr <t...@cyrius.com> [2010-06-07 18:10]:
> I'm not claiming that you'll actually be able to boot from ubifs with
> that ramdisk though.  For that, i-t needs to be taught to know what to
> do about something like root=ubi0:rootfs.

Ok, here's a patch with which you can boot from ubi with i-t when ubi is
modular.

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.

Signed-off-by: Martin Michlmayr <t...@cyrius.com>

diff --git a/hook-functions b/hook-functions
index 6a6e233..895eca0 100644
--- a/hook-functions
+++ b/hook-functions
@@ -231,6 +231,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
 
@@ -424,6 +428,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}"
@@ -456,6 +465,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
diff --git a/init b/init
index 142eb14..798717c 100755
--- a/init
+++ b/init
@@ -42,6 +42,7 @@ export ROOTFSTYPE=
 export IP=
 export BOOT=
 export BOOTIF=
+export UBIMTD=
 export break=
 export init=/sbin/init
 export quiet=n
@@ -126,6 +127,9 @@ for x in $(cat /proc/cmdline); do
        boot=*)
                BOOT=${x#boot=}
                ;;
+       ubi.mtd=*)
+               UBIMTD=${x#ubi.mtd=}
+               ;;
        resume=*)
                RESUME="${x#resume=}"
                ;;
@@ -257,6 +261,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 cca5e8d..46ab0f3 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

-- 
Martin Michlmayr
http://www.cyrius.com/



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to