From: Tim Yamin Date: Tue, 11 Jul 2006 11:33:09 +0000 (+0000) Subject: Commit patch for bug #139866 by Martin Parm. X-Git-Tag: v3.4.10.902~335 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2376b1874252d365f913fcf369c9d63f85497275;p=genkernel.git Commit patch for bug #139866 by Martin Parm. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@417 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- diff --git a/gen_bootloader.sh b/gen_bootloader.sh index 878abff..51ada96 100644 --- a/gen_bootloader.sh +++ b/gen_bootloader.sh @@ -10,7 +10,7 @@ set_bootloader() { } set_grub_bootloader() { - local GRUB_CONF='/boot/grub/grub.conf' + local GRUB_CONF='${BOOTDIR}/grub/grub.conf' print_info 1 '' print_info 1 "Adding kernel to $GRUB_CONF..." @@ -20,9 +20,9 @@ set_grub_bootloader() { else # Extract block device information from /etc/fstab GRUB_ROOTFS=$(awk '/^[^#].+[[:space:]]\/[[:space:]]/ { print $1 }' /etc/fstab) - GRUB_BOOTFS=$(awk '/^[^#].+[[:space:]]\/boot[[:space:]]/ { print $1 }' /etc/fstab) + GRUB_BOOTFS=$(awk '/^[^#].+[[:space:]]\${BOOTDIR}[[:space:]]/ { print $1 }' /etc/fstab) - # If /boot is not defined in /etc/fstab, it must be the same as / + # If ${BOOTDIR} is not defined in /etc/fstab, it must be the same as / [ "x$GRUB_BOOTFS" == 'x' ] && GRUB_BOOTFS=$GRUB_ROOTFS fi @@ -70,8 +70,8 @@ EOF fi echo >> $GRUB_CONF else - print_error 1 'Error! /boot/grub/grub.conf does not exist and the correct settings can not be automatically detected.' - print_error 1 'Please manually create your /boot/grub/grub.conf file.' + print_error 1 'Error! ${BOOTDIR}/grub/grub.conf does not exist and the correct settings can not be automatically detected.' + print_error 1 'Please manually create your ${BOOTDIR}/grub/grub.conf file.' fi else # grub.conf already exists; so... diff --git a/gen_cmdline.sh b/gen_cmdline.sh index 998378a..308028f 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -63,8 +63,9 @@ longusage() { echo " --utils-arch= Force to arch for utils only instead of" echo " autodetect." echo " --makeopts= Make options such as -j2, etc..." - echo " --mountboot Mount /boot automatically" - echo " --no-mountboot Don't mount /boot automatically" + echo " --mountboot Mount BOOTDIR automatically if mountable" + echo " --no-mountboot Don't mount BOOTDIR automatically" + echo " --bootdir= Set the location of the boot-directory, default is /boot" echo " Initialization" echo " --bootsplash= Force bootsplash using " echo " --gensplash= Force gensplash using " @@ -193,6 +194,10 @@ parse_cmdline() { CMD_MOUNTBOOT=0 print_info 2 "CMD_MOUNTBOOT: $CMD_MOUNTBOOT" ;; + --bootdir=*) + BOOTDIR=`parse_opt "$*"` + print_info 2 "BOOTDIR: $BOOTDIR" + ;; --do-keymap-auto) CMD_DOKEYMAPAUTO=1 print_info 2 "CMD_DOKEYMAPAUTO: $CMD_DOKEYMAPAUTO" diff --git a/gen_compile.sh b/gen_compile.sh index 7a42ed8..dd6ea58 100644 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -295,14 +295,14 @@ compile_kernel() { fi if ! isTrue "${CMD_NOINSTALL}" then - cp "${KERNEL_BINARY}" "/boot/kernel-${KNAME}-${ARCH}-${KV}" || - gen_die 'Could not copy the kernel binary to /boot!' - cp "System.map" "/boot/System.map-${KNAME}-${ARCH}-${KV}" || - gen_die 'Could not copy System.map to /boot!' + cp "${KERNEL_BINARY}" "${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV}" || + gen_die 'Could not copy the kernel binary to ${BOOTDIR}!' + cp "System.map" "${BOOTDIR}/System.map-${KNAME}-${ARCH}-${KV}" || + gen_die 'Could not copy System.map to ${BOOTDIR}!' if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ] then - cp "${KERNEL_BINARY_2}" "/boot/kernelz-${KV}" || - gen_die 'Could not copy the kernelz binary to /boot!' + cp "${KERNEL_BINARY_2}" "${BOOTDIR}/kernelz-${KV}" || + gen_die 'Could not copy the kernelz binary to ${BOOTDIR}!' fi else cp "${KERNEL_BINARY}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" || diff --git a/gen_determineargs.sh b/gen_determineargs.sh index 93e5bab..11e94d6 100644 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -177,6 +177,14 @@ determine_real_args() { UTILS_CROSS_COMPILE="${CMD_UTILS_CROSS_COMPILE}" fi + if [ "${BOOTDIR}" != '' ] + then + BOOTDIR=`arch_replace "${BOOTDIR}"` + BOOTDIR=${BOOTDIR%/} # Remove any trailing slash + else + BOOTDIR="/boot" + fi + CACHE_DIR=`arch_replace "${CACHE_DIR}"` CACHE_CPIO_DIR="${CACHE_DIR}/cpio" BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"` diff --git a/gen_funcs.sh b/gen_funcs.sh index 7977339..7143bef 100755 --- a/gen_funcs.sh +++ b/gen_funcs.sh @@ -252,7 +252,7 @@ has_loop() { isBootRO() { - for mo in `grep ' /boot ' /proc/mounts | cut -d ' ' -f 4 | sed -e 's/,/ /'` + for mo in `grep ' ${BOOTDIR} ' /proc/mounts | cut -d ' ' -f 4 | sed -e 's/,/ /'` do if [ "x${mo}x" == "xrox" ] then diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 3b764d8..97bc315 100644 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -663,8 +663,8 @@ create_initramfs() { then if [ "${GENERATE_Z_IMAGE}" != '1' ] then - cp ${TMPDIR}/initramfs-${KV} /boot/initramfs-${KNAME}-${ARCH}-${KV} || - gen_die 'Could not copy the initramfs to /boot!' + cp ${TMPDIR}/initramfs-${KV} ${BOOTDIR}/initramfs-${KNAME}-${ARCH}-${KV} || + gen_die 'Could not copy the initramfs to ${BOOTDIR}!' fi fi } diff --git a/gen_initrd.sh b/gen_initrd.sh index d2147dd..7c7cc07 100644 --- a/gen_initrd.sh +++ b/gen_initrd.sh @@ -427,8 +427,8 @@ create_initrd() { fi if ! isTrue "${CMD_NOINSTALL}" then - cp ${TMPDIR}/initrd-${KV} /boot/initrd-${KNAME}-${ARCH}-${KV} || - gen_die 'Could not copy the initrd to /boot!' + cp ${TMPDIR}/initrd-${KV} ${BOOTDIR}/initrd-${KNAME}-${ARCH}-${KV} || + gen_die 'Could not copy the initrd to ${BOOTDIR}!' fi # Pegasos hack for merging the initrd into the kernel at compile time diff --git a/gen_package.sh b/gen_package.sh index 86c8f75..8f172f1 100644 --- a/gen_package.sh +++ b/gen_package.sh @@ -89,12 +89,12 @@ gen_kerncache() gen_kerncache_extract_kernel() { /bin/tar -f ${KERNCACHE} -C ${TEMP} -xj - cp "${TEMP}/kernel-${ARCH}-${KV}" "/boot/kernel-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to /boot!' + cp "${TEMP}/kernel-${ARCH}-${KV}" "${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to ${BOOTDIR}!' if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ] then - cp "${TEMP}/kernelz-${ARCH}-${KV}" "/boot/kernelz-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to /boot!' + cp "${TEMP}/kernelz-${ARCH}-${KV}" "${BOOTDIR}/kernelz-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to ${BOOTDIR}!' fi - cp "${TEMP}/System.map-${ARCH}-${KV}" "/boot/System.map-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy System.map to /boot!' + cp "${TEMP}/System.map-${ARCH}-${KV}" "${BOOTDIR}/System.map-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy System.map to ${BOOTDIR}!' } gen_kerncache_extract_modules() diff --git a/genkernel b/genkernel index 3706cc4..9bca48b 100755 --- a/genkernel +++ b/genkernel @@ -2,7 +2,7 @@ # Genkernel v3 PATH="/bin:/usr/bin:/sbin:/usr/sbin" -GK_V='3.4.0_pre1' +GK_V='3.4.0_pre2' TMPDIR='/var/tmp/genkernel' TEMP=${TMPDIR}/$RANDOM.$RANDOM.$RANDOM.$$ @@ -126,27 +126,29 @@ then fi fi -# Check /boot is mounted +# Check BOOTDIR is mounted if isTrue ${CMD_NOINSTALL} then isTrue ${MOUNTBOOT} && print_info 2 'Skipping automatic mount of boot' else - if ! egrep -q ' /boot ' /proc/mounts + [[ -d ${BOOTDIR} ]] || gen_die "${BOOTDIR} is not a directory" + + if ! egrep -q ' ${BOOTDIR} ' /proc/mounts then - if egrep -q '^[^#].+ /boot ' /etc/fstab + if egrep -q '^[^#].+[ \t]${BOOTDIR}[ \t]' /etc/fstab then if isTrue ${MOUNTBOOT} then - if ! mount /boot + if ! mount ${BOOTDIR} then - print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to mount /boot!" + print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to mount ${BOOTDIR}!" echo else - print_info 1 'mount: /boot mounted successfully!' + print_info 1 'mount: ${BOOTDIR} mounted successfully!' fi else - print_warning 1 "${BOLD}WARNING${NORMAL}: No mounted /boot partition detected!" - print_warning 1 ' Run ``mount /boot`` to mount it!' + print_warning 1 "${BOLD}WARNING${NORMAL}: No mounted ${BOOTDIR} partition detected!" + print_warning 1 ' Run ``mount ${BOOTDIR}`` to mount it!' echo fi fi @@ -154,12 +156,12 @@ else then if isTrue ${MOUNTBOOT} then - if ! mount -o remount,rw /boot + if ! mount -o remount,rw ${BOOTDIR} then - print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to remount /boot RW!" + print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to remount ${BOOTDIR} RW!" echo else - print_info 1 "mount: /boot remounted read/write successfully!" + print_info 1 "mount: ${BOOTDIR} remounted read/write successfully!" BOOTRW=1 fi fi @@ -407,10 +409,10 @@ then print_info 1 ' creating kernel name symlink!' - if [ -e /boot/kernel-${KNAME}-${ARCH}-${KV} ] + if [ -e ${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV} ] then - /bin/rm /boot/kernel - ln -s /boot/kernel-${KNAME}-${ARCH}-${KV} /boot/kernel + /bin/rm ${BOOTDIR}/kernel + ln -s ${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV} ${BOOTDIR}/kernel ret=$? [ ${ret} = '1' ] && print_error 1 'kernel link failed' fi @@ -418,19 +420,19 @@ then if [ "${KERN_24}" != '1' -a "${CMD_BOOTSPLASH}" != '1' ] then print_info 1 ' creating initramfs name symlink!' - if [ -e /boot/initramfs-${KNAME}-${ARCH}-${KV} ] + if [ -e ${BOOTDIR}/initramfs-${KNAME}-${ARCH}-${KV} ] then - /bin/rm /boot/initramfs - ln -s /boot/initramfs-${KNAME}-${ARCH}-${KV} /boot/initramfs + /bin/rm ${BOOTDIR}/initramfs + ln -s ${BOOTDIR}/initramfs-${KNAME}-${ARCH}-${KV} ${BOOTDIR}/initramfs ret=$? [ ${ret} = '1' ] && print_error 1 'initramfs link failed' fi else print_info 1 ' creating initrd name symlink!' - if [ -e /boot/initrd-${KNAME}-${ARCH}-${KV} ] + if [ -e ${BOOTDIR}/initrd-${KNAME}-${ARCH}-${KV} ] then - /bin/rm /boot/initrd - ln -s /boot/initrd-${KNAME}-${ARCH}-${KV} /boot/initrd + /bin/rm ${BOOTDIR}/initrd + ln -s ${BOOTDIR}/initrd-${KNAME}-${ARCH}-${KV} ${BOOTDIR}/initrd ret=$? [ ${ret} = '1' ] && print_error 1 'initrd link failed' fi @@ -438,7 +440,7 @@ then fi -[ "${BOOTRW}" != '' ] && mount -o remount,ro /boot +[ "${BOOTRW}" != '' ] && mount -o remount,ro ${BOOTDIR} echo print_info 1 'Do NOT report kernel bugs as genkernel bugs unless your bug' diff --git a/genkernel.conf b/genkernel.conf index 2bd8688..d0f857a 100755 --- a/genkernel.conf +++ b/genkernel.conf @@ -20,7 +20,7 @@ BOOTSPLASH="yes" # Override the arch detection? # ARCH_OVERRIDE="x86" -# Mount /boot automatically if it isn't mounted? +# Mount BOOTDIR automatically if it isn't mounted? MOUNTBOOT="yes" # Save the new configuration in /etc/kernels upon @@ -45,6 +45,9 @@ USECOLOR="yes" # %%ARCH%% - Final determined architecture # %%CACHE%% - Final determined cache location +# Set the boot directory, default is /boot +#BOOTDIR="/boot" + # Default share directory location GK_SHARE="/usr/share/genkernel"