diff --git a/target/livecd/build_stage1.sh b/target/livecd/build_stage1.sh index 8f8f428cf..46e9d3564 100644 --- a/target/livecd/build_stage1.sh +++ b/target/livecd/build_stage1.sh @@ -11,6 +11,11 @@ for d in etc home bin sbin opt usr tmp var lib ; do ln -s /mnt/cowfs_ro/$d mnt/cowfs_rw/$d done # +if [ -L $disksdir/2nd_stage/lib64 ] ; then + ln -s /mnt/cowfs_rw/lib64 lib64 + ln -s /mnt/cowfs_ro/lib64 mnt/cowfs_rw/lib64 +fi +# if [ -x ../../../usr/bin/diet ] ; then export DIETHOME="../../../usr/dietlibc" LXRCCC="../../../usr/bin/diet $CC"; diff --git a/target/livecd/build_stage2.sh b/target/livecd/build_stage2.sh index ef648f34b..df7317057 100644 --- a/target/livecd/build_stage2.sh +++ b/target/livecd/build_stage2.sh @@ -24,6 +24,8 @@ rm -rf usr/src # TODO finish-package!! echo_status "Running ldconfig to create links ..." ldconfig -r . +echo_status "Running depmod for target system ..." +depmod -b $PWD -F ../boot/System.map `ls ../boot/vmlinuz_* | sed -e 's,\.\./boot/vmlinuz_,,'` # echo_status "replacing some vital files for live useage ..." cp -f $base/target/$target/fixedfiles/inittab etc/inittab diff --git a/target/livecd/config.in b/target/livecd/config.in index 1aa7ee4b0..276029e98 100644 --- a/target/livecd/config.in +++ b/target/livecd/config.in @@ -68,4 +68,5 @@ pkgenable pseudonative-daemon pkgenable tcp_wrappers pkgenable portmap pkgenable pcmcia-cs -pkgenable rockplug +pkgenable hotplug +pkgenable udev diff --git a/target/livecd/fixedfiles/system b/target/livecd/fixedfiles/system index e0689a566..8dd3e90c7 100644 --- a/target/livecd/fixedfiles/system +++ b/target/livecd/fixedfiles/system @@ -48,79 +48,68 @@ case "$1" in title "Creating valid /etc/mtab ..." grep -v "^rootfs " /proc/mounts > /etc/mtab || error=$? status + if [ -f /etc/conf/hardware ] ; then + . /etc/conf/hardware + fi + + if [ -f /etc/conf/devfs ] ; then + title "Configuring the /dev filesystem ..." + sh /etc/conf/devfs || error=$? + status + fi - title "Running depmod ..." - /sbin/depmod -a -n > /etc/modules.dep || error=$? - status - - title "Mounting /sys, /dev/shm and /dev/pts." - mount -n /sys 2> /dev/null - mount -n /dev/shm || error=$? - mount -n /dev/pts 2> /dev/null - if [ -f /etc/conf/hardware ] ; then - . /etc/conf/hardware - fi - status - - title "Configuring the /dev filesystem ..." - sh /etc/conf/devfs || error=$? - status - - title "Configuring hardware by activating rockplug." - echo "/sbin/rockplug" > /proc/sys/kernel/hotplug - for file in /etc/rockplug/*.init ; do - [ -f $file ] && $file start - done + if [ -d /etc/hotplug ] ; then + title "Configuring hardware by activating hotplug." + [ -f /proc/sys/kernel/hotplug ] && \ + echo "/sbin/hotplug" > /proc/sys/kernel/hotplug + for RC in /etc/hotplug/*.rc; do + echo -n "[$( basename ${RC%.rc} )] " + $RC start || error=$?; + done ; echo + mkdir -p /var/lock/subsys + touch /var/lock/subsys/hotplug status + fi title "Loading kernel modules and configuring the kernel." - sh /etc/conf/kernel || error=$? + if [ -f /etc/conf/kernel ] ; then + sh /etc/conf/kernel || error=$? + fi - [ -f /etc/conf/clock ] && . /etc/conf/clock - if [ "$clock_tz" = localtime ] ; then - status + [ -f /etc/conf/clock ] && . /etc/conf/clock + if [ "$clock_tz" = localtime ] ; then + status - title "Setting kernel clock to local time." - hwclock --hctosys --localtime || error=$? - fi - if [ "$clock_rtc" ] ; then - status + title "Setting kernel clock to local time." + hwclock --hctosys --localtime || error=$? + fi + status - title "Setting enhanced real time clock precision to $clock_rtc." - if [ -w /proc/sys/dev/rtc/max-user-freq ] ; then - echo $clock_rtc > /proc/sys/dev/rtc/max-user-freq || error=$? - else - echo "No /proc/sys/dev/rtc/max-user-freq found." + if [ "$clock_rtc" ] ; then + if [ -w /proc/sys/dev/rtc/max-user-freq ] ; then + title "Setting enhanced real time clock precision to $clock_rtc." + echo $clock_rtc > /proc/sys/dev/rtc/max-user-freq || error=$? + status + fi fi - fi - status title "Setting hostname to $(cat /etc/HOSTNAME)." hostname "$(cat /etc/HOSTNAME)" || error=$? status - title "Refresh utmp, delete lock and tmp files and other stuff." - find /var/lock /var/run /tmp -mindepth 1 -print0 2> /dev/null | xargs --null rm -rf - rm -f /etc/nologin /nologin /fastboot ; touch /var/run/utmp - chmod 664 /var/run/utmp ; chown root:tty /var/run/utmp mkdir /tmp/.ICE-unix chmod 1777 /tmp/.ICE-unix - status title "Writing /var/log/boot.msg." - klogd -f /var/log/boot.msg -o ; dmesg -n 3 + dmesg > /var/log/boot.msg || error=$? status - title "Setting keyboard keymappings." - if [ -L /etc/default.keymap ] ; then - mapfile=$(ls -l /etc/default.keymap | sed 's,.* -> ,,') + if [ -e /etc/default.keymap ] ; then + title "Setting keyboard mappings." + mapfile=$( readlink -f /etc/default.keymap ) loadkeys $mapfile || error=$? - elif [ -f /etc/default.keymap ] ; then - loadkeys /etc/default.keymap || error=$? - else - echo "No /etc/default.keymap found." + status fi - status title "Setting keyboard repeat rate and delay time." kbd_rate=30; kbd_delay=250 @@ -128,16 +117,12 @@ case "$1" in /usr/bin/kbdrate -r $kbd_rate -d $kbd_delay < /dev/console || error=$? status - title "Setting console screen font." - if [ -L /etc/default.vcfont ] ; then - fontfile=$(ls -l /etc/default.vcfont | sed 's,.* -> ,,') + if [ -e /etc/default.vcfont ] ; then + title "Setting console screen font." + fontfile=$( readlink -f /etc/default.vcfont ) setfont $fontfile || error=$? - elif [ -f /etc/default.vcfont ] ; then - setfont /etc/default.vcfont || error=$? - else - echo "No /etc/default.vcfont found." + status fi - status title "Setting console terminal type and blank interval." con_term=linux; con_blank=0 @@ -156,15 +141,17 @@ case "$1" in sysctl -w kernel.overflowgid=$(id -g nobody) > /dev/null || error=$? status - title "Reading /etc/sysctl.conf file." - sysctl -p || error=$? - status + if [ -e /etc/sysctl.conf ] ; then + title "Reading /etc/sysctl.conf file." + sysctl -p || error=$? + status + fi - title "Initializing kernel random number generator." if [ -e /var/state/random-seed ] ; then + title "Initializing kernel random number generator." cat /var/state/random-seed >/dev/urandom || error=$? + status fi - status title "Setting mixer devices Master and PCM to 65%." /usr/bin/amixer sset PCM 20 >/dev/null 2>&1 || error=$? @@ -172,23 +159,17 @@ case "$1" in /usr/bin/amixer sset Master 20 >/dev/null 2>&1 || error=$? /usr/bin/amixer sset Master unmute >/dev/null 2>&1 || error=$? status + ;; stop) - title "Saving /var/log/init.msg and /var/log/boot.msg." - touch /var/log/init.msg /var/log/boot.msg || error=$? - mv /var/log/init.msg /var/log/init.old || error=$? - mv /var/log/boot.msg /var/log/boot.old || error=$? - status - - title "Writing a wtmp record." - if [ "$RUNLEVEL" = 0 ] ; then halt -w || error=$? - else reboot -w || error=$? ; fi - status - - title "Saving kernel random seed." - dd if=/dev/urandom of=/var/state/random-seed count=1 2> /dev/null - status + title "Unconfiguring hardware by de-activating hotplug." + for RC in /etc/hotplug/*.rc; do + echo -n "[$( basename ${RC%.rc} )] " + $RC stop || error=$?; + done ; echo + rm -f /var/lock/subsys/hotplug + status title "Sending all processes a SIGTERM (15)." killall5 -15 || error=$? ; sleep 5 @@ -220,6 +201,7 @@ case "$1" in mount -o remount,sync $dir mount -o remount,ro $dir umount -d $dir + bash done status @@ -247,8 +229,9 @@ case "$1" in ;; *) - echo "Usage: $0 { start | stop }" - exit 1 ;; + echo "Usage: $0 { start | stop | restart }" + exit 1 + ;; esac diff --git a/target/livecd/linuxrc.c b/target/livecd/linuxrc.c index fa5f34126..5685400f4 100644 --- a/target/livecd/linuxrc.c +++ b/target/livecd/linuxrc.c @@ -56,6 +56,7 @@ char mod_dir[255]; char mod_suffix[3]; int mod_suffix_len=0; int do_debug=0; +char init2[32] = "/sbin/init"; void debug(int line, const char* format, ...) { @@ -140,15 +141,15 @@ int loop_mount(const char *device, const char* file) void doboot() { - DEBUG("doboot starting..."); - if ( access("/sbin/init", R_OK) ) { perror("Can't find /sbin/init"); } + DEBUG("doboot starting - trying to exec %s",init2); + if ( access(init2, R_OK) ) { perror("Can't access 2nd stage init"); } else { - /* not sure why, but i get 'bad address' if i don't wait a bit here... */ + /* i get 'bad address' if i don't wait a bit here... */ sleep(1); - execlp("/sbin/init","init",NULL); - perror("execlp /sbin/init failed"); + execlp(init2,init2,NULL); + perror("execlp init2 failed"); } - DEBUG("doboot returning - bad!"); + DEBUG("doboot returning - oops!"); } int trymount (const char* source, const char* target) @@ -442,11 +443,13 @@ int main(int argc, char** argv) { int args; + if(getenv("stage2init") != NULL) + snprintf(init2, 31, "%s", getenv("stage2init")); + if (argc > 1) { - do_debug = 1; - DEBUG("got an argument, switching debug mode on!"); - for(args=1; args ../isofs_arch.txt <<- EOT diff --git a/target/livecd/x86/help0.txt b/target/livecd/x86/help0.txt index e7c1b20c5..858273568 100644 --- a/target/livecd/x86/help0.txt +++ b/target/livecd/x86/help0.txt @@ -5,7 +5,7 @@ |_| \_\ ___/ \___|_|\_\ |____|_|_| |_|\___/|_/\_| [============> http://www.rocklinux.org/ <============] | L I V E CD | - +-------------+ + +-------------+ [F1=Overview] [F2=Options] Actions: -------- diff --git a/target/livecd/x86/help1.txt b/target/livecd/x86/help1.txt new file mode 100644 index 000000000..d9fe6506e --- /dev/null +++ b/target/livecd/x86/help1.txt @@ -0,0 +1,15 @@ + ____ ___ ___ _ __ _ + | _ \ / _ \ / __| |/ / | | _ _ __ _ _ _ _ + | . _/| | | | | | '_/ | | |_| '_ \| | | | \/ | + | |\ \| |_| | |__| . \ | |__| | | | | `_' |> < + |_| \_\ ___/ \___|_|\_\ |____|_|_| |_|\___/|_/\_| + [============> http://www.rocklinux.org/ <============] + | L I V E CD | + +-------------+ [F1=Overview] [F2=Options] + +Options: +-------- + +linuxrc_debug enable debug output from linuxrc and kernel +stage2init= the program to exec after linuxrc finished + diff --git a/target/livecd/x86/isolinux.cfg b/target/livecd/x86/isolinux.cfg index 0b891b8a4..59bf309d1 100644 --- a/target/livecd/x86/isolinux.cfg +++ b/target/livecd/x86/isolinux.cfg @@ -4,6 +4,8 @@ TIMEOUT 600 PROMPT 1 DISPLAY help0.txt +F1 help0.txt +F2 help1.txt LABEL livecd kernel vmlinuz