2006-07-22

getting the CF to be root

So, the UsbStorageHowto works pretty well. Basically, the steps I used were:


mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt
mkdir /tmp/root
mount -o bind /rom /tmp/root
cp /tmp/root/* /mnt -a
umount /tmp/root
umount /mnt
cd /sbin
mv init init.old
vi init
chmod a+x init


and here's my version of init


#!/bin/sh
boot_dev="/dev/scsi/host0/bus0/target0/lun0/part1"
for module in usbcore usb-ohci scsi_mod sd_mod usb-storage jbd ext3; do {
insmod $module
}; done
sleep 4s
mount "$boot_dev" /mnt
[ -x /mnt/sbin/init ] && {
mount -o move /proc /mnt/proc && pivot_root /mnt /mnt/mnt && {
mount -o move /mnt/dev /dev
mount -o move /mnt/tmp /tmp
mount -o move /mnt/jffs2 /jffs2 2>&-
mount -o move /mnt/sys /sys 2>&-
}
}
exec /bin/busybox init


Of course, what's not mentioned is that your system is reset to as if you just installed OpenWrt. So you have to set the root pw, update ipkg.conf, install pkgs, etc. etc. as per my last blog post.

BTW, after it's all said and done, the filesystems show up as follows:


root@OpenWrt:~# df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/root 1024 1024 0 100% /mnt/rom
/dev/mtdblock/4 6272 1304 4968 21% /mnt
none 15276 36 15240 0% /tmp
/dev/scsi/host0/bus0/target0/lun0/part1 121203 8583 106362 7% /mnt/mnt/disc0_1
/dev/scsi/host0/bus0/target0/lun0/part1 121203 8583 106362 7% /
root@OpenWrt:~#


With 32MB of RAM and 128MB of disk... it's 1990 all over again!

Tony

Labels:

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home