Hi,
Along with an earlier submitted patch to include the mtd and jffs modules
in the initrd image, the attached patch is needed for booting with root=mtd0.
Basically, the init scripts assume the root device should have a special
device file somewhere, and if not will wait for it to appear. This patch
changes it so that it only waits for a device file to appear if $ROOT starts
with "/dev". In the case of things like ROOT=LABEL=foo, the init scripts
will translate that to a device. With ROOT=mtd0, the init scripts will not
check for a device, and will successfully mount the root filesystem.
>From 586f67264971f0b8432aa99c13c9e16f009a729f Mon Sep 17 00:00:00 2001
From: Andres Salomon <[EMAIL PROTECTED]>
Date: Tue, 14 Oct 2008 18:04:09 -0400
Subject: [PATCH] allow root=mtd0 to be used
skip root checks if ROOT doesn't start with /dev.
Signed-off-by: Andres Salomon <[EMAIL PROTECTED]>
---
debian/changelog | 2 ++
scripts/local | 14 ++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 833dcfa..4fdf762 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ initramfs-tools (0.92l.1) unstable; urgency=high
* include mtd/jffs2/ubifs modules when 'most' is selected.
* add support for linux-2.6's deb-pkg (via /etc/kernel).
* include video (framebuffer, fbcon) modules when 'most' is selected.
+ * allow root=mtd0 to be used; skip root checks if ROOT doesn't start
+ with /dev.
-- Andres Salomon <[EMAIL PROTECTED]> Tue, 14 Oct 2008 14:16:50 -0400
diff --git a/scripts/local b/scripts/local
index 85d62af..b6bd192 100644
--- a/scripts/local
+++ b/scripts/local
@@ -24,8 +24,7 @@ get_fstype ()
return ${RET}
}
-# Parameter: Where to mount the filesystem
-mountroot ()
+pre_mountroot()
{
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top"
run_scripts /scripts/local-top
@@ -33,6 +32,12 @@ mountroot ()
wait_for_udev 10
+ # Don't wait for a root device that doesn't have a corresponding
+ # device in /dev (ie, mtd0)
+ if [ "${ROOT#/dev}" = "${ROOT}" ]; then
+ return
+ fi
+
# If the root device hasn't shown up yet, give it a little while
# to deal with removable devices
if [ ! -e "${ROOT}" ] || ! $(get_fstype "${ROOT}" >/dev/null); then
@@ -94,6 +99,11 @@ mountroot ()
echo " - Missing modules (cat /proc/modules; ls /dev)"
panic "ALERT! ${ROOT} does not exist. Dropping to a shell!"
done
+}
+
+mountroot()
+{
+ pre_mountroot
# Get the root filesystem type if not set
if [ -z "${ROOTFSTYPE}" ]; then
--
1.5.6.5