From e19ff6355436b7cb1b1cb231fb3d5a222f18dee8 Mon Sep 17 00:00:00 2001 From: Dimitar Zhekov Date: Tue, 23 Dec 2003 02:12:33 +0000 Subject: [PATCH] Dimitar Zhekov : stage2small-progs.diff: include disktype _and tail_ (I somehow missed it in the previous patch) in stage 2 small. Incremential: apply after bzip2-ed-bootdisk only. linuxrc-opt.diff: optimize the device scanning a bit. git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@2047 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- Documentation/Developers/CHANGELOG-RENE | 2 ++ target/bootdisk/build_stage2.sh | 5 +--- target/bootdisk/head | 21 --------------- target/bootdisk/linuxrc.c | 35 ++++++++----------------- 4 files changed, 14 insertions(+), 49 deletions(-) delete mode 100644 target/bootdisk/head diff --git a/Documentation/Developers/CHANGELOG-RENE b/Documentation/Developers/CHANGELOG-RENE index 5caec5e52..2bd6aac66 100644 --- a/Documentation/Developers/CHANGELOG-RENE +++ b/Documentation/Developers/CHANGELOG-RENE @@ -9,6 +9,8 @@ - Alan J. Wylie: updated spamassassin and clamav - Dimitar Zhekov: workaround for memtest86 to avoid gcc-33 if possible updated mplayer + the real tail/head and disktype for the small 2nd_stage + space optimisations for the linuxrc *) 2003-12-21 (2.0.0-rc3 - 2.0.0-rc4) diff --git a/target/bootdisk/build_stage2.sh b/target/bootdisk/build_stage2.sh index 91b60899f..9a0be5fa9 100644 --- a/target/bootdisk/build_stage2.sh +++ b/target/bootdisk/build_stage2.sh @@ -104,7 +104,7 @@ ln -s bin sbin ; ln -s . usr progs="agetty bash cat cp date dd df ifconfig ln ls mine mkdir mke2fs \ mkswap mount mv rm reboot route sleep swapoff swapon sync umount \ eject chmod chroot grep halt rmdir sh shutdown uname killall5 \ - stone mktemp sort fold sed mkreiserfs cut" + stone mktemp sort fold sed mkreiserfs cut head tail disktype" progs="$progs fdisk sfdisk" @@ -157,9 +157,6 @@ for i in gui_text mod_install mod_packages mod_gas default ; do cp -v ../2nd_stage/etc/stone.d/$i.sh etc/stone.d done # -echo_status "Copy head replacement script." -cp $base/target/$target/head bin/head ; chmod +x bin/head -# echo_status "Creating links for identical files." while read ck fn do diff --git a/target/bootdisk/head b/target/bootdisk/head deleted file mode 100644 index f08a35ba3..000000000 --- a/target/bootdisk/head +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -m=10 - -useage () { - echo "Usage: head [OPTION]... [FILE]..." - echo -e "\t-n,-[0-9]+\tprint first NUMBER lines instead of first 10" - exit 1 -} - -while [ "$1" ] ; do - case "$1" in - -n) m="$2" ; shift ; shift ;; - -[0-9]*) m=${1#-}; shift ;; - -*) useage ;; - *) break; - esac -done - -exec grep -m$m "" $* - diff --git a/target/bootdisk/linuxrc.c b/target/bootdisk/linuxrc.c index 9530862a6..45cb979fb 100644 --- a/target/bootdisk/linuxrc.c +++ b/target/bootdisk/linuxrc.c @@ -218,42 +218,29 @@ void load_modules(char * dir) void load_ramdisk_file() { + char *devicelists[2] = { "/dev/cdroms/cdrom%d", "/dev/floppy/%d" }; + char *devicenames[2] = + { "CD-ROM #%d (IDE/ATAPI or SCSI)", "FDD (Floppy Disk Drive) #%d" }; char *devn[10], *desc[10]; char text[100], devicefile[100]; char filename[100]; int nr=0; - int tmp_nr; - int found; + int i, tmp_nr; printf("Select a device for loading the 2nd stage system from: \n\n"); - - for (tmp_nr = 0, found = 1; found; ++tmp_nr) { - sprintf(devicefile, "/dev/cdroms/cdrom%d", tmp_nr); - sprintf(text, "CD-ROM #%d (IDE/ATAPI or SCSI)", tmp_nr+1); - - if ( ! access (devicefile, R_OK) ) { - desc[nr] = strdup (text); - devn[nr++] = strdup (devicefile); - } - else { - found = 0; - } - } - tmp_nr = 0; found = 1; - for (tmp_nr = 0, found = 1; found; ++tmp_nr) { - sprintf(devicefile, "/dev/floppy/%d", tmp_nr); - sprintf(text, "FDD (Floppy Disk Drive) #%d", tmp_nr+1); + for (i = 0; i < 2; i++) { + for (tmp_nr = 0; ; ++tmp_nr) { + sprintf(devicefile, devicelists[i], tmp_nr); + sprintf(text, devicenames[i], tmp_nr+1); - if ( ! access (devicefile, R_OK) ) { + if ( access (devicefile, R_OK) ) break; + desc[nr] = strdup (text); devn[nr++] = strdup (devicefile); } - else { - found = 0; - } } - + desc[nr] = devn[nr] = NULL; for (nr=0; desc[nr]; nr++) {