summaryrefslogtreecommitdiff
path: root/initramfs
diff options
context:
space:
mode:
authorMatt Housh <jaeger@crux.nu>2009-09-30 22:16:17 -0500
committerMatt Housh <jaeger@crux.nu>2009-09-30 22:16:17 -0500
commitcdc8a56fdacb4eff35c675888b2d19d8d02e1739 (patch)
tree834b79d23c8dbd384e50868679ef89fb2da210bc /initramfs
parenta38216b3ffb472a802ad418e3615b32622da7988 (diff)
downloadiso-cdc8a56fdacb4eff35c675888b2d19d8d02e1739.tar.gz
iso-cdc8a56fdacb4eff35c675888b2d19d8d02e1739.tar.xz
Multiple updates to allow boot/install from alternate media such as USB/CF/SD
Diffstat (limited to 'initramfs')
-rwxr-xr-xinitramfs/init83
-rw-r--r--initramfs/initramfs.lst26
2 files changed, 76 insertions, 33 deletions
diff --git a/initramfs/init b/initramfs/init
index 9d3a2a8..e8274aa 100755
--- a/initramfs/init
+++ b/initramfs/init
@@ -1,4 +1,5 @@
#!/bin/sh
+
#
# initramfs /init (busybox ash)
#
@@ -31,47 +32,48 @@ echoDone() {
echo -e $DONE
}
-# search for and mount the cdrom device, populate a tmpfs from it,
+# search for and mount the crux media, populate a tmpfs from it,
# and prepare /newroot for switch_root at the end of the script
-find_and_mount_cdrom() {
+find_and_mount_media() {
echo -e -n " ${BOLD}${BLUE}*${NORM} Creating and mounting tmpfs... "
mkdir /.tmpfs
mount -t tmpfs tmpfs /.tmpfs
checkReturn
- echo -e " ${BOLD}${BLUE}*${NORM} Searching for the CRUX CD..."
- mkdir /.tmpfs/.cdrom
- CRUXCD=""
+ echo -e " ${BOLD}${BLUE}*${NORM} Searching for the CRUX media..."
+ mkdir /.tmpfs/.media
+ CRUXMEDIA=""
CDROM_DEVICES="`grep 'drive name:' /proc/sys/dev/cdrom/info | cut -d: -f2`"
- for DEV in $CDROM_DEVICES
+ BLOCK_DEVICES="`grep -E '[sh]d' /proc/partitions | sed -e 's/.*\([sh]\)d/\1d/'`"
+ for DEV in $CDROM_DEVICES $BLOCK_DEVICES
do
DEV="/dev/$DEV"
- mount -r -t iso9660 $DEV /.tmpfs/.cdrom
+ mount -r $DEV /.tmpfs/.media 2> /dev/null
if [ $? -eq 0 ]
then
echo -e -n " ${BOLD}${GREEN}*${NORM} Found media on $DEV"
- if [ -e /.tmpfs/.cdrom/crux-cd ]
+ if [ -e /.tmpfs/.media/crux-media ]
then
- echo ", CRUX CD."
- CRUXCD=$DEV
- ln -s $DEV /dev/cdrom
+ echo ", CRUX media."
+ CRUXMEDIA=$DEV
+ ln -s $DEV /dev/media
break
else
- echo ", but it's not the CRUX CD."
- umount /.tmpfs/.cdrom
+ echo ", but it's not the CRUX media."
+ umount /.tmpfs/.media
fi
else
echo -e " ${BOLD}${YELLOW}*${NORM} No media found on $DEV."
fi
done
- # check if the cdrom was mounted properly. if not, spawn a shell
- if [ ! -e /.tmpfs/.cdrom/crux-cd ]
+ # check if the media was mounted properly. if not, spawn a shell
+ if [ ! -e /.tmpfs/.media/crux-media ]
then
- echo -e " ${BOLD}${RED}*${NORM} The CRUX CD was not properly mounted!"
+ echo -e " ${BOLD}${RED}*${NORM} The CRUX media was not properly mounted!"
echo " Spawning a shell for you to attempt to fix this problem. If"
- echo " you are able to find your cdrom device, mount it at"
- echo " /.tmpfs/.cdrom and then log out of this shell to continue."
+ echo " you are able to find the correct device, mount it at"
+ echo " /.tmpfs/.media and then log out of this shell to continue."
echo " If you are NOT able to fix the problem, installation will"
echo " not be possible."
echo
@@ -79,9 +81,9 @@ find_and_mount_cdrom() {
fi
# check again and stop if it's still not there
- if [ ! -e /.tmpfs/.cdrom/crux-cd ]
+ if [ ! -e /.tmpfs/.media/crux-media ]
then
- echo -e " ${BOLD}${RED}*${NORM} The CRUX CD still appears not to be"
+ echo -e " ${BOLD}${RED}*${NORM} The CRUX media still appears not to be"
echo " found and installation will not continue."
echo
sleep 99999
@@ -90,7 +92,7 @@ find_and_mount_cdrom() {
echo -e -n " ${BOLD}${BLUE}*${NORM} Mounting squashfs filesystem... "
mkdir /.tmpfs/.squashfs
- mount -r -t squashfs -o loop /.tmpfs/.cdrom/crux.squashfs /.tmpfs/.squashfs
+ mount -r -t squashfs -o loop /.tmpfs/.media/crux.squashfs /.tmpfs/.squashfs
checkReturn
echo -e " ${BOLD}${BLUE}*${NORM} Populating root filesystem..."
@@ -104,7 +106,7 @@ find_and_mount_cdrom() {
echo -e -n " ${BOLD}${BLUE}*${NORM} Copying devices from rootfs... "
cp -af /dev/* /newroot/dev/
checkReturn
- mkdir -p /newroot/dev/pts /newroot/cdrom
+ mkdir -p /newroot/dev/pts /newroot/media
echo -e -n " ${BOLD}${BLUE}*${NORM} Unmounting squashfs filesystem... "
umount /.tmpfs/.squashfs
@@ -114,9 +116,9 @@ find_and_mount_cdrom() {
# disassociate the loopback device associated with the squashfs filesystem
/bin/losetup -d /dev/loop0
- # the cdrom gets unmounted here and remounted after switch_root
- umount /.tmpfs/.cdrom
- rmdir /.tmpfs/.cdrom
+ # the media gets unmounted here and remounted after switch_root
+ umount /.tmpfs/.media
+ rmdir /.tmpfs/.media
echo -e -n " ${BOLD}${BLUE}*${NORM} Unmounting tmpfs... "
umount /.tmpfs
@@ -151,6 +153,23 @@ checkReturn
if [ -d /lib/modules ]
then
echo -e -n " ${BOLD}${BLUE}*${NORM} Loading modules... "
+ # squashfs support
+ modprobe squashfs
+
+ # ISO9660 support
+ modprobe isofs
+
+ # linux filesystems support
+ modprobe ext2
+ modprobe ext3
+ modprobe reiserfs
+ modprobe xfs
+ modprobe jfs
+
+ # dos/vfat filesystems support
+ modprobe vfat
+ modprobe msdos
+
# IDE support
modprobe ide-core
@@ -263,8 +282,8 @@ echo -e " ${BOLD}${BLUE}*${NORM} Waiting $DEVTIMEOUT seconds for devices to sett
sleep $DEVTIMEOUT
# if root=/dev/XXX was specified on the command line, use that as the new root
-# instead of searching for the cdrom and using it. if it fails, fall back to
-# the cdrom
+# instead of searching for the media and using it. if it fails, fall back to
+# the media
grep -q "root=/dev/*" /proc/cmdline
if [ $? -eq 0 ]
then
@@ -283,20 +302,20 @@ then
mount $ROOTDEV /newroot
if [ $? -ne 0 ]
then
- echo -e " ${BOLD}${RED}*${NORM} Unable to mount the specified root device! Falling back to the live CD."
- find_and_mount_cdrom
+ echo -e " ${BOLD}${RED}*${NORM} Unable to mount the specified root device! Falling back to the live media."
+ find_and_mount_media
else
if [ -x /newroot/sbin/init ]
then
echo -e " ${BOLD}${BLUE}*${NORM} Mounted root device $ROOTDEV."
else
- echo -e " ${BOLD}${RED}*${NORM} The specified root device ($ROOTDEV) does not appear to be usable! Falling back to the live CD."
+ echo -e " ${BOLD}${RED}*${NORM} The specified root device ($ROOTDEV) does not appear to be usable! Falling back to the live media."
umount /newroot
- find_and_mount_cdrom
+ find_and_mount_media
fi
fi
else
- find_and_mount_cdrom
+ find_and_mount_media
fi
echo -e " ${BOLD}${BLUE}*${NORM} Switching root.\n"
diff --git a/initramfs/initramfs.lst b/initramfs/initramfs.lst
index ef44408..552e0de 100644
--- a/initramfs/initramfs.lst
+++ b/initramfs/initramfs.lst
@@ -17,6 +17,7 @@ slink /bin/mount busybox 777 0 0
slink /bin/umount busybox 777 0 0
slink /bin/chroot busybox 777 0 0
slink /bin/grep busybox 777 0 0
+slink /bin/sed busybox 777 0 0
slink /bin/echo busybox 777 0 0
slink /bin/cut busybox 777 0 0
slink /bin/mkdir busybox 777 0 0
@@ -72,6 +73,17 @@ dir /lib/modules/#KERNEL_VERSION#/kernel/drivers/message 755 0 0
dir /lib/modules/#KERNEL_VERSION#/kernel/drivers/message/fusion 755 0 0
dir /lib/modules/#KERNEL_VERSION#/kernel/drivers/cdrom 755 0 0
dir /lib/modules/#KERNEL_VERSION#/kernel/drivers/base 755 0 0
+dir /lib/modules/#KERNEL_VERSION#/kernel/fs 755 0 0
+dir /lib/modules/#KERNEL_VERSION#/kernel/fs/squashfs 755 0 0
+dir /lib/modules/#KERNEL_VERSION#/kernel/fs/isofs 755 0 0
+dir /lib/modules/#KERNEL_VERSION#/kernel/fs/ext2 755 0 0
+dir /lib/modules/#KERNEL_VERSION#/kernel/fs/ext3 755 0 0
+dir /lib/modules/#KERNEL_VERSION#/kernel/fs/jfs 755 0 0
+dir /lib/modules/#KERNEL_VERSION#/kernel/fs/reiserfs 755 0 0
+dir /lib/modules/#KERNEL_VERSION#/kernel/fs/xfs 755 0 0
+dir /lib/modules/#KERNEL_VERSION#/kernel/fs/fat 755 0 0
+dir /lib/modules/#KERNEL_VERSION#/kernel/fs/jbd 755 0 0
+dir /lib/modules/#KERNEL_VERSION#/kernel/fs/exportfs 755 0 0
# modules.dep
file /lib/modules/#KERNEL_VERSION#/modules.dep ../tmp/squashfs/lib/modules/#KERNEL_VERSION#/modules.dep 644 0 0
@@ -231,4 +243,16 @@ file /lib/modules/#KERNEL_VERSION#/kernel/drivers/message/fusion/mptfc.ko ../ker
file /lib/modules/#KERNEL_VERSION#/kernel/drivers/message/fusion/mptsas.ko ../kernel/linux-#KERNEL_VERSION#/drivers/message/fusion/mptsas.ko 644 0 0
file /lib/modules/#KERNEL_VERSION#/kernel/drivers/message/fusion/mptscsih.ko ../kernel/linux-#KERNEL_VERSION#/drivers/message/fusion/mptscsih.ko 644 0 0
file /lib/modules/#KERNEL_VERSION#/kernel/drivers/message/fusion/mptspi.ko ../kernel/linux-#KERNEL_VERSION#/drivers/message/fusion/mptspi.ko 644 0 0
-
+file /lib/modules/#KERNEL_VERSION#/kernel/fs/squashfs/squashfs.ko ../kernel/linux-#KERNEL_VERSION#/fs/squashfs/squashfs.ko 644 0 0
+file /lib/modules/#KERNEL_VERSION#/kernel/fs/isofs/isofs.ko ../kernel/linux-#KERNEL_VERSION#/fs/isofs/isofs.ko 644 0 0
+file /lib/modules/#KERNEL_VERSION#/kernel/fs/ext2/ext2.ko ../kernel/linux-#KERNEL_VERSION#/fs/ext2/ext2.ko 644 0 0
+file /lib/modules/#KERNEL_VERSION#/kernel/fs/ext3/ext3.ko ../kernel/linux-#KERNEL_VERSION#/fs/ext3/ext3.ko 644 0 0
+file /lib/modules/#KERNEL_VERSION#/kernel/fs/jfs/jfs.ko ../kernel/linux-#KERNEL_VERSION#/fs/jfs/jfs.ko 644 0 0
+file /lib/modules/#KERNEL_VERSION#/kernel/fs/reiserfs/reiserfs.ko ../kernel/linux-#KERNEL_VERSION#/fs/reiserfs/reiserfs.ko 644 0 0
+file /lib/modules/#KERNEL_VERSION#/kernel/fs/xfs/xfs.ko ../kernel/linux-#KERNEL_VERSION#/fs/xfs/xfs.ko 644 0 0
+file /lib/modules/#KERNEL_VERSION#/kernel/fs/fat/fat.ko ../kernel/linux-#KERNEL_VERSION#/fs/fat/fat.ko 644 0 0
+file /lib/modules/#KERNEL_VERSION#/kernel/fs/fat/vfat.ko ../kernel/linux-#KERNEL_VERSION#/fs/fat/vfat.ko 644 0 0
+file /lib/modules/#KERNEL_VERSION#/kernel/fs/fat/msdos.ko ../kernel/linux-#KERNEL_VERSION#/fs/fat/msdos.ko 644 0 0
+file /lib/modules/#KERNEL_VERSION#/kernel/fs/mbcache.ko ../kernel/linux-#KERNEL_VERSION#/fs/mbcache.ko 644 0 0
+file /lib/modules/#KERNEL_VERSION#/kernel/fs/jbd/jbd.ko ../kernel/linux-#KERNEL_VERSION#/fs/jbd/jbd.ko 644 0 0
+file /lib/modules/#KERNEL_VERSION#/kernel/fs/exportfs/exportfs.ko ../kernel/linux-#KERNEL_VERSION#/fs/exportfs/exportfs.ko 644 0 0

Generated by cgit