--- trunk/mkinitrd-magellan/livecd/linuxrc.sh 2011/09/07 17:39:50 1512 +++ trunk/mkinitrd-magellan/livecd/linuxrc.sh 2012/04/02 11:40:49 1793 @@ -70,7 +70,16 @@ # mount essential filesystems mount -t proc proc /proc mount -t sysfs sysfs /sys -mount -t tmpfs tmpfs /dev -o rw,mode=0644,size=1024 +if [[ -z $(grep '[[:space:]]/dev[[:space:]]' /proc/mounts | cut -d ' ' -f2) ]] +then + # many video drivers needed exec access + fstype=ramfs + # tmpfs was suggested by Greg Kroah-Hartman + [[ $(grep '[[:space:]]tmpfs' /proc/filesystems | cut -d $'\t' -f2) = tmpfs ]] && fstype=tmpfs + # mount devtmpfs if supported + [[ $(grep '[[:space:]]devtmpfs' /proc/filesystems | cut -d $'\t' -f2) = devtmpfs ]] && fstype=devtmpfs + mount -t ${fstype} dev /dev -o exec,nosuid,mode=0755,size=10M +fi # install all busybox applets busybox --install -s @@ -97,6 +106,7 @@ break) BREAK_ENABLED=yes ;; unionfs) UNIONFS=yes;; unionfs_file=*) UNIONFS_FILE="${i#*=}";; + rootdelay=*) ROOTDELAY="${i#*=}";; esac done @@ -129,6 +139,12 @@ sleep 8 fi +# respect rootdelay kernel param +if [ ! -z "${ROOTDELAY}" ]; then + echo "-- Requested a rootdelay of ${ROOTDELAY} seconds ..." + sleep ${ROOTDELAY} +fi + # searching cdrom with cdid BOOT_DEVICE="" FSTYPE="" @@ -200,13 +216,19 @@ done mkdir -p initrd proc tmp sys var/tmp dev media - # make /sysroot/dev/console & /mnt/dev/null - [ ! -e /sysroot/dev/console ] && mknod -m 600 /sysroot/dev/console c 5 1 - [ ! -e /sysroot/dev/null ] && mknod -m 666 /sysroot/dev/null c 1 3 - # only to be safe and to have a log channel - [ ! -e /sysroot/dev/tty ] && mknod /sysroot/dev/tty c 5 0 - # busybox needs this one - [ ! -e /sysroot/dev/tty5 ] && mknod /sysroot/dev/tty5 c 4 5 + # use devtmpfs if supported + if [ "$(grep devtmpfs /proc/filesystems | cut -d$'\t' -f2)" = "devtmpfs" ] + then + mount -t devtmpfs dev /sysroot/dev + else + # make /sysroot/dev/console & /mnt/dev/null + [ ! -e /sysroot/dev/console ] && mknod -m 600 /sysroot/dev/console c 5 1 + [ ! -e /sysroot/dev/null ] && mknod -m 666 /sysroot/dev/null c 1 3 + # only to be safe and to have a log channel + [ ! -e /sysroot/dev/tty ] && mknod /sysroot/dev/tty c 5 0 + # busybox needs this one + [ ! -e /sysroot/dev/tty5 ] && mknod /sysroot/dev/tty5 c 4 5 + fi (cd ${CLOOPMOUNTDIR}; cp -a etc root home var /sysroot) @@ -233,8 +255,8 @@ fi echo "-- Switching to real sysroot ..." -umount /dev -umount /sys -umount /proc +mount --move /dev /sysroot/dev +mount --move /sys /sysroot/sys +mount --move /proc /sysroot/proc exec run-init /sysroot ${INITEXEC} $@ /sysroot/dev/console