commit:     b53f0734cdaab1411b94210bbfbb88b5bb4a19a0
Author:     Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 15 20:08:48 2019 +0000
Commit:     Rick Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Tue Jan 15 20:08:48 2019 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=b53f0734

simplify bootloader handling for amd64/x86

remove grub legacy and elilo
keep files in /boot rather than moving them around
simplify create-iso based on the above

Signed-off-by: Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo.org>

 targets/support/bootloader-setup.sh | 137 ++++--------------------------------
 targets/support/create-iso.sh       |  65 ++++++-----------
 2 files changed, 33 insertions(+), 169 deletions(-)

diff --git a/targets/support/bootloader-setup.sh 
b/targets/support/bootloader-setup.sh
index b7e2d313..e4735782 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -183,7 +183,6 @@ case ${clst_hostarch} in
        x86|amd64)
                if [ -e $1/isolinux/isolinux.bin ]
                then
-                       cp -f $1/boot/* $1/isolinux
                        # the rest of this function sets up the config file for 
isolinux
                        icfg=$1/isolinux/isolinux.cfg
                        kmsg=$1/isolinux/kernels.msg
@@ -220,26 +219,26 @@ case ${clst_hostarch} in
                                        for y in ${clst_kernel_softlevel}
                                        do
                                                echo "label ${x}-${y}" >> 
${icfg}
-                                               echo "  kernel ${x}" >> ${icfg}
-                                               echo "  append 
${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
+                                               echo "  kernel /boot/${x}" >> 
${icfg}
+                                               echo "  append 
${default_append_line} softlevel=${y} initrd=/boot/${x}.igz vga=791" >> ${icfg}
 
                                                echo >> ${icfg}
                                                echo "   ${x}" >> ${kmsg}
                                                echo "label ${x}-${y}-nofb" >> 
${icfg}
-                                               echo "  kernel ${x}" >> ${icfg}
-                                               echo "  append 
${default_append_line} softlevel=${y} initrd=${x}.igz" >> ${icfg}
+                                               echo "  kernel /boot/${x}" >> 
${icfg}
+                                               echo "  append 
${default_append_line} softlevel=${y} initrd=/boot/${x}.igz" >> ${icfg}
                                                echo >> ${icfg}
                                                echo "   ${x}-nofb" >> ${kmsg}
                                        done
                                else
                                        echo "label ${x}" >> ${icfg}
-                                       echo "  kernel ${x}" >> ${icfg}
-                                       echo "  append ${default_append_line} 
initrd=${x}.igz vga=791" >> ${icfg}
+                                       echo "  kernel /boot/${x}" >> ${icfg}
+                                       echo "  append ${default_append_line} 
initrd=/boot/${x}.igz vga=791" >> ${icfg}
                                        echo >> ${icfg}
                                        echo "   ${x}" >> ${kmsg}
                                        echo "label ${x}-nofb" >> ${icfg}
-                                       echo "  kernel ${x}" >> ${icfg}
-                                       echo "  append ${default_append_line} 
initrd=${x}.igz" >> ${icfg}
+                                       echo "  kernel /boot/${x}" >> ${icfg}
+                                       echo "  append ${default_append_line} 
initrd=/boot/${x}.igz" >> ${icfg}
                                        echo >> ${icfg}
                                        echo "   ${x}-nofb" >> ${kmsg}
                                fi
@@ -263,13 +262,6 @@ case ${clst_hostarch} in
                then
                        #the grub dir may not exist, better safe than sorry
                        [ -d "$1/grub" ] || mkdir -p "$1/grub"
-                       if [ -e $1/isolinux/isolinux.bin ]
-                       then
-                               kern_subdir=/isolinux
-                       else
-                               cp -f $1/boot/* $1/grub
-                               kern_subdir=/grub
-                       fi
 
                        iacfg=$1/grub/grub.cfg
                        echo 'set default=0' > ${iacfg}
@@ -280,122 +272,17 @@ case ${clst_hostarch} in
                        for x in ${clst_boot_kernel}
                        do
                                echo "menuentry 'Boot LiveCD (kernel: ${x})' 
--class gnu-linux --class os {"  >> ${iacfg}
-                               echo "  linux ${kern_subdir}/${x} 
${default_append_line}" >> ${iacfg}
-                               echo "  initrd ${kern_subdir}/${x}.igz" >> 
${iacfg}
+                               echo "  linux /boot/${x} 
${default_append_line}" >> ${iacfg}
+                               echo "  initrd /boot/${x}.igz" >> ${iacfg}
                                echo "}" >> ${iacfg}
                                echo "" >> ${iacfg}
                                echo "menuentry 'Boot LiveCD (kernel: ${x}) 
(cached)' --class gnu-linux --class os {"  >> ${iacfg}
-                               echo "  linux ${kern_subdir}/${x} 
${default_append_line} docache" >> ${iacfg}
-                               echo "  initrd ${kern_subdir}/${x}.igz" >> 
${iacfg}
+                               echo "  linux /boot/${x} ${default_append_line} 
docache" >> ${iacfg}
+                               echo "  initrd /boot/${x}.igz" >> ${iacfg}
                                echo "}" >> ${iacfg}
                                echo "" >> ${iacfg}
                        done
                fi
-
-               if [ -e $1/boot/efi/elilo.efi ]
-               then
-                       [ -e $1/isolinux/elilo.efi ] && rm -f 
$1/isolinux/elilo.efi
-                       iacfg=$1/boot/elilo.conf
-                       echo 'prompt' > ${iacfg}
-                       echo 'message=/efi/boot/elilo.msg' >> ${iacfg}
-                       echo 'chooser=simple' >> ${iacfg}
-                       echo 'timeout=50' >> ${iacfg}
-                       echo >> ${iacfg}
-                       for x in ${clst_boot_kernel}
-                       do
-                               echo "image=/efi/boot/${x}" >> ${iacfg}
-                               echo "  label=${x}" >> ${iacfg}
-                               echo '  append="'initrd=${x}.igz 
${default_append_line}'"' >> ${iacfg}
-                               echo "  initrd=/efi/boot/${x}.igz" >> ${iacfg}
-                               echo >> ${iacfg}
-                               echo "image=/efi/boot/${x}" >> ${iacfg}
-                               echo >> ${iacfg}
-                               cp -f $1/boot/${x}{,.igz} $1/boot/efi/boot > 
/dev/null
-                               cp -f $1/isolinux/${x}{,.igz} $1/boot/efi/boot 
> /dev/null
-                       done
-                       cp ${iacfg} $1/boot/efi/boot
-               fi
-
-               # GRUB legacy (0.97)
-               if [ -e $1/boot/grub/stage2_eltorito ]
-               then
-                       icfg=$1/boot/grub/menu.lst
-                       echo "default 0" > ${icfg}
-                       echo "timeout 15" >> ${icfg}
-                       echo "pager on" >> ${icfg}
-
-                       # Copy our splash if we're a Gentoo release
-                       case ${clst_livecd_type} in
-                               gentoo-*)
-                                       [ -e 
${clst_chroot_path}/boot/grub/splash.xpm.gz ] && \
-                                               cp -f 
${clst_chroot_path}/boot/grub/splash.xpm.gz \
-                                               ${1}/boot/grub
-                               ;;
-                       esac
-
-                       if [ -e ${1}/boot/grub/splash.xpm.gz ]; then
-                               echo "splashimage=/boot/grub/splash.xpm.gz" >> 
${icfg}
-                       fi
-
-                       for x in ${clst_boot_kernel}
-                       do
-                               eval custom_kopts=\$${x}_kernelopts
-                               echo "APPENDING CUSTOM KERNEL ARGS: 
${custom_kopts}"
-                               echo >> ${icfg}
-
-                               eval 
"clst_kernel_softlevel=\$clst_boot_kernel_${x}_softlevel"
-
-                               if [ -n "${clst_kernel_softlevel}" ]
-                               then
-                                       for y in ${clst_kernel_softlevel}
-                                       do
-                                               echo "title ${x}-${y}" >> 
${icfg}
-                                               echo "  append 
${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
-                                               if [ -e $1/boot/${x}.igz ]
-                                               then
-                                                       echo "initrd 
/boot/${x}.igz" >> ${icfg}
-                                               fi
-                                               echo >> ${icfg}
-                                               echo "title ${x}-${y} [ No 
FrameBuffer ]" >> ${icfg}
-                                               echo "kernel /boot/${x} 
softlevel=${y} ${default_append_line}" >> ${icfg}
-                                               if [ -e $1/boot/${x}.igz ]
-                                               then
-                                                       echo "initrd 
/boot/${x}.igz" >> ${icfg}
-                                               fi
-                                               echo >> ${icfg}
-                                       done
-                               else
-                                       echo "title ${x}" >> ${icfg}
-                                       echo "kernel /boot/${x} 
${default_append_line} vga=791" >> ${icfg}
-                                       if [ -e $1/boot/${x}.igz ]
-                                       then
-                                               echo "initrd /boot/${x}.igz" >> 
${icfg}
-                                       fi
-                                       echo >> ${icfg}
-                                       echo "title ${x} [ No FrameBuffer ]" >> 
${icfg}
-                                       echo "kernel /boot/${x} 
${default_append_line}" >> ${icfg}
-                                       if [ -e $1/boot/${x}.igz ]
-                                       then
-                                               echo "initrd /boot/${x}.igz" >> 
${icfg}
-                                       fi
-                               fi
-
-                       done
-
-                       # Setup help message
-                       echo >> ${icfg}
-                       echo "title help" >> ${icfg}
-                       cp ${clst_sharedir}/livecd/files/README.txt \
-                               $1/boot/help.msg
-                       echo "cat /boot/help.msg" >> ${icfg}
-
-                       if [ -f $1/boot/memtest86 ]
-                       then
-                               echo >> ${icfg}
-                               echo "title memtest86" >> ${icfg}
-                               echo "kernel /boot/memtest86" >> ${icfg}
-                       fi
-               fi
        ;;
        mips)
                # NO SOFTLEVEL SUPPORT YET

diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
index 253a8887..1b0f05e1 100755
--- a/targets/support/create-iso.sh
+++ b/targets/support/create-iso.sh
@@ -242,16 +242,12 @@ case ${clst_hostarch} in
                        then
                                echo "Found prepared EFI boot image at \
                                        ${clst_target_path}/gentoo.efimg"
-                               # /boot must exist and be empty for later logic
-                               echo "Removing /boot contents"
-                               rm -rf "${clst_target_path}"/boot
-                               mkdir -p "${clst_target_path}"/boot
                        else
                                echo "Preparing EFI boot image"
-        if [ -d "${clst_target_path}/boot/efi" ] && [ ! -d 
"${clst_target_path}/boot/EFI" ]; then
-          echo "Moving /boot/efi to /boot/EFI"
-          mv "${clst_target_path}/boot/efi" "${clst_target_path}/boot/EFI"
-        fi
+                               if [ -d "${clst_target_path}/boot/efi" ] && [ ! 
-d "${clst_target_path}/boot/EFI" ]; then
+                                       echo "Moving /boot/efi to /boot/EFI"
+                                       mv "${clst_target_path}/boot/efi" 
"${clst_target_path}/boot/EFI"
+                               fi
                                # prepare gentoo.efimg from clst_target_path 
/boot/EFI dir
                                iaSizeTemp=$(du -sk 
"${clst_target_path}/boot/EFI" 2>/dev/null)
                                iaSizeB=$(echo ${iaSizeTemp} | cut '-d ' -f1)
@@ -276,48 +272,29 @@ case ${clst_hostarch} in
 
                                echo "Copying /boot/EFI to /EFI for rufus 
compatability"
                                cp -rv "${clst_target_path}"/boot/EFI/ 
"${clst_target_path}"
-
-                               echo "Emptying /boot"
-                               rm -rf "${clst_target_path}"/boot
-                               mkdir -p "${clst_target_path}"/boot
                        fi
                fi
 
-               if [ -e "${clst_target_path}/isolinux/isolinux.bin" ]
-               then
-                       echo "** Found ISOLINUX bootloader"
-                       if [ -d "${clst_target_path}/boot" ]
-                       then
-                               if [ -n "$(ls ${clst_target_path}/boot)" ]
-                               # have stray files in /boot, assume ISOLINUX 
only
-                               then
-                                       echo "** boot dir not empty, moving 
files to isolinux/ then removing it"
-                                       mv "${clst_target_path}"/boot/* 
"${clst_target_path}/isolinux"
-                                       rm -r "${clst_target_path}/boot"
-                                       echo "Creating ISO using ISOLINUX 
bootloader"
-                                       run_mkisofs -J -R -l 
${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b 
isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 
-boot-info-table "${clst_target_path}"/
-                                       isohybrid "${1}"
-                               elif [ -e "${clst_target_path}/gentoo.efimg" ]
-                               # have BIOS isolinux, plus an EFI loader image
-                               then
-                                       echo "Creating ISO using both ISOLINUX 
and EFI bootloader"
-                                       run_mkisofs -J -R -l 
${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b 
isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 
-boot-info-table -eltorito-alt-boot -eltorito-platform efi -b gentoo.efimg 
-no-emul-boot -z "${clst_target_path}"/
-                                       isohybrid --uefi "${1}"
-                               fi
-                       else
-                               echo "Creating ISO using ISOLINUX bootloader"
-                               run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V 
"${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat 
-no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/
-                               isohybrid "${1}"
-                       fi
-               elif [ -e "${clst_target_path}/boot/grub/stage2_eltorito" ]
-               then
-                       echo "Creating ISO using GRUB bootloader"
-                       run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V 
"${clst_iso_volume_id}" -o "${1}" -b boot/grub/stage2_eltorito -c boot/boot.cat 
-no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/
-               elif [ -e "${clst_target_path}/gentoo.efimg" ]
-               then
+               if [ -e "${clst_target_path}/isolinux/isolinux.bin" ]; then
+                       echo '** Found ISOLINUX bootloader'
+                       if [ -e "${clst_target_path}/gentoo.efimg" ]; then
+                         # have BIOS isolinux, plus an EFI loader image
+                         echo '** Found GRUB2 EFI bootloader'
+                               echo 'Creating ISO using both ISOLINUX and EFI 
bootloader'
+                               run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V 
"${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat 
-no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot 
-eltorito-platform efi -b gentoo.efimg -no-emul-boot -z "${clst_target_path}"/
+                               isohybrid --uefi "${1}"
+                 else
+                         echo 'Creating ISO using ISOLINUX bootloader'
+                         run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V 
"${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat 
-no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/
+                         isohybrid "${1}"
+                 fi
+               elif [ -e "${clst_target_path}/gentoo.efimg" ]; then
+                       echo '** Found GRUB2 EFI bootloader'
                        echo 'Creating ISO using EFI bootloader'
                        run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V 
"${clst_iso_volume_id}" -o "${1}" -b gentoo.efimg -c boot.cat -no-emul-boot 
"${clst_target_path}"/
                else
+                       echo '** Found no known bootloader'
+                       echo 'Creating ISO with fingers crossed that you know 
what you are doing...'
                        run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V 
"${clst_iso_volume_id}" -o "${1}" "${clst_target_path}"/
                fi
        ;;

Reply via email to