I've seen a few posts about how to boot from the WL-700gE's IDE drive or
from a USB drive, but when I tried it on my WL-700gE it failed for the
simple reason that the firmware I built (using the 2.6 kernel) was too
large, so the 128kB left for the jffs2 were insufficient to make
a jffs2 filesystem: OpenWRT gracefully fell back on a ramdisk overlay,
so I could create my disk's partiion, mount it and all, but at the next
reboot, I always cambe back to the default config since nothing had been
saved on flash.

I first tried to squeeze out "unimportant" things in the hope to get
my firmware small enough to get jffs2 up, but in the end I figured:
why bother.  So I just directly tweaked the /sbin/mount_root script
(took me a while to figure out that it was the place I wanted to
change) by adding the few lines appended below.  This also lets me use
slightly larger firmwares since I don't need any jffs2 at all.

These lines may not be a good default (they'd add about 10s to every
non-USB boot), but maybe we should offer this kind of functionality as
configuration option.  WDYT?
On a related note, such firmwares would be better off without any jffs2
compiled into the kernel.


        Stefan


Index: mount_root
===================================================================
--- mount_root  (révision 11579)
+++ mount_root  (copie de travail)
@@ -8,9 +10,56 @@
        [ "$magic" != "deadc0de" ]
 }
 
+###  Try to mount some drive.  ####################
+mount_drive () {
+    for m in jbd ext3; do
+        echo "mount_drive $m" >>/tmp/stef
+        insmod "$m" >>/tmp/stef 2>&1
+    done
+
+    rootdev="$1"
+
+    COUNTER=0
+    while [ ! -b "$rootdev" ] && [ $COUNTER -lt 10 ]; do
+        echo "mount sleep for $rootdev" >>/tmp/stef
+        sleep 1
+        let COUNTER=COUNTER+1
+    done
+
+    mount "$rootdev" /mnt && [ -x /mnt/sbin/init ] && {
+        echo "mounted $rootdev" >>/tmp/stef
+        . /bin/firstboot
+        pivot /mnt /rom
+        exit
+    }
+}
+
+mount_ide () {
+    echo mount_ide >>/tmp/stef
+    for m in ide-core aec62xx ide-generic ide-disk; do
+        insmod "$m" >>/tmp/stef 2>&1
+    done
+    mount_drive "/dev/hde1"
+}
+
+mount_usb () {
+    echo mount_usb >>/tmp/stef
+    for m in usbcore ohci-hcd ehci-hcd scsi_mod sd_mod usb-storage; do
+        echo "mount_usb $m" >>/tmp/stef
+        insmod "$m" >>/tmp/stef 2>&1
+    done
+    mount_drive "/dev/sda1"
+}
+
+mount_usb
+mount_ide
+
+###  If no drve, mount the JFFS2 partition or a ramdisk.  ####################
 grep rootfs_data /proc/mtd >/dev/null 2>/dev/null && {
+        echo mount_root-11 >>/tmp/stef
        . /bin/firstboot
        mtd unlock rootfs_data
+        echo mount_root-12 >>/tmp/stef
        jffs2_ready && {
                echo "switching to jffs2"
                mount "$(find_mtd_part rootfs_data)" /jffs -t jffs2 && \

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to