From: <smi...@us...> - 2003-11-08 21:04:26
|
Update of /cvsroot/devil-linux/build/config/etc/initrd In directory sc8-pr-cvs1:/tmp/cvs-serv14411/config/etc/initrd Modified Files: linuxrc mount_cdrom Log Message: - initrd scripts now use devfs device names - install-usb now uses fat file system and the plain bootcd.iso file Index: linuxrc =================================================================== RCS file: /cvsroot/devil-linux/build/config/etc/initrd/linuxrc,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- linuxrc 29 Sep 2003 13:27:09 -0000 1.43 +++ linuxrc 8 Nov 2003 21:04:23 -0000 1.44 @@ -32,38 +32,6 @@ export PATH=$PATH:/sbin:/usr/sbin -# print out memory statistics -mem_stat () { - MEM_FREE=$(cat /proc/meminfo | grep "^MemFree:" | sed -e "s/ \+/ /g" | cut -f2 -d" ") - MEM_BUFFERS=$(cat /proc/meminfo | grep "^Buffers:" | sed -e "s/ \+/ /g" | cut -f2 -d" ") - MEM_CACHED=$(cat /proc/meminfo | grep "^Cached:" | sed -e "s/ \+/ /g" | cut -f2 -d" ") - MEM_SWAP=$(cat /proc/meminfo | grep "^SwapTotal:" | sed -e "s/ \+/ /g" | cut -f2 -d" ") - let MEM=$MEM_FREE+$MEM_BUFFERS+$MEM_CACHED+$MEM_SWAP - - ROOT_DEV=$(df / | tail -n1 | sed -e "s/ / /g" -e "s/ \+/ /g" | cut -f1 -d" ") - MEM_ROOT=$(df / | tail -n1 | sed -e "s/ / /g" -e "s/ \+/ /g" | cut -f3 -d" ") - if grep -q /dev/shm /proc/mounts; then - MEM_SHM=$(df /dev/shm 2>/dev/null| tail -n1 | sed -e "s/ / /g" -e "s/ \+/ /g" | cut -f3 -d" ") - else - MEM_SHM=0 - fi - if [ "$ROOT_DEV" = "/dev/ram0" ]; then - let MEM_USED=$MEM_ROOT+$MEM_SHM - else - let MEM_USED=$MEM_SHM - fi - let MEM_FREE=$MEM_USABLE+$MEM_SWAP-$MEM_USED - - echo - echo "Memory statistics:" - echo " total: ${MEM_TOTAL} kB" - echo " usable: ${MEM_USABLE} kB" - echo " fake max. free: ${MEM} kB" - echo " estimated max. free: ${MEM_FREE} kB" - echo - -} - mod_config() { [ ! -e /etc/sysconfig/config.org ] && cp /etc/sysconfig/config /etc/sysconfig/config.org rm -f /etc/sysconfig/config.tmp @@ -81,18 +49,8 @@ return 1 } -# USB doesn't work the first mount, until after it has been initialized. -# This proc does a fake mount on all USB devices and a sleep before real mount. -wait_for_usb() -{ - echo "waiting until usb-storage driver has initialized all devices ..." - for CFG_SRC in $CONFIG_SRC_LIST - do - [ $CFG_SRC != "fd0" ] && \ - mount -f -n -t auto /dev/$CFG_SRC /floppy >/dev/null 2>&1 - done - sleep 10 -} +# make sure all kernel warnings get lost (seriously!) +klogd -c 1 # get version info DLVERSION=$(cat VERSION) @@ -100,49 +58,46 @@ # mount proc mount -n -t proc none /proc -# get memory size -#MEM_TOTAL=$(dmesg | grep "^Memory: " | cut -f2 -d" " | cut -f2 -d/ | sed -e "s/k$//") -#MEM_USABLE=$(cat /proc/meminfo | grep "^MemTotal:" | sed -e "s/ \+/ /g" | cut -f2 -d" ") - -# print memory statistics -#mem_stat +# mount devfs +mount -n -t devfs none /dev +# create the floppy drives, somehow devfs doesn't do it in initrd +mknod /dev/fd0 b 2 0 +mknod /dev/fd1 b 2 0 # mount shared memory filesystem with a limit of 40GB (for now) echo "Mounting SHM FS on /shm" -#mount -n -t shm -o size=40g shmfs /shm mount -n -t shm shmfs /shm -#USBDEVS="" -#for device in $(find /proc/scsi/ -path '/proc/scsi/usb-storage*' -type f | xargs grep -l 'Attached: Yes') -#do -# USBDEVS="$USBDEVS $(echo $device | awk -F"[-/]" '{ n=$(NF-1); print "/dev/sd" substr("abcdefghijklmnopqrstuvwxyz", n+1, 1) "1" }')" -#done -#echo "USBDEVS='$USBDEVS'" -#CONFIG_SRC_LIST="$USBDEVS fd0" -CONFIG_SRC_LIST="sda1 sdb1 sdc1 sdd1 sde1 sdf1 sdg1 sdh1 fd0" -DL_CONFIG_SOURCE="" - # get rid of modprobe warnings mkdir -p /shm/etc -ln -sf /shm/etc /etc -#echo "alias block-major-8 off" > /etc/modules.conf -wait_for_usb +echo "waiting until usb-storage driver has initialized all devices ..." +sleep 10 + +# generate the device list we need to search for the configuration information +CDROM_IDE=`find /dev/ide/ -name "cd*" 2> /dev/null` +CDROM_SCSI=`find /dev/scsi/ -name "cd*" 2> /dev/null` +PARTITIONS_IDE=`find /dev/ide/ -name "part*" 2> /dev/null` +PARTITIONS_SCSI=`find /dev/scsi/ -name "part*" 2> /dev/null` +CONFIG_SRC_LIST="$CDROM_IDE $CDROM_SCSI $PARTITIONS_IDE $PARTITIONS_SCSI /dev/fd0 /dev/fd1" +DL_CONFIG_SOURCE="" $SUCCESS echo "searching for configuration media" $NORMAL +/bin/sh + until [ -e /floppy/etc.tar.bz2 ] ; do for CFG_SRC in $CONFIG_SRC_LIST do - if mount -n -t auto /dev/$CFG_SRC /floppy >/dev/null 2>&1 ; then + if mount -n -t auto $CFG_SRC /floppy >/dev/null 2>&1 ; then if [ -e /floppy/etc.tar.bz2 ] ; then $SUCCESS - echo "Found configuration on /dev/$CFG_SRC" + echo "Found configuration on $CFG_SRC" $NORMAL - DL_CONFIG_SOURCE=/dev/$CFG_SRC + DL_CONFIG_SOURCE=$CFG_SRC continue 2 else beep; @@ -162,9 +117,9 @@ $NORMAL continue fi - mount -n -t auto /dev/$CFG_SRC /floppy >/dev/null 2>&1 || continue + mount -n -t auto $CFG_SRC /floppy >/dev/null 2>&1 || continue cp -i /cdrom/config/etc.tar.bz2 /floppy/ || continue - DL_CONFIG_SOURCE=/dev/$CFG_SRC + DL_CONFIG_SOURCE=$CFG_SRC continue 2 fi fi @@ -196,9 +151,6 @@ echo "loading configuration" tar -C /shm -xjf /floppy/etc.tar.bz2 -#echo "reading list of modules to load from config media" -#tar -C /shm -xjf /floppy/etc.tar.bz2 etc/sysconfig/config - # unmount config media umount /floppy @@ -226,13 +178,13 @@ sleep 1 modprobe -r +# kill our klogd +kill `ps ax | grep klogd | cut -f 1 -d 0` + # mount shared memory filesystem with a limit of 40GB (for now) echo "Mounting SHM FS on /cdrom/shm" mount -n -o bind /shm /cdrom/shm umount /shm - -# print memory statistics -#mem_stat # unmount proc because the final system will mount it again umount /proc Index: mount_cdrom =================================================================== RCS file: /cvsroot/devil-linux/build/config/etc/initrd/mount_cdrom,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- mount_cdrom 8 Nov 2003 04:04:51 -0000 1.18 +++ mount_cdrom 8 Nov 2003 21:04:23 -0000 1.19 @@ -20,56 +20,36 @@ $NORMAL fi -# IDE CD-ROM -for disk in hda hdb hdc hdd hde hdef hdg hdh; do - if [ -d /proc/ide/$disk ]; then - if [ -r /proc/ide/$disk/media ]; then - if grep -s -q "cdrom" /proc/ide/$disk/media; then - if mount -n -t iso9660 -o ro /dev/$disk $1 2> /dev/null; then - if [ -e $1/DEVIL-LINUX ] ; then - DRIVENAME=$(cat /proc/ide/$disk/model) - if [ "$3" != "silent" ]; then - $YELLOW - echo -e "\nFound on /dev/$disk ($DRIVENAME)" - $NORMAL - fi - exit 0 - else - umount $1 - fi - fi +# generate list of cdroms from devfs +CDROM_IDE=`find /dev/ide/ -name "cd*" 2> /dev/null` +CDROM_SCSI=`find /dev/scsi/ -name "cd*" 2> /dev/null` +CDROMS="$CDROM_IDE $CDROM_SCSI" + +for disk in $CDROMS +do + echo checking $disk + if mount -n -t iso9660 -o ro $disk $1 2> /dev/null; then + if [ -e $1/DEVIL-LINUX ] ; then + if [ "$3" != "silent" ]; then + $YELLOW + echo -e "\nFound on $disk" + $NORMAL fi + exit 0 + else + umount $1 fi fi done -# SCSI CD-ROM -if [ -f /proc/scsi/scsi ] ; then - - if ! grep -q "Attached devices: none" /proc/scsi/scsi - then - for drive in $(echo /dev/scd?); do - if ! mount -n -r -t iso9660 $drive $1 2> /dev/null - then - continue - elif [ -e $1/DEVIL-LINUX ] - then - if [ "$3" != "silent" ]; then - $YELLOW - echo -e "\nFound on $drive" - $NORMAL - fi - exit 0 - else - umount $1 - fi - done - fi -fi - -# USB devices -for disk in sda1 sdb1 sdc1 sdd1 sde1 sdf1 sdg1 sdh1; do - if mount -n -t auto -o rw,noatime /dev/$disk /mnt 2> /dev/null; then +# ok let's check all partitions if we find the bootcd.iso & the file DEVIL-LINUX +PARTITIONS_IDE=`find /dev/ide/ -name "part*" 2> /dev/null` +PARTITIONS_SCSI=`find /dev/scsi/ -name "part*" 2> /dev/null` +PARTITIONS="$PARTITIONS_IDE $PARTITIONS_SCSI" +for disk in $PARTITIONS +do + echo checking $disk + if mount -n -t auto -o rw,noatime $disk /mnt 2> /dev/null; then if [ -e /mnt/DEVIL-LINUX ] ; then if [ -e /mnt/bootcd.iso ] ; then mount -o loop -t iso9660 /mnt/bootcd.iso $1 || return 1 @@ -77,7 +57,7 @@ fi if [ "$3" != "silent" ]; then $YELLOW - echo -e "\nFound on /dev/$disk" + echo -e "\nFound ISO on $disk" $NORMAL fi exit 0 @@ -96,22 +76,13 @@ [ "$2" = "noreboot" ] && exit 1 -$YELLOW +$RED echo echo 'Please check your Hardware!' -echo 'Booting will NOT continue, you have to reset to try again (autoreboot in 2min)' +echo 'Booting will NOT continue, you have to reset to try again' $NORMAL -# we will wait about 2min till we try to reboot -count=1 +# endless loop while true; do - if [ $count -gt 24 ]; then - sync; sync - reboot -# exit 1 - else - echo -n "." - fi sleep 5 - count=$(expr $count + 1) done |