Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fw-initramfs.git;a=commitdiff;h=5e3e568e27d77b2b29c1328a0fa60717422b7fa0
commit 5e3e568e27d77b2b29c1328a0fa60717422b7fa0 Author: bouleetbil <[email protected]> Date: Sun Feb 21 23:04:24 2010 +0100 *added option install initramfs *fixed fcsk on startup *begin to add splashy diff --git a/create_functions.sh b/create_functions.sh index 1691943..29d3d3c 100644 --- a/create_functions.sh +++ b/create_functions.sh @@ -89,6 +89,8 @@ echo "usage:" echo " create_initramfs.sh {--help}" echo " create_initramfs.sh {--disable-lvm}" echo " create_initramfs.sh {--disable-mdam}" +echo " create_initramfs.sh {--disable-splash}" +echo " create_initramfs.sh {--install-initramfs}" exit; } diff --git a/create_initramfs.sh b/create_initramfs.sh index e6cabbe..0de1b52 100755 --- a/create_initramfs.sh +++ b/create_initramfs.sh @@ -29,6 +29,16 @@ while [[ $1 = -* ]]; do ENABLEMDAM=0 shift ;; + --disable-splash) + echo "initramfs will be build splashy" + ENABLESPLASH=0 + shift + ;; + --install-initramfs) + echo "install initramfs into /boot" + INSTALLINITRAMFS=1 + shift + ;; -d|--dir) DIRSTATIC="$2" echo "Binary build into $DIRSTATIC" @@ -125,6 +135,14 @@ cd ${DIRTEMP}/work/initramfs ln -sf busybox bin/sh rm ${DIRTEMP}/work/initramfs/linuxrc +if [ $ENABLESPLASH -eq 1 ] +then + good_msg "Install splashy to initramfs" + cp /usr/sbin/splashy $DIRTEMP/work/initramfs/sbin/splashy || + die_msg "couldn't install splashy to initramfs !" + cp /usr/sbin/splashy_update $DIRTEMP/work/initramfs/sbin/splashy_update || + die_msg "couldn't install splashy_update to initramfs !" +fi ##################################################################### # append modules ##################################################################### @@ -156,9 +174,14 @@ find . | cpio -H newc -o > ../initramfs.cpio cd .. cat initramfs.cpio | gzip > initramfs.igz - -good_msg 'for use this initramfs :' -good_msg "cp ${DIRTEMP}/work/initramfs.igz /boot/initramfs.igz" -good_msg 'edit /boot/grub/menu.lst' -good_msg 'add initrd /boot/initramfs.igz' +if [ $INSTALLINITRAMFS -eq 1 ] +then + good_msg 'Install initramfs into boot' + cp ${DIRTEMP}/work/initramfs.igz /boot/initramfs.igz -f +else + good_msg 'for use this initramfs :' + good_msg "cp ${DIRTEMP}/work/initramfs.igz /boot/initramfs.igz" + good_msg 'edit /boot/grub/menu.lst' + good_msg 'add initrd /boot/initramfs.igz' +fi diff --git a/default.sh b/default.sh index e9f539f..7325af9 100644 --- a/default.sh +++ b/default.sh @@ -14,5 +14,7 @@ KV=`uname -r` DESTBUILD=$HOMESOURCE/static ENABLELVM=1 ENABLEMDAM=1 +ENABLESPLASH=1 +INSTALLINITRAMFS=0 DIRSTATIC="" VERSION="0.1" diff --git a/init b/init index 973c3ce..435638c 100755 --- a/init +++ b/init @@ -16,10 +16,6 @@ clear #Create all the symlinks to /bin/busybox busybox --install -s - -# if QUIET is set make the kernel less chatty -[ -n "$QUIET" ] && echo '0' > /proc/sys/kernel/printk - #Create device nodes good_msg "Creating dev" # /dev will be the only writable place for this initrd if it's cramfs, so @@ -52,6 +48,7 @@ then ln -s /bin/lvm /bin/vgchange fi +quiet_kmsg #Defaults init="/sbin/init" @@ -100,6 +97,7 @@ do loadmodules) LOADMULES=1 ;; + rw) readwrite=1 ;; # iscsi #TODO: Add binary loadmodules) @@ -112,7 +110,8 @@ done #Mount things needed by this script mount_sysfs -#splash +#splashy +splash # Setup hotplugging for firmware loading setup_hotplug @@ -213,34 +212,37 @@ rundebugshell good_msg "Booting (initramfs)" -#Mount the root device -mount "${root}" /newroot +# Reset kernel hotplugging +good_msg "Resetting kernel hotplugging" +echo "" > /proc/sys/kernel/hotplug + +#mount root with good option +if [ "${readwrite}" -eq '1' ] +then + option="rw" +else + option="ro" +fi +mount -o $option "${root}" /newroot + +verbose_kmsg #Check if $init exists and is executable if [[ -x "/newroot/${init}" ]] then #Unmount all other mounts so that the ram used by #the initramfs can be cleared after switch_root - - # Reset kernel hotplugging - good_msg "Resetting kernel hotplugging" - echo "" > /proc/sys/kernel/hotplug - - # Umount /sys + good_msg "Unmounting /proc" + mount --move /proc /newroot/proc good_msg "Unmounting /sys" - umount /sys - - # Umount /dev tree + mount --move /sys /newroot/sys good_msg "Unmounting /dev" - umount /dev - - # Umount /proc - good_msg "Unmounting /proc" - umount /proc + mount --move /dev /newroot/dev #Switch to the new root and execute init cd /newroot - exec switch_root . ${init} + exec switch_root -c /dev/console . ${init} "$@" + fi #This will only be run if the exec above failed diff --git a/init_functions.sh b/init_functions.sh index f56a318..715fc48 100644 --- a/init_functions.sh +++ b/init_functions.sh @@ -188,3 +188,20 @@ startVolumes() { fi } + +quiet_kmsg() { + # if QUIET is set make the kernel less chatty + [ -n "$QUIET" ] && echo '0' > /proc/sys/kernel/printk +} + +verbose_kmsg() { + # if QUIET is set make the kernel less chatty + [ -n "$QUIET" ] && echo '6' > /proc/sys/kernel/printk +} + +splash() { + if [ -f /sbin/splashy ] + then + splashy + fi +} _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
