From: Tim Yamin Date: Wed, 13 Jul 2005 21:17:01 +0000 (+0000) Subject: Fix #97672, #98886, #98893, #98897; fix real_root=/dev/mdX: upgraded busybox to 1... X-Git-Tag: v3.4.10.902~496 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9a390bca984158073acbd2625c44ebff86a53e5a;p=genkernel.git Fix #97672, #98886, #98893, #98897; fix real_root=/dev/mdX: upgraded busybox to 1.00, porting in my read -t and mdstart patches. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@256 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- diff --git a/alpha/busy-config b/alpha/busy-config index e3c1bb9..31f837b 100644 --- a/alpha/busy-config +++ b/alpha/busy-config @@ -158,7 +158,7 @@ CONFIG_FEATURE_HUMAN_READABLE=y # # Console Utilities # -# CONFIG_CHVT is not set +CONFIG_CHVT=y CONFIG_CLEAR=y # CONFIG_DEALLOCVT is not set CONFIG_DUMPKMAP=y @@ -372,6 +372,7 @@ CONFIG_FREERAMDISK=y # CONFIG_HEXDUMP is not set # CONFIG_HWCLOCK is not set CONFIG_LOSETUP=y +CONFIG_MDSTART=y # CONFIG_MKSWAP is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y diff --git a/gen_bootloader.sh b/gen_bootloader.sh index 74b6621..54741e3 100644 --- a/gen_bootloader.sh +++ b/gen_bootloader.sh @@ -23,31 +23,17 @@ set_grub_bootloader() { [ "x$GRUB_BOOTFS" == 'x' ] && GRUB_BOOTFS=$GRUB_ROOTFS # Read GRUB device map - echo ${tmp} - if [ ! -d ${tmp} ] - then - mkdir ${tmp} - fi - + [ ! -d ${tmp} ] && mkdir ${tmp} grub --batch --device-map=${tmp}/grub.map </dev/null quit EOF # Get the GRUB mapping for our device local GRUB_BOOT_DISK1=$(echo $GRUB_BOOTFS | sed -e 's#\(/dev/.\+\)[[:digit:]]\+#\1#') - echo ${GRUB_BOOT_DISK1} local GRUB_BOOT_DISK=$(awk '{if ($2 == "'$GRUB_BOOT_DISK1'") {gsub(/(\(|\))/, "", $1); print $1;}}' ${tmp}/grub.map) local GRUB_BOOT_PARTITION=$(echo $GRUB_BOOTFS | sed -e 's#/dev/.\+\([[:digit:]]\+\)#\1#') - if [ ! -d ${tmp} ] - then - rm -r ${tmp} - fi - echo ${GRUB_ROOTFS} - - echo ${GRUB_BOOTFS} - echo ${GRUB_BOOT_DISK} - echo ${GRUB_BOOT_PARTITION} + [ ! -d ${tmp} ] && rm -r ${tmp} # Create grub configuration directory and file if it doesn't exist. [ ! -e `basename $GRUB_CONF` ] && mkdir -p `basename $GRUB_CONF` @@ -71,25 +57,33 @@ EOF echo -e "\troot ($GRUB_BOOT_DISK,$GRUB_BOOT_PARTITION)" >> $GRUB_CONF if [ "${BUILD_INITRD}" -eq '0' ] then - echo -e "\tkernel /kernel-$KV root=$GRUB_ROOTFS" >> $GRUB_CONF + echo -e "\tkernel /kernel-${KNAME}-${ARCH}-${KV} root=$GRUB_ROOTFS" >> $GRUB_CONF else - echo -e "\tkernel /kernel-$KV root=/dev/ram0 init=/linuxrc real_root=$GRUB_ROOTFS" >> $GRUB_CONF - echo -e "\tinitrd /initrd-$KV" >> $GRUB_CONF + echo -e "\tkernel /kernel-${KNAME}-${ARCH}-${KV} root=/dev/ram0 init=/linuxrc real_root=$GRUB_ROOTFS" >> $GRUB_CONF + if [ "${PAT}" -gt '4' -a "${CMD_BOOTSPLASH}" != '1' ] + then + echo -e "\tinitrd /initramfs-${KNAME}-${ARCH}-${KV}" >> $GRUB_CONF + else + echo -e "\tinitrd /initrd-${KNAME}-${ARCH}-${KV}" >> $GRUB_CONF + fi fi echo >> $GRUB_CONF fi else # grub.conf already exists; so... # ... Clone the first boot definition and change the version. + local TYPE + [ "${KERN_24}" -eq '1' ] && TYPE='rd' || TYPE='ramfs' + cp $GRUB_CONF $GRUB_CONF.bak awk 'BEGIN { RS="" ; FS="\n" ; OFS="\n" ; ORS="\n\n" } NR == 2 { ORIG=$0; sub(/\(.+\)/,"(" KV ")",$1); - sub(/kernel-[[:alnum:][:punct:]]+/, "kernel-" KV, $3); - sub(/initrd-[[:alnum:][:punct:]]+/, "initrd-" KV, $4); + sub(/kernel-[[:alnum:][:punct:]]+/, "kernel-" KNAME "-" ARCH "-" KV, $3); + sub(/initr(d|amfs)-[[:alnum:][:punct:]]+/, "init" TYPE "-" KNAME "-" ARCH "-" KV, $4); print RS $0; print RS ORIG;} - NR != 2 { print RS $0; }' KV=$KV $GRUB_CONF.bak > $GRUB_CONF + NR != 2 { print RS $0; }' KNAME=$KNAME ARCH=$ARCH KV=$KV TYPE=$TYPE $GRUB_CONF.bak > $GRUB_CONF fi } diff --git a/gen_compile.sh b/gen_compile.sh index 9b51053..3251e54 100644 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -192,7 +192,7 @@ clean_dietlibc_bincache() { compile_dep() { # Only run ``make dep'' for 2.4 kernels - if [ "${VER}" -eq '2' -a "${PAT}" -le '4' ] + if [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ] then print_info 1 "kernel: >> Making dependencies..." cd ${KERNEL_DIR} @@ -206,14 +206,14 @@ compile_modules() { compile_generic modules kernel export UNAME_MACHINE="${ARCH}" # On 2.4 kernels, if MAKEOPTS > -j1 it can cause failures - if [ "${VER}" -eq '2' -a "${PAT}" -le '4' ] + if [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ] then MAKEOPTS_SAVE="${MAKEOPTS}" MAKEOPTS="${MAKEOPTS_SAVE/-j?/-j1}" fi [ "${INSTALL_MOD_PATH}" != '' ] && export INSTALL_MOD_PATH compile_generic "modules_install" kernel - [ "${VER}" -eq '2' -a "${PAT}" -le '4' ] && MAKEOPTS="${MAKEOPTS_SAVE}" + [ "${VER}" -eq '2' -a "${KERN_24}" -eq '1' ] && MAKEOPTS="${MAKEOPTS_SAVE}" export MAKEOPTS unset UNAME_MACHINE } diff --git a/gen_configkernel.sh b/gen_configkernel.sh index 929169d..19139b3 100644 --- a/gen_configkernel.sh +++ b/gen_configkernel.sh @@ -95,8 +95,8 @@ config_kernel() { # Force this on if we are a 2.4 kernel or less # Force this on if we are using bootsplash # This is required for initrd support - # Initramfs dont require this - if [ "${PAT}" -le '4' -o "${CMD_BOOTSPLASH}" = '1' ] + # Initramfs doesn't require this + if [ "${KERN_24}" -eq '1' -o "${CMD_BOOTSPLASH}" = '1' ] then # Make sure Ext2 support is on... sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_EXT2_FS[ =].*/CONFIG_EXT2_FS=y/g' diff --git a/gen_determineargs.sh b/gen_determineargs.sh index 58628bb..1ccf862 100644 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -14,11 +14,12 @@ get_KV() { PAT=`grep ^PATCHLEVEL\ \= ${tmp}/kerncache.config | awk '{ print $3 };'` SUB=`grep ^SUBLEVEL\ \= ${tmp}/kerncache.config | awk '{ print $3 };'` EXV=`grep ^EXTRAVERSION\ \= ${tmp}/kerncache.config | sed -e "s/EXTRAVERSION =//" -e "s/ //g"` - if [ "${PAT}" -gt '4' ] + if [ "${PAT}" -gt '4' -a "${VER}" -ge '2' ] then LOV=`grep ^CONFIG_LOCALVERSION\= ${tmp}/kerncache.config | sed -e "s/CONFIG_LOCALVERSION=\"\(.*\)\"/\1/"` KV=${VER}.${PAT}.${SUB}${EXV}${LOV} else + KERN_24=1 KV=${VER}.${PAT}.${SUB}${EXV} fi @@ -30,16 +31,17 @@ get_KV() { rm -r ${tmp} else - #configure the kernel - #if BUILD_KERNEL=0 then assume --no-clean, menuconfig is cleared, + # Configure the kernel + # If BUILD_KERNEL=0 then assume --no-clean, menuconfig is cleared + VER=`grep ^VERSION\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'` PAT=`grep ^PATCHLEVEL\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'` SUB=`grep ^SUBLEVEL\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'` EXV=`grep ^EXTRAVERSION\ \= ${KERNEL_DIR}/Makefile | sed -e "s/EXTRAVERSION =//" -e "s/ //g"` - if [ "${PAT}" -gt '4' -a -e ${KERNEL_DIR}/.config ] + if [ "${PAT}" -gt '4' -a "${VER}" -ge '2' -a -e ${KERNEL_DIR}/.config ] then cd ${KERNEL_DIR} - #compile_generic prepare kernel > /dev/null 2>&1 + compile_generic prepare kernel > /dev/null 2>&1 cd - > /dev/null 2>&1 if [ -f ${KERNEL_DIR}/include/linux/version.h ] then @@ -47,9 +49,11 @@ get_KV() { LOV=`echo ${UTS_RELEASE}|sed -e "s/${VER}.${PAT}.${SUB}${EXV}//"` KV=${VER}.${PAT}.${SUB}${EXV}${LOV} else - KV=${VER}.${PAT}.${SUB}${EXV} + LCV=`grep ^CONFIG_LOCALVERSION= ${KERNEL_DIR}/.config | sed -r -e "s/.*=\"(.*)\"/\1/"` + KV=${VER}.${PAT}.${SUB}${EXV}${LCV} fi else + KERN_24=1 KV=${VER}.${PAT}.${SUB}${EXV} fi diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 389ee18..d6f4d81 100644 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -250,6 +250,13 @@ create_evms2_cpio(){ cp -a /lib/evms/* "${TEMP}/initramfs-evms2-temp/lib/evms" || gen_die 'Could not copy files for EVMS2!' cp -a /etc/evms.conf "${TEMP}/initramfs-evms2-temp/etc" || gen_die 'Could not copy files for EVMS2!' cp /sbin/evms_activate "${TEMP}/initramfs-evms2-temp/bin/evms_activate" || gen_die 'Could not copy over vgscan!' + + # Fix EVMS2 complaining that it can't find the swap utilities. + # These are not required in the initramfs + for swap_libs in "${TEMP}/initramfs-evms2-temp/lib/evms/*swap*.so" + do + rm ${swap_libs} + done fi cd "${TEMP}/initramfs-evms2-temp/" find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_DIR}/cpio/initramfs-evms2.cpio.gz diff --git a/gen_package.sh b/gen_package.sh index 1fcf528..70e2e9a 100644 --- a/gen_package.sh +++ b/gen_package.sh @@ -14,7 +14,7 @@ gen_minkernpackage() cp "${KERNEL_BINARY}" "${TEMP}/minkernpackage/kernel-${KV}" || gen_die 'Could not the copy kernel for the min kernel package!' cp ".config" "${TEMP}/minkernpackage/config-${ARCH}-${KV}" || gen_die 'Could not the copy kernel config for the min kernel package!' fi - if [ "${PAT}" -gt '4' -a "${CMD_BOOTSPLASH}" != '1' ] + if [ "${KERN_24}" != '1' -a "${CMD_BOOTSPLASH}" != '1' ] then [ "${BUILD_INITRD}" -ne 0 ] && { cp "${TEMP}/initramfs-${KV}" "${TEMP}/minkernpackage/initramfs-${ARCH}-${KV}" || gen_die 'Could not copy the initramfs for the kernel package!'; } else diff --git a/generic/initrd.scripts b/generic/initrd.scripts index 228fc01..ff4f301 100644 --- a/generic/initrd.scripts +++ b/generic/initrd.scripts @@ -240,13 +240,13 @@ good_msg() { bad_msg() { msg_string=$1 msg_string="${msg_string:-...}" - echo -e "${BAD}!! ${NORMAL}${BOLD} ${msg_string} ${NORMAL}" + echo -e "${BAD}!!${NORMAL}${BOLD} ${msg_string} ${NORMAL}" } warn_msg() { msg_string=$1 msg_string="${msg_string:-...}" - echo -e "${WARN}** ${NORMAL}${BOLD} ${msg_string} ${NORMAL}" + echo -e "${WARN}**${NORMAL}${BOLD} ${msg_string} ${NORMAL}" } bind_mount_dev() { @@ -504,29 +504,22 @@ cdupdate() { run_shell fi else - good_msg "no cdupdate.sh script found .... skipping" + good_msg 'No cdupdate.sh script found, skipping...' fi fi } -setup_md_device(){ - MAJOR=9 - +setup_md_device() { if [ `echo ${REAL_ROOT}|sed -e 's#\(/dev/md\)[[:digit:]]\+#\1#'` = "/dev/md" ] then - good_msg "real_root is a md device. Setting up the device node (If necessary) ..." - MD_NUMBER=`echo ${REAL_ROOT}|sed -e 's#/dev/md\([[:digit:]]\+\)#\1#'` - if [ ! -e /dev/md${MD_NUMBER} ] - then - mknod /dev/md${MD_NUMBER} b ${MAJOR} ${MD_NUMBER} >/dev/null 2>&1 - ret=$? - if [ "${ret}" -ne 0 ] - then - bad_msg "Creation of /dev/md${MD_NUMBER} failed... " - else - good_msg "Creation of /dev/md${MD_NUMBER} Succeeded... " - fi + good_msg 'Detected real_root as a md device. Setting up the device node...' + MD_NUMBER=`echo ${REAL_ROOT}|sed -e 's#/dev/md\([[:digit:]]\+\)#\1#'` + if [ ! -e /dev/md${MD_NUMBER} ] + then + mknod /dev/md${MD_NUMBER} b 9 ${MD_NUMBER} >/dev/null 2>&1 + [ "$?" -ne 0 ] && bad_msg "Creation of /dev/md${MD_NUMBER} failed..." fi + mdstart ${MDPART} /dev/md${MD_NUMBER} fi } diff --git a/generic/linuxrc b/generic/linuxrc index 59fdff6..a6861ee 100644 --- a/generic/linuxrc +++ b/generic/linuxrc @@ -144,6 +144,11 @@ do CONSOLE=`parse_opt "${x}"` exec >${CONSOLE} <${CONSOLE} 2>&1 ;; + + # /dev/md + part\=*) + MDPART=`parse_opt "${x}"` + ;; esac done diff --git a/genkernel b/genkernel index 529d59c..eb2cee3 100755 --- a/genkernel +++ b/genkernel @@ -2,7 +2,7 @@ # Genkernel v3 PATH="/bin:/usr/bin:/sbin:/usr/sbin" -GK_V='3.2.2' +GK_V='3.2.3' TEMP='/var/tmp/genkernel' TODEBUGCACHE=1 # Until an error occurs or DEBUGFILE is fully qualified. @@ -259,7 +259,7 @@ then # Only compile insmod if we're installing modules onto the initrd if [ "${NOINITRDMODULES}" = '' ] then - if [ "${PAT}" -gt '4' ] + if [ "${KERN_24}" != '1' ] then # Compile module-init-tools compile_module_init_tools @@ -270,7 +270,7 @@ then [ "${DISKLABEL}" -eq '1' ] && compile_e2fsprogs - if [ "${PAT}" -gt '4' -a "${UDEV}" -eq '1' ] + if [ "${KERN_24}" != '1' -a "${UDEV}" -eq '1' ] then compile_udev else @@ -279,7 +279,7 @@ then compile_devfsd fi - if [ "${PAT}" -gt '4' -a "${CMD_BOOTSPLASH}" != '1' ] + if [ "${KERN_24}" != '1' -a "${CMD_BOOTSPLASH}" != '1' ] then if [ "${BUSYBOX}" -eq '1' ] then @@ -325,7 +325,7 @@ then print_info 1 '' print_info 1 ' Where $ROOT is the device node for your root partition as the' print_info 1 ' one specified in /etc/fstab' - elif [ "${PAT}" -gt '4' -a "${CMD_BOOTSPLASH}" != '1' ] + elif [ "${KERN_24}" != '1' -a "${CMD_BOOTSPLASH}" != '1' ] then print_info 1 ' real_root=/dev/$ROOT' print_info 1 ' [ And "vga=0x317 splash=verbose" if you use a framebuffer ]' @@ -356,7 +356,7 @@ then fi else print_info 1 '' - if [ "${PAT}" -gt '4' -a "${CMD_BOOTSPLASH}" != '1' ] + if [ "${KERN_24}" != '1' -a "${CMD_BOOTSPLASH}" != '1' ] then print_info 1 'initramfs compiled successfully!' else @@ -379,7 +379,7 @@ then [ ${ret} = '1' ] && print_error 1 'kernel link failed' fi - if [ "${PAT}" -gt '4' -a "${CMD_BOOTSPLASH}" != '1' ] + if [ "${KERN_24}" != '1' -a "${CMD_BOOTSPLASH}" != '1' ] then print_info 1 ' creating initramfs name symlink!' if [ -e /boot/initramfs-${KNAME}-${ARCH}-${KV} ] diff --git a/genkernel.conf b/genkernel.conf index f450f0e..d45259c 100755 --- a/genkernel.conf +++ b/genkernel.conf @@ -59,7 +59,7 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux" # Configuration file for busybox BUSYBOX_CONFIG="${GK_SHARE}/%%ARCH%%/busy-config" # BusyBox Version -BUSYBOX_VER="1.00-pre7-losetup-crypto-alpha" +BUSYBOX_VER="1.00-rt-mdstart.plasmaroo" # Busybox bin-cache location, to store pre-compiled busybox # binary is just a bzip2 busybox executable BUSYBOX_BINCACHE="%%CACHE%%/busybox-${BUSYBOX_VER}-%%ARCH%%.bz2" diff --git a/ia64/busy-config b/ia64/busy-config index e3c1bb9..31f837b 100644 --- a/ia64/busy-config +++ b/ia64/busy-config @@ -158,7 +158,7 @@ CONFIG_FEATURE_HUMAN_READABLE=y # # Console Utilities # -# CONFIG_CHVT is not set +CONFIG_CHVT=y CONFIG_CLEAR=y # CONFIG_DEALLOCVT is not set CONFIG_DUMPKMAP=y @@ -372,6 +372,7 @@ CONFIG_FREERAMDISK=y # CONFIG_HEXDUMP is not set # CONFIG_HWCLOCK is not set CONFIG_LOSETUP=y +CONFIG_MDSTART=y # CONFIG_MKSWAP is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y diff --git a/parisc/busy-config b/parisc/busy-config index e3c1bb9..31f837b 100644 --- a/parisc/busy-config +++ b/parisc/busy-config @@ -158,7 +158,7 @@ CONFIG_FEATURE_HUMAN_READABLE=y # # Console Utilities # -# CONFIG_CHVT is not set +CONFIG_CHVT=y CONFIG_CLEAR=y # CONFIG_DEALLOCVT is not set CONFIG_DUMPKMAP=y @@ -372,6 +372,7 @@ CONFIG_FREERAMDISK=y # CONFIG_HEXDUMP is not set # CONFIG_HWCLOCK is not set CONFIG_LOSETUP=y +CONFIG_MDSTART=y # CONFIG_MKSWAP is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y diff --git a/parisc64/busy-config b/parisc64/busy-config index e3c1bb9..31f837b 100644 --- a/parisc64/busy-config +++ b/parisc64/busy-config @@ -158,7 +158,7 @@ CONFIG_FEATURE_HUMAN_READABLE=y # # Console Utilities # -# CONFIG_CHVT is not set +CONFIG_CHVT=y CONFIG_CLEAR=y # CONFIG_DEALLOCVT is not set CONFIG_DUMPKMAP=y @@ -372,6 +372,7 @@ CONFIG_FREERAMDISK=y # CONFIG_HEXDUMP is not set # CONFIG_HWCLOCK is not set CONFIG_LOSETUP=y +CONFIG_MDSTART=y # CONFIG_MKSWAP is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y diff --git a/pkg/busybox-1.00-pre7-crypto-losetup-2.patch b/pkg/busybox-1.00-pre7-crypto-losetup-2.patch deleted file mode 100644 index 9b08286..0000000 --- a/pkg/busybox-1.00-pre7-crypto-losetup-2.patch +++ /dev/null @@ -1,385 +0,0 @@ -diff -ruN busybox-1.00-pre7/Makefile busybox-1.00-pre7.new/Makefile ---- busybox-1.00-pre7/Makefile 2003-11-17 11:26:43.000000000 +0100 -+++ busybox-1.00-pre7.new/Makefile 2004-02-17 03:10:43.975317464 +0100 -@@ -216,7 +216,7 @@ - docs/busybox.pdf docs/busybox.pod docs/busybox.net/busybox.html \ - docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \ - docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \ -- docs/busybox.net/BusyBox.html busybox.links libbb/loop.h \ -+ docs/busybox.net/BusyBox.html busybox.links \ - .config.old .hdepend busybox - - rm -rf _install - - find . -name .\*.flags -exec rm -f {} \; -diff -ruN busybox-1.00-pre7/include/libbb.h busybox-1.00-pre7.new/include/libbb.h ---- busybox-1.00-pre7/include/libbb.h 2004-01-17 06:03:30.000000000 +0100 -+++ busybox-1.00-pre7.new/include/libbb.h 2004-02-17 03:32:09.981814760 +0100 -@@ -232,7 +232,9 @@ - extern int device_open(const char *device, int mode); - - extern int del_loop(const char *device); --extern int set_loop(const char *device, const char *file, int offset, int *loopro); -+extern int set_loop(const char *device, const char *file, int offset, -+ const char *encnum, const char *encryption, -+ int pfd, int *loopro); - extern char *find_unused_loop_device (void); - - -diff -ruN busybox-1.00-pre7/libbb/Makefile.in busybox-1.00-pre7.new/libbb/Makefile.in ---- busybox-1.00-pre7/libbb/Makefile.in 2003-11-10 05:33:54.000000000 +0100 -+++ busybox-1.00-pre7.new/libbb/Makefile.in 2004-02-17 03:10:44.024310016 +0100 -@@ -98,7 +98,4 @@ - - $(LIBBB_DIR)loop.o: $(LIBBB_DIR)loop.h - --$(LIBBB_DIR)loop.h: $(LIBBB_DIR)mk_loop_h.sh -- @ $(SHELL) $< > $@ -- - -diff -ruN busybox-1.00-pre7/libbb/loop.c busybox-1.00-pre7.new/libbb/loop.c ---- busybox-1.00-pre7/libbb/loop.c 2003-07-14 23:20:55.000000000 +0200 -+++ busybox-1.00-pre7.new/libbb/loop.c 2004-02-17 03:24:49.817729872 +0100 -@@ -20,11 +20,14 @@ - */ - - #include -+#include -+#include - #include - #include - #include - #include - #include -+#include - #include "libbb.h" - #include "loop.h" /* Pull in loop device support */ - -@@ -45,11 +48,23 @@ - return (TRUE); - } - -+static int -+digits_only(const char *s) { -+ while (*s) -+ if (!isdigit(*s++)) -+ return 0; -+ return 1; -+} -+ - extern int set_loop(const char *device, const char *file, int offset, -- int *loopro) -+ const char *encnumber, -+ const char *encryption, -+ int pfd, int *loopro) - { -- struct loop_info loopinfo; -+// struct loop_info loopinfo; -+ struct loop_info64 loopinfo64; - int fd, ffd, mode; -+ char *pass; - - mode = *loopro ? O_RDONLY : O_RDWR; - if ((ffd = open(file, mode)) < 0 && !*loopro -@@ -64,19 +79,68 @@ - } - *loopro = (mode == O_RDONLY); - -- memset(&loopinfo, 0, sizeof(loopinfo)); -- safe_strncpy(loopinfo.lo_name, file, LO_NAME_SIZE); -- -- loopinfo.lo_offset = offset; -+ memset(&loopinfo64, 0, sizeof(loopinfo64)); -+ safe_strncpy(loopinfo64.lo_file_name, file, LO_NAME_SIZE); -+ -+ if (encryption && *encryption) { -+ if (digits_only(encryption)) { -+ loopinfo64.lo_encrypt_type = atoi(encryption); -+ } else { -+ char *mark=strrchr(encryption,'-'); -+ loopinfo64.lo_encrypt_type = LO_CRYPT_CRYPTOAPI; -+ if (mark && digits_only(mark+1)) -+ loopinfo64.lo_encrypt_key_size = -+ atoi(mark)/8; -+ else { -+ fprintf(stderr, -+ "You must specify a key size (in bits)" -+ "for use with CryptoAPI encryption.\n"); -+ return -1; -+ } -+ *mark='\0'; -+ snprintf(loopinfo64.lo_crypt_name, LO_NAME_SIZE, -+ "%s", encryption); -+ } -+ } -+ -+ if (encnumber && *encnumber) { -+ if (digits_only(encnumber)) -+ loopinfo64.lo_encrypt_type = atoi(encnumber); -+ } -+ -+ loopinfo64.lo_offset = offset; -+ -+ if (loopinfo64.lo_encrypt_type==LO_CRYPT_NONE) -+ loopinfo64.lo_encrypt_key_size = 0; -+ else { -+ if (pfd == -1) { -+ pass = getpass("Password: "); -+ safe_strncpy(loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE); -+ } else { -+ /* If we're reading from an extenral program, * -+ * odds are good that a SIGCHLD will interrupt * -+ * this read(), and ruin our whole day. So we * -+ * must block it. */ -+ sigset_t ss, oss; -+ sigemptyset(&ss); -+ sigaddset(&ss, SIGCHLD); -+ sigprocmask(SIG_BLOCK, &ss, &oss); -+ if (read(pfd, loopinfo64.lo_encrypt_key, -+ LO_KEY_SIZE) == -1) { -+ bb_perror_msg("read"); -+ fprintf(stderr, "Error reading encryption key, exiting\n"); -+ } -+ sigprocmask(SIG_SETMASK, &oss, NULL); -+ } -+ } - -- loopinfo.lo_encrypt_key_size = 0; - if (ioctl(fd, LOOP_SET_FD, ffd) < 0) { - bb_perror_msg("ioctl: LOOP_SET_FD"); - close(fd); - close(ffd); - return 1; - } -- if (ioctl(fd, LOOP_SET_STATUS, &loopinfo) < 0) { -+ if (ioctl(fd, LOOP_SET_STATUS64, &loopinfo64) < 0) { - (void) ioctl(fd, LOOP_CLR_FD, 0); - bb_perror_msg("ioctl: LOOP_SET_STATUS"); - close(fd); -diff -ruN busybox-1.00-pre7/libbb/loop.h busybox-1.00-pre7.new/libbb/loop.h ---- busybox-1.00-pre7/libbb/loop.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00-pre7.new/libbb/loop.h 2004-02-17 03:19:38.140112072 +0100 -@@ -0,0 +1,52 @@ -+#define LO_CRYPT_NONE 0 -+#define LO_CRYPT_XOR 1 -+#define LO_CRYPT_DES 2 -+#define LO_CRYPT_CRYPTOAPI 18 -+#define LO_CRYPT_COMPRESS 19 -+ -+#define LOOP_SET_FD 0x4C00 -+#define LOOP_CLR_FD 0x4C01 -+#define LOOP_SET_STATUS 0x4C02 -+#define LOOP_GET_STATUS 0x4C03 -+#define LOOP_SET_STATUS64 0x4C04 -+#define LOOP_GET_STATUS64 0x4C05 -+ -+#define LO_NAME_SIZE 64 -+#define LO_KEY_SIZE 32 -+ -+#include "my_dev_t.h" -+ -+struct loop_info { -+ int lo_number; -+ my_dev_t lo_device; -+ unsigned long lo_inode; -+ my_dev_t lo_rdevice; -+ int lo_offset; -+ int lo_encrypt_type; -+ int lo_encrypt_key_size; -+ int lo_flags; -+ char lo_name[LO_NAME_SIZE]; -+ unsigned char lo_encrypt_key[LO_KEY_SIZE]; -+ unsigned long lo_init[2]; -+ char reserved[4]; -+}; -+ -+/* -+ * Where to get __u8, __u32, __u64? Let us use unsigned char/int/long long -+ * and get punished when someone comes with 128-bit long longs. -+ */ -+struct loop_info64 { -+ unsigned long long lo_device; -+ unsigned long long lo_inode; -+ unsigned long long lo_rdevice; -+ unsigned long long lo_offset; -+ unsigned long long lo_sizelimit; /* bytes, 0 == max available */ -+ unsigned int lo_number; -+ unsigned int lo_encrypt_type; -+ unsigned int lo_encrypt_key_size; -+ unsigned int lo_flags; -+ unsigned char lo_file_name[LO_NAME_SIZE]; -+ unsigned char lo_crypt_name[LO_NAME_SIZE]; -+ unsigned char lo_encrypt_key[LO_KEY_SIZE]; -+ unsigned long long lo_init[2]; -+}; -diff -ruN busybox-1.00-pre7/libbb/mk_loop_h.sh busybox-1.00-pre7.new/libbb/mk_loop_h.sh ---- busybox-1.00-pre7/libbb/mk_loop_h.sh 2001-02-17 01:42:47.000000000 +0100 -+++ busybox-1.00-pre7.new/libbb/mk_loop_h.sh 1970-01-01 01:00:00.000000000 +0100 -@@ -1,37 +0,0 @@ --#!/bin/sh --# --# Figure out (i) the type of dev_t (ii) the defines for loop stuff --# --# Output of this script is normally redirected to "loop.h". -- --# Since 1.3.79 there is an include file --# that defines __kernel_dev_t. --# (The file itself appeared in 1.3.78, but there it defined __dev_t.) --# If it exists, we use it, or, rather, which --# avoids namespace pollution. Otherwise we guess that __kernel_dev_t --# is an unsigned short (which is true on i386, but false on alpha). -- --# BUG: This test is actually broken if your gcc is not configured to --# search /usr/include, as may well happen with cross-compilers. --# It would be better to ask $(CC) if these files can be found. -- --if [ -f /usr/include/linux/posix_types.h ]; then -- echo '#include ' -- echo '#undef dev_t' -- echo '#define dev_t __kernel_dev_t' --else -- echo '#undef dev_t' -- echo '#define dev_t unsigned short' --fi -- --# Next we have to find the loop stuff itself. --# First try kernel source, then a private version. -- --if [ -f /usr/include/linux/loop.h ]; then -- echo '#include ' --else -- echo '#include "real_loop.h"' --fi -- --echo '#undef dev_t' -- -diff -ruN busybox-1.00-pre7/libbb/my_dev_t.h busybox-1.00-pre7.new/libbb/my_dev_t.h ---- busybox-1.00-pre7/libbb/my_dev_t.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00-pre7.new/libbb/my_dev_t.h 2004-02-17 03:10:44.161289192 +0100 -@@ -0,0 +1,13 @@ -+/* silliness to get dev_t defined as the kernel defines it */ -+/* glibc uses a different dev_t */ -+/* maybe we need __kernel_old_dev_t -- later */ -+/* for ancient systems use "unsigned short" */ -+ -+#include -+#include -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) -+#define my_dev_t __kernel_dev_t -+#else -+#define my_dev_t int -+#endif -diff -ruN busybox-1.00-pre7/libbb/new_loop.h busybox-1.00-pre7.new/libbb/new_loop.h ---- busybox-1.00-pre7/libbb/new_loop.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00-pre7.new/libbb/new_loop.h 2004-02-17 03:10:44.162289040 +0100 -@@ -0,0 +1,51 @@ -+#define LO_CRYPT_NONE 0 -+#define LO_CRYPT_XOR 1 -+#define LO_CRYPT_DES 2 -+#define LO_CRYPT_CRYPTOAPI 18 -+ -+#define LOOP_SET_FD 0x4C00 -+#define LOOP_CLR_FD 0x4C01 -+#define LOOP_SET_STATUS 0x4C02 -+#define LOOP_GET_STATUS 0x4C03 -+#define LOOP_SET_STATUS64 0x4C04 -+#define LOOP_GET_STATUS64 0x4C05 -+ -+#define LO_NAME_SIZE 64 -+#define LO_KEY_SIZE 32 -+ -+#include "my_dev_t.h" -+ -+struct loop_info { -+ int lo_number; -+ my_dev_t lo_device; -+ unsigned long lo_inode; -+ my_dev_t lo_rdevice; -+ int lo_offset; -+ int lo_encrypt_type; -+ int lo_encrypt_key_size; -+ int lo_flags; -+ char lo_name[LO_NAME_SIZE]; -+ unsigned char lo_encrypt_key[LO_KEY_SIZE]; -+ unsigned long lo_init[2]; -+ char reserved[4]; -+}; -+ -+/* -+ * Where to get __u8, __u32, __u64? Let us use unsigned char/int/long long -+ * and get punished when someone comes with 128-bit long longs. -+ */ -+struct loop_info64 { -+ unsigned long long lo_device; -+ unsigned long long lo_inode; -+ unsigned long long lo_rdevice; -+ unsigned long long lo_offset; -+ unsigned long long lo_sizelimit; /* bytes, 0 == max available */ -+ unsigned int lo_number; -+ unsigned int lo_encrypt_type; -+ unsigned int lo_encrypt_key_size; -+ unsigned int lo_flags; -+ unsigned char lo_file_name[LO_NAME_SIZE]; -+ unsigned char lo_crypt_name[LO_NAME_SIZE]; -+ unsigned char lo_encrypt_key[LO_KEY_SIZE]; -+ unsigned long long lo_init[2]; -+}; -Files busybox-1.00-pre7/losetup and busybox-1.00-pre7.new/losetup differ -diff -ruN busybox-1.00-pre7/util-linux/losetup.c busybox-1.00-pre7.new/util-linux/losetup.c ---- busybox-1.00-pre7/util-linux/losetup.c 2003-07-30 10:55:59.000000000 +0200 -+++ busybox-1.00-pre7.new/util-linux/losetup.c 2004-02-17 03:25:10.157637736 +0100 -@@ -29,19 +29,31 @@ - { - int delete = 0; - int offset = 0; -- int opt; -+ int opt, pfd = -1; -+ char *encryption=NULL, *encnum=NULL; - -- while ((opt = getopt (argc, argv, "do:")) != -1) -+ while ((opt = getopt (argc, argv, "do:E:e:p:")) != -1) - switch (opt) - { - case 'd': - delete = 1; - break; - -- case 'o': -+ case 'o': - offset = bb_xparse_number (optarg, NULL); - break; - -+ case 'E': -+ encnum = optarg; -+ break; -+ case 'e': -+ encryption = optarg; -+ break; -+ -+ case 'p': -+ pfd = bb_xparse_number (optarg,NULL); -+ break; -+ - default: - bb_show_usage(); - } -@@ -54,6 +66,7 @@ - if (delete) - return del_loop (argv[optind]) ? EXIT_SUCCESS : EXIT_FAILURE; - else -- return set_loop (argv[optind], argv[optind + 1], offset, &opt) -+ return set_loop (argv[optind], argv[optind + 1], offset, encnum, -+ encryption, pfd, &opt) - ? EXIT_FAILURE : EXIT_SUCCESS; - } -diff -ruN busybox-1.00-pre7/util-linux/mount.c busybox-1.00-pre7.new/util-linux/mount.c ---- busybox-1.00-pre7/util-linux/mount.c 2003-12-12 08:01:14.000000000 +0100 -+++ busybox-1.00-pre7.new/util-linux/mount.c 2004-02-17 03:25:00.982032640 +0100 -@@ -142,7 +142,7 @@ - if (specialfile == NULL) { - bb_error_msg_and_die("Could not find a spare loop device"); - } -- if (set_loop(specialfile, lofile, 0, &loro)) { -+ if (set_loop(specialfile, lofile, 0,NULL,NULL,-1, &loro)) { - bb_error_msg_and_die("Could not setup loop device"); - } - if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ diff --git a/pkg/busybox-1.00-pre7-losetup-crypto-alpha.tar.bz2 b/pkg/busybox-1.00-pre7-losetup-crypto-alpha.tar.bz2 deleted file mode 100644 index c5ab4b8..0000000 Binary files a/pkg/busybox-1.00-pre7-losetup-crypto-alpha.tar.bz2 and /dev/null differ diff --git a/pkg/busybox-1.00-rt-mdstart.plasmaroo.tar.bz2 b/pkg/busybox-1.00-rt-mdstart.plasmaroo.tar.bz2 new file mode 100644 index 0000000..afe53a1 Binary files /dev/null and b/pkg/busybox-1.00-rt-mdstart.plasmaroo.tar.bz2 differ diff --git a/ppc/busy-config b/ppc/busy-config index e3c1bb9..31f837b 100644 --- a/ppc/busy-config +++ b/ppc/busy-config @@ -158,7 +158,7 @@ CONFIG_FEATURE_HUMAN_READABLE=y # # Console Utilities # -# CONFIG_CHVT is not set +CONFIG_CHVT=y CONFIG_CLEAR=y # CONFIG_DEALLOCVT is not set CONFIG_DUMPKMAP=y @@ -372,6 +372,7 @@ CONFIG_FREERAMDISK=y # CONFIG_HEXDUMP is not set # CONFIG_HWCLOCK is not set CONFIG_LOSETUP=y +CONFIG_MDSTART=y # CONFIG_MKSWAP is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y diff --git a/ppc64/busy-config b/ppc64/busy-config index e3c1bb9..31f837b 100644 --- a/ppc64/busy-config +++ b/ppc64/busy-config @@ -158,7 +158,7 @@ CONFIG_FEATURE_HUMAN_READABLE=y # # Console Utilities # -# CONFIG_CHVT is not set +CONFIG_CHVT=y CONFIG_CLEAR=y # CONFIG_DEALLOCVT is not set CONFIG_DUMPKMAP=y @@ -372,6 +372,7 @@ CONFIG_FREERAMDISK=y # CONFIG_HEXDUMP is not set # CONFIG_HWCLOCK is not set CONFIG_LOSETUP=y +CONFIG_MDSTART=y # CONFIG_MKSWAP is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y diff --git a/sparc/busy-config b/sparc/busy-config index e3c1bb9..31f837b 100644 --- a/sparc/busy-config +++ b/sparc/busy-config @@ -158,7 +158,7 @@ CONFIG_FEATURE_HUMAN_READABLE=y # # Console Utilities # -# CONFIG_CHVT is not set +CONFIG_CHVT=y CONFIG_CLEAR=y # CONFIG_DEALLOCVT is not set CONFIG_DUMPKMAP=y @@ -372,6 +372,7 @@ CONFIG_FREERAMDISK=y # CONFIG_HEXDUMP is not set # CONFIG_HWCLOCK is not set CONFIG_LOSETUP=y +CONFIG_MDSTART=y # CONFIG_MKSWAP is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y diff --git a/sparc64/busy-config b/sparc64/busy-config index e3c1bb9..31f837b 100644 --- a/sparc64/busy-config +++ b/sparc64/busy-config @@ -158,7 +158,7 @@ CONFIG_FEATURE_HUMAN_READABLE=y # # Console Utilities # -# CONFIG_CHVT is not set +CONFIG_CHVT=y CONFIG_CLEAR=y # CONFIG_DEALLOCVT is not set CONFIG_DUMPKMAP=y @@ -372,6 +372,7 @@ CONFIG_FREERAMDISK=y # CONFIG_HEXDUMP is not set # CONFIG_HWCLOCK is not set CONFIG_LOSETUP=y +CONFIG_MDSTART=y # CONFIG_MKSWAP is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y diff --git a/um/busy-config b/um/busy-config index e3c1bb9..31f837b 100644 --- a/um/busy-config +++ b/um/busy-config @@ -158,7 +158,7 @@ CONFIG_FEATURE_HUMAN_READABLE=y # # Console Utilities # -# CONFIG_CHVT is not set +CONFIG_CHVT=y CONFIG_CLEAR=y # CONFIG_DEALLOCVT is not set CONFIG_DUMPKMAP=y @@ -372,6 +372,7 @@ CONFIG_FREERAMDISK=y # CONFIG_HEXDUMP is not set # CONFIG_HWCLOCK is not set CONFIG_LOSETUP=y +CONFIG_MDSTART=y # CONFIG_MKSWAP is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y diff --git a/x86/busy-config b/x86/busy-config index 7bcc066..31f837b 100644 --- a/x86/busy-config +++ b/x86/busy-config @@ -372,6 +372,7 @@ CONFIG_FREERAMDISK=y # CONFIG_HEXDUMP is not set # CONFIG_HWCLOCK is not set CONFIG_LOSETUP=y +CONFIG_MDSTART=y # CONFIG_MKSWAP is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y diff --git a/x86_64/busy-config b/x86_64/busy-config index 7bcc066..31f837b 100644 --- a/x86_64/busy-config +++ b/x86_64/busy-config @@ -372,6 +372,7 @@ CONFIG_FREERAMDISK=y # CONFIG_HEXDUMP is not set # CONFIG_HWCLOCK is not set CONFIG_LOSETUP=y +CONFIG_MDSTART=y # CONFIG_MKSWAP is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y diff --git a/xen0/busy-config b/xen0/busy-config index e3c1bb9..31f837b 100644 --- a/xen0/busy-config +++ b/xen0/busy-config @@ -158,7 +158,7 @@ CONFIG_FEATURE_HUMAN_READABLE=y # # Console Utilities # -# CONFIG_CHVT is not set +CONFIG_CHVT=y CONFIG_CLEAR=y # CONFIG_DEALLOCVT is not set CONFIG_DUMPKMAP=y @@ -372,6 +372,7 @@ CONFIG_FREERAMDISK=y # CONFIG_HEXDUMP is not set # CONFIG_HWCLOCK is not set CONFIG_LOSETUP=y +CONFIG_MDSTART=y # CONFIG_MKSWAP is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y diff --git a/xenU/busy-config b/xenU/busy-config index e3c1bb9..31f837b 100644 --- a/xenU/busy-config +++ b/xenU/busy-config @@ -158,7 +158,7 @@ CONFIG_FEATURE_HUMAN_READABLE=y # # Console Utilities # -# CONFIG_CHVT is not set +CONFIG_CHVT=y CONFIG_CLEAR=y # CONFIG_DEALLOCVT is not set CONFIG_DUMPKMAP=y @@ -372,6 +372,7 @@ CONFIG_FREERAMDISK=y # CONFIG_HEXDUMP is not set # CONFIG_HWCLOCK is not set CONFIG_LOSETUP=y +CONFIG_MDSTART=y # CONFIG_MKSWAP is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y