[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Trying to boot from USB HDD - linuxrc/initrd problem?



I've installed Xandros 4, a Debian derivative, on an external USB hard disk drive, and I'm trying to boot it from there. My laptop is able to boot USB storage devices, and I've succeeded in doing that with several other Linux distros (including the Debian-based Ubuntu and MEPIS), booting both off HDD's and off USB flash memory drives. I encountered no great problems but with Xandros I'm stymied.

I don't know whether the Xandros 4 kernel (2.6.15-dcc-uni) has USB support already compiled into it but I doubt it. Hence, in order to enable USB booting it seems to me that the modules ehci-hcd, ohci-hcd, uhci-hcd and usb-storage plus the reiserfs module (Xandros' filesystem) have to be put into the /modules directory of the ramdisk and loaded from there by linuxrc with the insmod command. After that there should be a sleep delay (e.g. sleep 10) to give the USB devices time to wake up. Finally, there should be a command to mount the Xandros root filesystem on the USB HDD partition (/dev/sdb2), something like mkdir mnt and mount -o ro -t reiserfs /dev/sdb2 /mnt

All of these things are missing in the stock linuxrc of Xandros 4. I've put them there but none of it is working. I inevitably wind up with a kernel panic at the point when the root filesystem should be mounted. Presumably, the root device simply isn't available at that point.

Xandros uses LILO as a bootloader, and putting "rootdelay=10" in the "append" line of the Xandros entry in lilo.conf also doesn't help.

The following is Xandros' linuxrc startup script:

#!/bin/sh
mount -t proc proc /proc
mount -t sysfs sys /sys
insmod /modules/scsi_mod.ko > /dev/null
insmod /modules/libata.ko > /dev/null
insmod /modules/sd_mod.ko > /dev/null
insmod /modules/reiserfs.ko > /dev/null
insmod /modules/ata_piix.ko > /dev/null
insmod /modules/generic.ko > /dev/null
insmod /modules/ide-disk.ko > /dev/null
for i in `ls /sys/block/*/*/` ; do
k=`echo $i | sed 's/:.*// ; s/ *$// ; s/.* //'`
if [ -f ${k}dev ] ; then
j=`cat ${k}dev`
DEV=`echo $k | sed 's/\/sys\/block\/.*[a-z]\/// ; s/\///'`
MAJOR=`echo $j | sed 's/:.*// ; s/ *$// ; s/.* //'`
MINOR=`echo $j | sed 's/.*:// ; s/^ *// ; s/ .*//'`
mknod /dev/$DEV b $MAJOR $MINOR >/dev/null 2>1
fi
done
[ -n "$XANDROSBOOTDEBUG" ] && /bin/busybox sh
[ -d /proc/suspend2 ] && echo > /proc/suspend2/do_resume
echo
echo Loading....
/bin/busybox umount /sys
/bin/busybox umount /proc

I'm not at all adept at shell scripting, and I can't figure out what this script is meant to do. E.g. why are the inserted disk driver modules dumped to the null device? Can someone explain to me what this script is intended to do and how I should edit it so that Xandros will boot from the USB drive?

Also, the /dev directory in the ramdisk is rather sparsely populated with devices. Among the sdX devices, there is only one, sdb2, which is the Xandros partition of my external USB drive (the internal drive is a SATA drive, and it is designated sda). Should there be more devices, and how would I put them there? Xandros uses a customized busybox as the mini-OS in this startup environment.

Robert



Reply to: