From 2be68b21befa4e3a0c966370e9ba1ce6daf2ba79 Mon Sep 17 00:00:00 2001 From: Rene Rebe Date: Mon, 18 Aug 2003 16:08:35 +0000 Subject: [PATCH] added an options to include a kiss shell into the bootdisk initrd (useful for expert use and debugging ...) git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@1105 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- target/bootdisk/build_stage1.sh | 19 +++++++------------ target/bootdisk/config.hlp | 6 ++++++ target/bootdisk/config.in | 10 +++++++--- target/bootdisk/linuxrc.c | 19 +++++++++++++++++-- 4 files changed, 37 insertions(+), 17 deletions(-) create mode 100644 target/bootdisk/config.hlp diff --git a/target/bootdisk/build_stage1.sh b/target/bootdisk/build_stage1.sh index e456f3102..e048aedaa 100644 --- a/target/bootdisk/build_stage1.sh +++ b/target/bootdisk/build_stage1.sh @@ -9,13 +9,7 @@ diet $CC $base/target/$target/linuxrc.c -Wall \ -DSTAGE_2_BIG_IMAGE="\"${ROCKCFG_SHORTID}/2nd_stage.tar.gz\"" \ -DSTAGE_2_SMALL_IMAGE="\"${ROCKCFG_SHORTID}/2nd_stage_small.tar.gz\"" \ -o linuxrc # > $disksdir/tmp 2>&1 -# I always prefer to see the output ! -# Only print this output if it's not the usual dietlibc junk -#x="$( sed 's,^[^:]*: ,~~: ,' < $disksdir/tmp | md5sum | cut -f1 -d' ' )" -#if [ "$x" != "0ede96ab34b5572403579dfb48ebe10c" ] ; then -# cat $disksdir/tmp ; echo "[ $x ]" -#fi ; rm -f $disksdir/tmp - +# echo_status "Copy various helper applications." cp ../2nd_stage/bin/{tar,gzip} bin/ cp ../2nd_stage/sbin/{ip,hwscan} bin/ @@ -49,11 +43,12 @@ done rm -f lib/modules/[0-9]*/kernel/drivers/scsi/{st,scsi_debug}.o rm -f lib/modules/[0-9]*/kernel/drivers/net/{dummy,ppp*}.o # -if [ "$ROCK_DEBUG_BOOTDISK_USEKISS" = 1 ]; then - echo_status "Using kiss shell for debugging initrd image." - cp /bin/kiss bin/; mv linuxrc bin/; ln -s bin/kiss linuxrc - rm -f lib/modules/[0-9]*/kernel/drivers/net/{dgrx,acenic}.o - rm -f lib/modules/[0-9]*/kernel/drivers/scsi/{advansys,qla1280}.o +if [ "$ROCKCFG_BOOTDISK_USEKISS" = 1 ]; then + echo_status "Adding kiss shell for expert use of the initrd image." + cp $root/bin/kiss bin/ + #mv linuxrc bin/; ln -s bin/kiss linuxrc + #rm -f lib/modules/[0-9]*/kernel/drivers/net/{dgrx,acenic}.o + #rm -f lib/modules/[0-9]*/kernel/drivers/scsi/{advansys,qla1280}.o fi cd .. diff --git a/target/bootdisk/config.hlp b/target/bootdisk/config.hlp new file mode 100644 index 000000000..10d8a2a1f --- /dev/null +++ b/target/bootdisk/config.hlp @@ -0,0 +1,6 @@ + +ROCKCFG_BOOTDISK_USEKISS + If this options is enabled the kiss shell is installed into the first + stage initrd of the bootdisk. This is helpful for unusal installations + and debugging. + diff --git a/target/bootdisk/config.in b/target/bootdisk/config.in index 7a6cbc606..698abc797 100644 --- a/target/bootdisk/config.in +++ b/target/bootdisk/config.in @@ -20,6 +20,8 @@ # # --- ROCK-COPYRIGHT-NOTE-END --- +bool 'Include the kiss shell into the initrd' ROCKCFG_BOOTDISK_USEKISS 1 + pkgfilter sed ' # Select some packages explicitely (base) @@ -50,9 +52,10 @@ pkgfilter sed ' / base / ! { s/^X /O /p; d; }; /^. -----/ { s/^X /O /p; d; }; # Disable even more packages we do not need -/ gcc2 / { s/^X /O /p; d; }; / joe / { s/^X /O /p; d; }; / gdbm / { s/^X /O /p; d; }; -/ kiss / { s/^X /O /p; d; }; / pdksh / { s/^X /O /p; d; }; / libelf / { s/^X /O /p; d; }; -/ prelink / { s/^X /O /p; d; }; / ccache / { s/^X /O /p; d; }; / pam / { s/^X /O /p; d; }; +/ gcc2 / { s/^X /O /p; d; }; / joe / { s/^X /O /p; d; }; +/ gdbm / { s/^X /O /p; d; }; / pam / { s/^X /O /p; d; }; +/ pdksh / { s/^X /O /p; d; }; / libelf / { s/^X /O /p; d; }; +/ prelink / { s/^X /O /p; d; }; / ccache / { s/^X /O /p; d; }; / cracklib / { s/^X /O /p; d; }; / hotplug / { s/^X /O /p; d; };' ROCKCFGSET_CREATE_TARBZ2=1 @@ -64,6 +67,7 @@ ROCKCFGSET_DIETLIBC_DYN=0 ROCKCFGSET_DIETLIBC_ALL=0 ROCKCFGSET_DIETLIBC_modutils=1 ROCKCFGSET_DIETLIBC_module_init_tools=1 +ROCKCFGSET_DIETLIBC_kiss=1 ROCKCFGSET_DIETLIBC_tar=1 ROCKCFGSET_DIETLIBC_gzip=1 ROCKCFGSET_DIETLIBC_wget=1 diff --git a/target/bootdisk/linuxrc.c b/target/bootdisk/linuxrc.c index 495f41487..3e49843f1 100644 --- a/target/bootdisk/linuxrc.c +++ b/target/bootdisk/linuxrc.c @@ -130,7 +130,7 @@ void httpload() if ( mount("none", "/mnt_root", "tmpfs", 0, TMPFS_OPTIONS) ) { perror("Can't mount /mnt_root"); exit_linuxrc=0; } - if (pipe(fd) <0) + if ( pipe(fd) < 0 ) { perror("Can't create pipe"); exit_linuxrc=0; } if ( fork() == 0 ) { @@ -454,6 +454,16 @@ void autoload_modules() wait(NULL); } +void exec_sh() +{ + if ( fork() == 0 ) { + execl("/bin/kiss", "kiss", NULL); + perror("kiss"); + _exit(1); + } + wait(NULL); +} + int main() { char text[100]; @@ -491,8 +501,9 @@ drivers (if needed) and configure the installation source so the\n\ 4. Load kernel SCSI modules from this disk\n\ 5. Load kernel modules from another disk\n\ 6. Activate already formatted swap device\n\ + 7. Execute a (kiss) shell if present (for experts!)\n\ \n\ -What do you want to do [0-6] (default=0)? "); +What do you want to do [0-7] (default=0)? "); fflush(stdout); text[0]=0; fgets(text, 100, stdin); text[99]=0; @@ -540,6 +551,10 @@ What do you want to do [0-6] (default=0)? "); activate_swap(); break; + case 7: + exec_sh(); + break; + default: perror ("No such option present!"); }