index

Kamikaze OpenWrt - boot from external USB flash drive
yet more notes for my bad memory


Objective
Use a Slug in the same way as I use the Sweex/Edimax router for web control of attached devices
- minimal Kamikaze system
- no swap drive (thus able to use a flash drive)
BUT with the advantages of text to speech (and an attached webcam ?)
- and all on the latest KAMIKAZE (7.09)

I followed the advice here (with thanks) and I back up the instructions below (slightly modified)

Prepare a flash drive (SanDisk 2 GByte) as one ext 2 partition - no swap
( using QTParted on Fedora 7 on Linux on VMware Fusion on a Mac )

Set Slug for upgrade - hold reset and power push buttons
count 10 to 14 seconds - see Ready/Status flashing between 2 colours - release reset and power push buttons
then from a terminal in Linux on VMware Fusion on a Mac
upslug2 --image="image_name.bin" <<<prepared on my OpenWrt toolchain

ipkg update
ipkg install nano
(I can't uderstand vi)

plug the stick in

mount -t ext2 /dev/sda1 /mnt
mkdir /tmp/root
mount -o bind /rom /tmp/root
cp /tmp/root/* /mnt -a
umount /tmp/root
umount /mnt

nano /etc/init.d/pivotroot

copy and paste this into /etc/init.d/pivotroot

#!/bin/sh
# change this to your boot device
boot_dev="/dev/sda1"
/sbin/hotplug2 --override --persistent --max-children 1 --no-coldplug &
for module in usbcore uhci scsi_mod sd_mod usb-storage jbd ext2 ext3 ; do {
insmod $module
}; done

# this may need to be higher if your disk is slow to initialize
sleep 30s
# mount the usb stick
mount "$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/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>&-
}
}

Then make it executable

chmod a+x /etc/init.d/pivotroot

Now, make the symlink so it will start at boot time

ln -s /etc/init.d/pivotroot /etc/rc.d/S10pivotroot

replace everything in /etc/init.d/rcS with this

nano /etc/init.d/rcS

#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
if test $2 == "boot" ; then
/etc/init.d/pivotroot
fi
{
for i in /etc/rc.d/$1*; do
$i $2 2>&1
done
} | logger -s -p 6 -t '' &

Now reboot and telnet to your slug
Use 'passwd' to set your new root password

then
ipkg install vsftpd
so you can modify other files using a Mac based text editor (Text Wrangler)

PROBLEMS!
To get my USB sound card to run I have to load all the files into the slug before the USB flash memory stick is added - test it - then do that all over again when booting from the stick.

To ipkg install flite I need to set up a share partition since it runs out of memory during install.
I tried to do that as per here but it failed to run swapon /dev/sda2 - Google shows others with that problem too

PLEASE email me if you get swap to run


for cut-n-paste during install -

in toolchain
mkswap select
and swaponoff was selected in default
swap-utils select

ipkg update
ipkg install nano
ipkg install vsftpd
ln -s /etc/init.d/vsftpd /etc/rc.d/S50vsftpd
reboot
/etc/config/network
/etc/config/system

ipkg install alsa-lib
ipkg install alsa-utils
ipkg install madplay

see if sound drivers are in OK at
/lib/modules/2.6.21.6/

add these into /etc/modules.d/60usbaudio
snd-hwdep
snd-rawmidi
These were present anyway -
snd-usb-lib
snd-usb-audio