OpenWrt Forum Archive

Topic: Help with 7.09 & USB Boot on Wl 500Gp

The content of this topic has been archived on 20 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi

I have run into a few problems with building 7.09.  Thought I would summarize them here.

I am building for a WL500Gp with Atheros minipci card.

I have

* svn co https://svn.openwrt.org/openwrt/tags/kamikaze_7.09 7.09
* applied by boot usb patch (see below)
* make package/symlinks
* make menuconfig
** changed the static ip information
** built into the image these modules
*** kmod-fs-ext2
*** kmod-fs-ext3
*** fdisk
*** e2fsprogs
*** libuuid
*** kmod-usb2
*** kmod-usb-core
*** kmod-usb-storage
*** kmod-scsi-core
* make
* run mtd -e linux write openwrt-brcm47xx-2.6-squashfs.trx linux on the router
* waited for the system to settle (firstboot)
* reboot
* fdisk /dev/sda - create 1 Big partition - ext2
* mount /dev/sda1 /mnt
* mount -o bind / /tmp/root
* cp /tmp/root/* /mnt -a
* umount /mnt
* reboot

This failed. On my working image (7.07) where I can boot from usb stick, I did not include the extra modules in the image, but ipkg installed them on the first reboot.

Attempting to debug this (7.09) I replaced perinit back to original and updated /sbin/init (see below), to try and capture some output and error messages

whilst doing this I became aware of a lot of segfaults that I was getting, at random times, different applications would fail. trying ps would fail, but if I trued /bin/ps it would work. saying that if I tried /bin/busybox ps it would fail.  But no constantly

also noticed that my root partition was actually a jffs not squish - i think this is just me not understanding the fs status right now

I can see that all the modules are loaded, hotplug2 is loaded and running and prepped for usb, i can see the device I can run mount, but for some reason I can run mount /dev/sda1 /mnt. I have ext2 and ext3 loaded. I have attached my last init.text as the bottom

can find any pointers on where to go from here.

There has been some suggestions to go back to 2.4, but I want the 2.6 kernel for some of the iptables & ipv6 stuff.

I will try now going back to my 7.07 build, with out the extra packages, just to prove to my self that it is possible and then work forward from there!






Boot USB patch - worked out form other post

Index: package/base-files/files/etc/preinit
===================================================================
--- package/base-files/files/etc/preinit        (revision 8766)
+++ package/base-files/files/etc/preinit        (working copy)
@@ -64,4 +64,40 @@
 echo "- init -"
        
 killall hotplug2
+
+# Boot usb stick
+exec > /etc/preinit.text 2>&1
+set -x
+
+/sbin/hotplug2 --persistent &
+
+echo /sbin/hotplug-call > /proc/sys/kernel/hotplug
+
+for module in usbcore usb-ohci ehci-hcd uhci-hcd scsi_mod sd_mod usb-storage jbd ext3 ; do {
+        insmod $module
+}; done
+
+sleep 30s
+boot_dev="/dev/sda1"
+mount -o rw,noatime $boot_dev /mnt 
+
+# if everything looks ok, do the pivot root
+killall hotplug2
+
+[ -x /mnt/sbin/init ] && {
+        mount -o move /proc /mnt/proc && \
+        pivot_root /mnt /mnt/rom && {
+                mount -o move /rom/dev /dev
+                mount -o move /rom/rom/sys /sys
+                mount -o move /rom/tmp /tmp
+                # umount /rom/tmp
+                               set +x
+                               exec <$M0 >$M1 2>&0
+               exec /sbin/init
+        }
+        # umount $boot_dev
+}
+
+set +x
+exec <$M0 >$M1 2>&0
 exec /sbin/init

/sbin/init

# Boot usb stick
exec >> /etc/init.text 2>&1
set -x

echo ======
date
echo ======

# start hotplug
# Same as in preinit
/sbin/hotplug2 --persistent &

# force hotplug-call
echo "/sbin/hotplug-call" > /proc/sys/kernel/hotplug

/bin/ls -l /
/bin/ls -l /var
/bin/ls -l /mnt


echo ======
/bin/mount -t usbfs none /proc/bus/usb
echo ======

# Load Modules
echo "Load Modules"
for module in usbcore ehci-hcd scsi_mod sd_mod usb-storage jbd ext3
do
   {
       /sbin/insmod $module
   }
done

sleep 30s

usb=0

echo ======
cat /proc/partitions
echo ======
cat /proc/modules
echo ======
/bin/mount
echo ======
/bin/ps 
echo ======


# Mount boot_dev
if /bin/mount /dev/sda1 /mnt || /bin/mount -t ext2 -o rw,noatime /dev/sda1 /mnt || /bin/mount 
-t ext3 -o rw,noatime /dev/sda1 /mnt
then 
      # Check filesystem
      if [ -e /mnt/usb.boot ] && [ -x /mnt/sbin/init ]
      then
              echo "Loading USB Storage as root"
              
              echo ======
              cat /proc/partitions
              echo ======
              cat /proc/modules
              echo ======

      fi
      
      #[ $usb -eq 0 ] && {
      #   umount /mnt                                                              
      #}                                                                           

fi

# Kill hotplug
killall hotplug2

exec
exec /bin/busybox init $@

init.text output

+ echo ======
======
+ date
Sat Jan  1 00:00:05 UTC 2000
+ echo ======
======
+ /sbin/hotplug2 --persistent
+ echo /sbin/hotplug-call
+ /bin/ls -l /
drwxr-xr-x    2 root     root          486 Sep 13  2007 bin
drwxrwxrwt    4 root     root          660 Jan  1 00:00 dev
drwxr-xr-x    6 root     root            0 Jan  1 00:10 etc
drwxr-xr-x    6 root     root            0 Jan  1  1970 jffs
drwxr-xr-x    7 root     root          431 Sep 13  2007 lib
drwxr-xr-x    3 root     root            0 Jan  1 00:00 mnt
dr-xr-xr-x   28 root     root            0 Jan  1 00:00 proc
drwxr-xr-x   15 root     root          136 Sep 13  2007 rom
drwxr-xr-x    2 root     root            0 Jan  1 00:02 sbin
drwxr-xr-x   10 root     root            0 Jan  1 00:00 sys
drwxrwxrwt    2 root     root           60 Jan  1 00:00 tmp
drwxr-xr-x    6 root     root           47 Sep 13  2007 usr
lrwxrwxrwx    1 root     root            4 Sep 13  2007 var -> /tmp
drwxr-xr-x    2 root     root            3 Sep 13  2007 www
+ /bin/ls -l /var
lrwxrwxrwx    1 root     root            4 Sep 13  2007 /var -> /tmp
+ /bin/ls -l /mnt
drwxr-xr-x    2 root     root            0 Jan  1 00:00 t
+ echo ======
======
+ /bin/mount -t usbfs none /proc/bus/usb
mount: mounting none on /proc/bus/usb failed
+ echo ======
======
+ echo Load Modules
Load Modules
+ /sbin/insmod usbcore
+ /sbin/insmod ehci-hcd
+ /sbin/insmod scsi_mod
+ /sbin/insmod sd_mod
+ /sbin/insmod usb-storage
+ /sbin/insmod jbd
+ /sbin/insmod ext3
+ sleep 30s
Segmentation fault
vconfig: ioctl error for add: Invalid argument
/sbin/hotplug-call: /etc/hotplug.d/usb/10-usb-storage: 12: /sbin/usb-storage: Permission denie
d
/bin/uci: /bin/uci: 189: cannot create /var/state/network: Directory nonexistent
device eth0.0 is already a member of a bridge; can't enslave it to bridge br-lan.
device br-lan already exists; can't create bridge with the same name
device eth0.0 is already a member of a bridge; can't enslave it to bridge br-lan.
/bin/uci: /bin/uci: 189: cannot create /var/state/network: Directory nonexistent
/sbin/hotplug-call: .: 1: Can't open /var/state/network
/bin/uci: /bin/uci: 189: cannot create /var/state/network: Directory nonexistent
Can't open /var/lock/dhcp-eth0.1
udhcpc: cannot open pidfile /var/run/eth0.1.pid: No such file or directory
udhcpc (v1.4.2) started
/bin/uci: /bin/uci: 189: cannot create /var/state/network: Directory nonexistent
Sending discover...
/bin/uci: /bin/uci: 189: cannot create /var/state/network: Directory nonexistent
/sbin/hotplug-call: .: 1: Can't open /var/state/network
Sending discover...
Sending discover...
+ usb=0
+ echo ======
======
+ cat /proc/partitions
major minor  #blocks  name

  31     0        256 mtdblock0
  31     1       7872 mtdblock1
  31     2       7136 mtdblock2
  31     3       5760 mtdblock3
  31     4         64 mtdblock4
   8     0    1000944 sda
   8     1    1000897 sda1
+ echo ======
======
+ cat /proc/modules
ext3 97040 0 - Live 0xc00f9000
jbd 54672 1 ext3, Live 0xc00c3000
usb_storage 27664 0 - Live 0xc0060000
sd_mod 18416 0 - Live 0xc00a5000
scsi_mod 71968 2 usb_storage,sd_mod, Live 0xc0074000
ehci_hcd 28016 0 - Live 0xc006c000
usbcore 102032 3 usb_storage,ehci_hcd, Live 0xc008b000
switch_robo 4048 0 - Live 0xc0058000
switch_core 5056 1 switch_robo, Live 0xc0055000
diag 8272 0 - Live 0xc005c000
+ echo ======
======
+ /bin/mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /tmp type tmpfs (rw,nosuid,nodev)
tmpfs on /dev type tmpfs (rw)
none on /dev/pts type devpts (rw)
/dev/mtdblock3 on /jffs type jffs2 (rw)
mini_fo:/jffs on / type mini_fo (rw)
+ echo ======
======
+ /bin/ps
  PID  Uid     VmSize Stat Command
    1 root        440 R   /bin/sh /sbin/init 
    2 root            SW< [kthreadd]
    3 root            SWN [ksoftirqd/0]
    4 root            SW< [events/0]
    5 root            SW< [khelper]
   14 root            SW< [kblockd/0]
   38 root            SW  [pdflush]
   39 root            SW  [pdflush]
   40 root            SW< [kswapd0]
   41 root            SW< [aio/0]
   52 root            SW< [mtdblockd]
  210 root            SWN [jffs2_gcd_mtd3]
  220 root        236 S   /sbin/hotplug2 --persistent 
  353 root            SW< [khubd]
  404 root            SW< [scsi_eh_0]
  405 root            SW< [usb-storage]
  623 root        432 S   udhcpc -t 0 -i eth0.1 -b -p /var/run/eth0.1.pid -R 
  630 root        432 S   udhcpc -t 0 -i eth0.1 -b -p /var/run/eth0.1.pid -R 
  696 root        380 R   /bin/ps 
+ echo ======
======
+ /bin/mount /dev/sda1 /mnt
mount: mounting /dev/sda1 on /mnt failed
+ /bin/mount -t ext2 -o rw,noatime /dev/sda1 /mnt
mount: mounting /dev/sda1 on /mnt failed
+ /bin/mount -t ext3 -o rw,noatime /dev/sda1 /mnt
mount: mounting /dev/sda1 on /mnt failed
+ killall hotplug2
+ exec
+ exec /bin/busybox init

Well I have done some more testing, going back to what was working and then working forward.

I have a working 7.09, boot from usb stick, the trick I found was to not compile in the extra modules - I am not sure why this would cause a problem but, I don't really have the tool to debug it!

I am still see the odd occasional segfault both in 7.07 & 7.09

this is the patch I am using

Index: package/base-files/files/etc/preinit
===================================================================
--- package/base-files/files/etc/preinit        (revision 8766)
+++ package/base-files/files/etc/preinit        (working copy)
@@ -64,4 +64,40 @@
 echo "- init -"
        
 killall hotplug2
+
+# Boot usb stick
+exec > /etc/preinit.text 2>&1
+set -x
+
+/sbin/hotplug2 --persistent &
+
+echo /sbin/hotplug-call > /proc/sys/kernel/hotplug
+
+for module in usbcore usb-ohci ehci-hcd uhci-hcd scsi_mod sd_mod usb-storage jbd ext3 ; do {
+        insmod $module
+}; done
+
+sleep 30s
+boot_dev="/dev/sda1"
+mount -o rw,noatime $boot_dev /mnt 
+
+# if everything looks ok, do the pivot root
+killall hotplug2
+
+[ -x /mnt/sbin/init ] && {
+        mount -o move /proc /mnt/proc && \
+        pivot_root /mnt /mnt/rom && {
+                mount -o move /rom/dev /dev
+                mount -o move /rom/rom/sys /sys
+                mount -o move /rom/tmp /tmp
+                # umount /rom/tmp
+                               set +x
+                               exec <$M0 >$M1 2>&0
+               exec /sbin/init
+        }
+        # umount $boot_dev
+}
+
+set +x
+exec <$M0 >$M1 2>&0
 exec /sbin/init

This is the filesystem setup I end up with

root@OpenWrt:/#  df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/sda1                 1088      1088         0 100% /rom/rom
none                      9908        28      9880   0% /tmp
tmpfs                      512         0       512   0% /dev
/dev/mtdblock3            6080       964      5116  16% /rom/jffs
mini_fo:/jffs             1088      1088         0 100% /rom
/dev/sda1               984855     21076    913735   2% /

Small minor changes to preinit

===================================================================
--- package/base-files/files/etc/preinit        (revision 8779)
+++ package/base-files/files/etc/preinit        (working copy)
@@ -64,4 +64,41 @@
 echo "- init -"
        
 killall hotplug2
+
+# Boot usb stick
+exec > /etc/preinit.text 2>&1
+set -x
+
+/sbin/hotplug2 --no-coldplug --persistent --set-rules-file /etc/hotplug2-init.rules &
+
+echo "/sbin/hotplug-call usb"> /proc/sys/kernel/hotplug
+
+for module in usbcore usb-ohci ehci-hcd uhci-hcd scsi_mod sd_mod usb-storage jbd ext3 ext2; do {
+        insmod $module
+}; done
+
+sleep 30s
+boot_dev="/dev/sda1"
+mount -o rw,noatime $boot_dev /mnt 
+
+# if everything looks ok, do the pivot root
+killall hotplug2
+
+[ -x /mnt/sbin/init ] && {
+       mount -o move /proc /mnt/proc && \
+       pivot_root /mnt /mnt/rom && {
+               mount -o move /rom/dev /dev
+               mount -o move /rom/sys /sys
+               mount -o move /rom/tmp /tmp
+               # umount /rom/tmp
+               set +x
+               exec <$M0 >$M1 2>&0
+               cp /rom/etc/preinit.text /etc/preinit.text
+               exec /sbin/init
+       }
+       umount /mnt
+}
+
+set +x
+exec <$M0 >$M1 2>&0
 exec /sbin/init

In an attempt to fix up the usb load so that it loads either the usb stick or the local flash (patch below)

It keeps hanging sad and I don't have console access - I tried the fail safe as well, setting up an ip and starting up telnetd but it did not help .............

Can somebody through their eye over the patch below
or if somebody has a WL500Gp with console access who wouldn't mind downloading an image to test and gather the error ? Send me a message

Index: package/base-files/files/etc/preinit
===================================================================
--- package/base-files/files/etc/preinit        (revision 8779)
+++ package/base-files/files/etc/preinit        (working copy)
@@ -17,6 +17,50 @@
        ash --login
 }
 
+mountUsb() {
+       rc=0
+
+       echo "/sbin/hotplug-call usb"> /proc/sys/kernel/hotplug
+
+       # Load USB Modules
+       for module in usbcore usb-ohci ehci-hcd uhci-hcd scsi_mod sd_mod usb-storage jbd ext3 ext2
+       do 
+               {
+                       insmod $module
+               }
+       done
+
+       # Wait for this to settle
+       sleep 30s
+
+
+       if [ -e /dev/sda1 ]
+       then
+               # mount
+               mount -o rw,noatime /dev/sda1 /mnt
+               if [ -e /mnt/usb.boot ] && [ -x /mnt/sbin/init ] 
+               then
+                       mount -o move /proc /mnt/proc && \
+                               pivot_root /mnt /mnt/rom && {
+                                       mount -o move /rom/sys /sys
+                                       mount -o move /rom/tmp /tmp
+
+                                       mount -o move /rom/dev /dev
+                                       mount -o move /rom/dev/pts /dev/pts
+                               }
+               else
+                       umount /mnt
+                       rc=1
+               fi
+
+       else
+               rc=1
+       fi
+       
+
+       return $rc
+}
+
 mount none /proc -t proc
 mount none /sys  -t sysfs
 
@@ -59,7 +103,7 @@
 echo "$HOTPLUG" > /proc/sys/kernel/hotplug
 eval ${FAILSAFE:+failsafe}
 lock -w /tmp/.failsafe
-mount_root
+mountUsb || mount_root
 
 echo "- init -"

I have moved to 7.06 as this is the last known good (doesn't segfault) version of kamikaze on the Wl500Gp.

I have create a /etc/preinit.usbboot

#!/bin/sh

echo "- rc=1 -"
rc=1

# Boot usb stick
echo "- hotplug call  -"
/sbin/hotplug2 --persistent --max-children 1 &
H=$!
echo "/sbin/hotplug-call usb"> /proc/sys/kernel/hotplug

echo "- Load modules  -"
for module in usbcore usb-ohci ehci-hcd uhci-hcd scsi_mod sd_mod usb-storage jbd ext3 ext2
do  
    {   
        insmod $module
    }
done

# Wait for this to settle
echo "- sleep -"
sleep 40s

# Does The drive Exist
echo "- is /dev/sda1 there -"
if [ -e /dev/sda1 ]
then
    echo "- yes  -"
    # Can we mount it
    if  mount -o rw,noatime /dev/sda1 /mnt
    then
        echo "- mounted  -"
        # Is there a usb.boot file and an executable /mnt/sbin/init file
        if [ -e /mnt/usb.boot ] && [ -x /mnt/sbin/init ]
        then
            echo "- Files exist about to pivot  -"
            mount -o move /proc /mnt/proc && \
            pivot_root /mnt /mnt/rom && {
                mount -o move /rom/sys /sys
                mount -o move /rom/tmp /tmp
                mount -o move /rom/dev /dev
                mount -o move /rom/dev/pts /dev/pts
                
                echo "- pivot successful  -"
                rc=0
            }
        else
            echo "- files not there ! -"
            # files doesn't exist umount drive
            umount /mnt
        fi
    
    fi
fi

kill $H
echo "- return  -"
set +x
return $rc

with this patch for /etc/preinit

Index: package/base-files/files/etc/preinit
===================================================================
--- package/base-files/files/etc/preinit        (revision 8823)
+++ package/base-files/files/etc/preinit        (working copy)
@@ -40,7 +40,7 @@
        M1=/dev/console
 }
 
-exec <$M0 >$M1 2>&0
+exec <$M0 >$M1 2>&1
 
 {
        echo "- preinit -"
@@ -52,9 +52,16 @@
        eval ${FAILSAFE:+failsafe}
        lock -w /tmp/.failsafe
 
-       mount_root
+       if      [ -e /etc/preinit.usbboot ]
+       then
+               echo "- found usbboot -"
+               /etc/preinit.usbboot || mount_root
+       else
+               echo "- no usbboot -"
+               mount_root
+       fi
 
        echo "- init -"
-} | tee /tmp/preinit.log
+} 2>&1 | tee /tmp/preinit.log

This means you need these packages installed kmod-fs-ext2 kmod-fs-ext3 fdisk  e2fsprogs libuuid kmod-usb2 kmod-usb-core kmod-usb-storage kmod-scsi-core in the image.

you also need
./package/base-files/files/etc/hotplug.d/usb/10-usb-storage
./package/base-files/files/sbin/usb-storage

from 7.07

The script runs before the jffs image is loaded up as root, which is why it all needs to be in the image.

[s]My last problem now is on reboots the usb key is turn off and isn't found again until it is pulled out and replaced.[/s]
edit - only happened with one usb key

(Last edited by alexsamad on 19 Sep 2007, 00:53)

Hi,
I tried the same and my usb-stick will also not be mounted at startup - and I REALLY DON'T KNOW WHY. my scipt is working if i do a /sbin/init then everything seems okay and i'm working on my stick, but when the router boots up the script won't work.

Could it be, that the script from /rom/sbin/init is been used?
I've added a line to the /sbin/init: write a simple line into a log file - and this logfile is created! so the /sbin/init is called!!


My /sbin/init

#!/bin/sh

boot_dev="/dev/scsi/host0/bus0/target0/lun0/part1"

for module in usbcore ehci-hcd scsi_mod sd_mod usb-storage jbd ext3; do {
        insmod $module
}; done

sleep 2s
mount -o rw "$boot_dev" /mnt

[ -x /mnt/sbin/init ] && {
        . /bin/firstboot
        pivot /mnt /mnt
}
echo "WHY ?" >> /startup.log
exec /bin/busybox init

It has worked under 7.06 and 7.07, but then i tried something out and...hrm..nothing worked anymore

(Last edited by spelth on 1 Oct 2007, 03:59)

You have to make the change to the flash image (build your own image). you right the /rom/etc/preinit is the one being called.

hi

maybe u should increase the sleep time ....

this code works for me ....

echo "- init -"

killall hotplug2

/sbin/hotplug2 --persistent --max-children 1 &
echo /sbin/hotplug-call > /proc/sys/kernel/hotplug

usb=0
# mount the usb stick

        for module in usbcore ehci-hcd uhci-hcd scsi_mod sd_mod usb-storage ext2 ; do {
                insmod $module
        }; done
        sleep 10s
        boot_dev="/dev/sda1"
        mount -o rw,noatime "$boot_dev" /mnt
        # if everything looks ok, do the pivot root
        [ -e /mnt/etc/usb.boot ] && [ -x /mnt/sbin/init ] && {
        mount -o move /proc /mnt/proc && \
        pivot_root /mnt /mnt/rom && {
                mount -o move /rom/dev /dev
                mount -o move /rom/sys /sys
                mount -o move /rom/tmp /tmp
                usb=1
        }
}

#no usbstick or no boot from it wanted
[ $usb -eq 0 ] && {
        umount /mnt
}

killall hotplug2

exec /bin/busybox init


but im using ext2 ... it has less overhead .. and on the media u boot .... do this "touch etc/usb.boot"


u can build everything from svn ... and modify the file ${svn_dir}/package/base-files/files/etc/preinit
this file will be your file on the router .....

hope this helps

(Last edited by puchu on 15 Oct 2007, 18:48)

This is what I have ended up using. I am building a trunk image, seems like there is some work being done on the random bus crashes and the segfauts so...

Index: package/base-files/files/etc/preinit
===================================================================
--- package/base-files/files/etc/preinit        (revision 8837)
+++ package/base-files/files/etc/preinit        (working copy)
@@ -59,7 +59,17 @@
 echo "$HOTPLUG" > /proc/sys/kernel/hotplug
 eval ${FAILSAFE:+failsafe}
 lock -w /tmp/.failsafe
-mount_root
+{       
+        if      [ -e /etc/preinit.usbboot ]
+        then    
+                echo "- found usbboot -"
+                /etc/preinit.usbboot || mount_root
+        else    
+                echo "- no usbboot -"
+                mount_root
+        fi
+} 2>&1 | tee /tmp/preinit.log
+
 [ -f /sysupgrade.tgz ] && {
        echo "- config restore -"
        cd /

This is for preinit

I decided to pull out the usb mounting to a separate file made a bug report to see if this can be added to the main stream.

this is my preinit.usb

#!/bin/sh

echo "- rc=1 -"
rc=1

# Boot usb stick
echo "- hotplug call  -"
/sbin/hotplug2 --persistent --coldplug --max-children 1 &
H=$!
#echo "/sbin/hotplug-call usb"> /proc/sys/kernel/hotplug

echo "- Load modules  -"
for module in usbcore usb-ohci ehci-hcd uhci-hcd scsi_mod sd_mod usb-storage jbd ext3 ext2
do
        {
                insmod $module
        }
done

# Wait for this to settle
echo "- sleep -"
sleep 40s

# Does The drive Exist
echo "- is /dev/sda1 there -"
if [ -e /dev/sda1 ]
then
        echo "- yes  -"
        # Can we mount it
        if  mount -o rw,noatime /dev/sda1 /mnt 
        then
                echo "- mounted  -"
                # Is there a usb.boot file and an executable /mnt/sbin/init file
                if [ -e /mnt/usb.boot ] && [ -x /mnt/sbin/init ]
                then
                        echo "- Files exist about to pivot  -"
                        mount -o move /proc /mnt/proc && \
                        pivot_root /mnt /mnt/rom && {
                                mount -o move /rom/sys /sys
                                mount -o move /rom/tmp /tmp
                                mount -o move /rom/dev /dev
                                mount -o move /rom/dev/pts /dev/pts

                                echo "- pivot successful  -"
                                rc=0
                        }
                else
                        echo "- files not there ! -"
                        # files doesn't exist umount drive
                        umount /mnt
                fi

        fi
fi

kill $H
echo "- return  -"
set +x
return $rc

seems to be working fine for me.  I stole ^h^h^h borrowed some ideas from other people ie only boot of the usb stick if usb.boot file exists

it needs a fsck in there as well.  Note it loads the file system as ext3, tried for ext2 but I had some problem and with no console access it can be a pain to debug

A

The discussion might have continued from here.