I've just updated my trunk tree to the latest and I'm looking at the patches that I'm carrying in my tree wondering what's still relevant and what's not. One of the bigger ones is a patch to mount a USB device on / in mount_root.
Is this still needed or has some official support for this functionality
been merged in recently.
My current patch for this functionality is:
Index: package/base-files/files/sbin/mount_root
===================================================================
--- package/base-files/files/sbin/mount_root (revision 14139)
+++ package/base-files/files/sbin/mount_root (working copy)
@@ -2,6 +2,62 @@
# Copyright (C) 2006 OpenWrt.org
. /etc/functions.sh
+### Try to mount some drive. ####################
+mount_drive () {
+ local rootdev="$1"
+
+ for m in jbd ext3; do
+ insmod "$m"
+ done
+
+ # this may need to be higher if your disk is slow to initialize
+ n=10
+ basesysdev=${rootdev%[0-9]}
+ sysdev=/sys/block/${basesysdev##/dev/}
+ while [ $n -gt 0 -a ! -e "$sysdev/dev" ]; do
+ echo "waiting for root device to be available...$n" >&2
+ let n=n-1
+ sleep 1
+ done
+
+ # loop either timed out, or found the device
+ if [ -e "$sysdev/dev" ]; then
+ # if it found the device, create the nodes for it
+ find $sysdev/ -name dev | while read file; do
+ dev=${file%/dev}
+ dev=${dev##*/}
+ # but only if it doesn't exist already
+ if [ ! -b /dev/$dev ]; then
+ echo "creating device node /dev/$dev" >&2
+ IFS=: read major minor < $file
+ mknod /dev/$dev b $major $minor
+ fi
+ done
+
+ mount "$rootdev" /mnt && [ -x /mnt/sbin/init ] && {
+ mkdir /mnt/oldroot
+ pivot /mnt /oldroot
+ exit
+ }
+ fi
+}
+
+mount_ide () {
+ for m in ide-core aec62xx ide-generic ide-disk; do
+ insmod "$m"
+ done
+ mount_drive "/dev/hde1"
+ return 0
+}
+
+mount_usb () {
+ for m in usbcore ohci-hcd ehci-hcd scsi_mod sd_mod usb-storage; do
+ insmod "$m"
+ done
+ mount_drive "/dev/sda1"
+ return 0
+}
+
jffs2_ready () {
mtdpart="$(find_mtd_part rootfs_data)"
magic=$(hexdump $mtdpart -n 4 -e '4/1 "%02x"')
@@ -15,9 +71,21 @@
echo "switching to jffs2"
mount "$(find_mtd_part rootfs_data)" /jffs -t jffs2 && \
fopivot /jffs /rom
+ if [ "$1" != "nousb" -a "$2" != "nousb" ]; then
+ mount_usb
+ fi
+ if [ "$1" != "noide" -a "$2" != "noide" ]; then
+ mount_ide
+ fi
} || {
echo "jffs2 not ready yet; using ramdisk"
ramoverlay
+ if [ "$1" != "nousb" -a "$2" != "nousb" ]; then
+ mount_usb
+ fi
+ if [ "$1" != "noide" -a "$2" != "noide" ]; then
+ mount_ide
+ fi
}
} || {
mtd unlock rootfs
b.
signature.asc
Description: This is a digitally signed message part
_______________________________________________ openwrt-devel mailing list [email protected] http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
