livecd, livedvd: replace syslinux with grub boot loader

This commit is contained in:
Silvan Calarco 2022-06-10 18:06:40 +02:00
parent c9d054adb0
commit 845896cf94
5 changed files with 231 additions and 92 deletions

View File

@ -18,7 +18,7 @@ $(MAKEDIST_TARGET)-livecd-root: \
mambatray dnf \ mambatray dnf \
$(MAKEDIST_TARGET)-livecd-kde $(MAKEDIST_TARGET)-livecd-kde
$(MAKEDIST_TARGET)-livecd-root-$(ARCH): VirtualBox-guest $(MAKEDIST_TARGET)-livecd-root-x86_64: VirtualBox-guest
# Localization targets # Localization targets
$(MAKEDIST_TARGET)-livecd-root-de: langpacks-de firefox-langpack-de $(MAKEDIST_TARGET)-livecd-root-de: langpacks-de firefox-langpack-de

View File

@ -6,13 +6,14 @@
# make initramfs # make initramfs
[ -e $MOUNTDIR2/boot/isolinux ] || mkdir -p $MOUNTDIR2/boot/isolinux [ -e $MOUNTDIR2/boot/isolinux ] || mkdir -p $MOUNTDIR2/boot/isolinux
[ -e $MOUNTDIR2/boot/grub ] || mkdir -p $MOUNTDIR2/boot/grub
ISOID= ISOID=
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K} chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K}
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
-a dmsquash-live -o squash-live \ -a dmsquash-live -o squash-live \
--filesystems "autofs4 ext3 ext4 overlay squashfs isofs reiserfs" \ --filesystems "autofs4 ext4 overlay squashfs isofs hfsplus nls_utf8" \
--nomdadmconf --nolvmconf \ --nomdadmconf --nolvmconf \
/boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \ /boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \
${KERNEL_MAJVER}${K} ${KERNEL_MAJVER}${K}
@ -33,7 +34,90 @@ done
# add buildinfo # add buildinfo
buildinfo="`cat $MOUNTDIR/etc/openmamba-release` ${PLATFORM}" buildinfo="`cat $MOUNTDIR/etc/openmamba-release` ${PLATFORM}"
# configure isolinux boot loader # configure grub boot loader
cat > $MOUNTDIR2/boot/grub/grub.cfg << _EOF
#
# GRUB configuration generated by openmamba makedist
#
font=unicode
set gfxmode=auto
insmod all_video
insmod gfxterm
insmod gettext
insmod iso9660
insmod biosdisk
terminal_output=gfxterm
timeout=10
# theme
insmod=png
set menu_color_normal=white/black
set menu_color_highlight=white/green
_EOF
#
# Boot entries
#
ISOID=
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
menuentry "openmamba GNU/Linux (${KERNEL_MAJVER}${K})" {
echo "Loading /boot/vmlinuz${ISOID}"
linux /boot/vmlinuz${ISOID} root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} selinux=0 quiet splash ro
echo "Loading /boot/initrd${ISOID}.gz"
initrd /boot/initrd${ISOID}.gz
}
_EOF
ISOID=$(($ISOID + 1))
done
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
submenu "Advanced options for openmamba GNU/Linux" {
_EOF
#ISOID=
#for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
# cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
# menuentry "No modeset (${KERNEL_MAJVER}${K})" {
# echo "Loading /boot/vmlinuz${ISOID}"
# linux /boot/vmlinuz${ISOID} root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} selinux=0 quiet splash ro nomodeset
# echo "Loading /boot/initrd${ISOID}.gz"
# initrd /boot/initrd${ISOID}.gz
# }
#_EOF
# ISOID=$(($ISOID + 1))
#done
ISOID=
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
menuentry "Debug mode (${KERNEL_MAJVER}${K})" {
echo "Loading /boot/vmlinuz${ISOID}"
linux /boot/vmlinuz${ISOID} root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 rddebug
echo "Loading /boot/initrd${ISOID}.gz"
initrd /boot/initrd${ISOID}.gz
}
_EOF
ISOID=$(($ISOID + 1))
done
ISOID=
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
menuentry "Debug mode with nomodeset (${KERNEL_MAJVER}${K})" {
echo "Loading /boot/vmlinuz${ISOID}"
linux /boot/vmlinuz${ISOID} root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 rddebug nomodeset
echo "Loading /boot/initrd${ISOID}.gz"
initrd /boot/initrd${ISOID}.gz
}
_EOF
ISOID=$(($ISOID + 1))
done
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
}
_EOF
# configure isolinux boot loader (obsolete)
cat > $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF cat > $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF
PROMPT 0 PROMPT 0
TIMEOUT 5 TIMEOUT 5
@ -89,11 +173,23 @@ _EOF
ISOID=$(($ISOID + 1)) ISOID=$(($ISOID + 1))
done done
# install memtest
if [ -e $MOUNTDIR/boot/memtest86+.bin ]; then
cp $MOUNTDIR/boot/memtest86+.bin $MOUNTDIR2/boot/memtest
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
menuentry 'Memory test' {
insmod part_gpt
insmod fat
linux16 /boot/memtest
}
_EOF
cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF
MENU SEPARATOR MENU SEPARATOR
LABEL memtest LABEL memtest
MENU LABEL Memory test MENU LABEL Memory test
kernel memtest kernel /boot/memtest
MENU SEPARATOR MENU SEPARATOR
MENU SEPARATOR MENU SEPARATOR
LABEL - LABEL -
@ -101,20 +197,10 @@ LABEL -
MENU DISABLE MENU DISABLE
_EOF _EOF
# install isolinux binary else
[ -e $MOUNTDIR/usr/share/syslinux/isolinux.bin ] && cp $MOUNTDIR/usr/share/syslinux/isolinux.bin $MOUNTDIR2/boot/isolinux/isolinux.bin || echo "Error: /boot/memtest86+.bin not found. Please install the memtest86 package."
{ echo "Error: /usr/share/syslinux/isolinux.bin not found. Please install the syslinux package."; exit 1
exit 1; } fi
# copy syslinux addons to final root /boot dir
for f in ldlinux.c32 libcom32.c32 libutil.c32 libmenu.c32 menu.c32 vesamenu.c32; do
[ -e $MOUNTDIR/usr/share/syslinux/$f ] && cp $MOUNTDIR/usr/share/syslinux/$f $MOUNTDIR2/boot/isolinux/
done
# install memtest
[ -e $MOUNTDIR/boot/memtest86+.bin ] && cp $MOUNTDIR/boot/memtest86+.bin $MOUNTDIR2/boot/isolinux/memtest ||
{ echo "Error: /boot/memtest86+.bin not found. Please install the memtest86 package.";
exit 1; }
# copy static files for specific platform # copy static files for specific platform
[ -e $TARGETDIR/platforms/$PLATFORM/root ] && [ -e $TARGETDIR/platforms/$PLATFORM/root ] &&
@ -141,30 +227,6 @@ grub-mkimage -o $MOUNTDIR2/EFI/BOOT/bootx64.efi -O x86_64-efi -p /EFI/BOOT \
errorAndExit $"Error: unable to create GRUB x86_64-efi image" errorAndExit $"Error: unable to create GRUB x86_64-efi image"
} }
# basic extlinux.conf -> grub.cfg conversion
echo "search --no-floppy --label --set=root openmamba_live" > $MOUNTDIR2/EFI/BOOT/grub.cfg
while read line; do
case $line in
"MENU LABEL "*) [ "$CURR_BRACKET_OPEN" = "1" ] && echo "}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
echo "menuentry \"${line/MENU LABEL }\" {" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
CURR_BRACKET_OPEN=1
;;
"kernel "*) CURR_KERNEL="${line/kernel }"
echo "echo \"Loading ${CURR_KERNEL}\"" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
;;
"append "*) set -- ${line/append initrd=}
CURR_INITRD="$1"
CURR_CMDLINE="${line/append initrd=$CURR_INITRD}"
echo "linux ${CURR_KERNEL} ${CURR_CMDLINE}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
echo "echo \"Loading ${CURR_INITRD}\"" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
echo "initrd ${CURR_INITRD}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
echo "}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
CURR_BRACKET_OPEN=0
;;
esac
done < $MOUNTDIR2/boot/isolinux/isolinux.cfg
[ "$CURR_BRACKET_OPEN" = "1" ] && echo "}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
# #
# EFI support section END # EFI support section END
# #

View File

@ -1,4 +1,5 @@
MEDIA=iso #MEDIA=iso
MEDIA=iso-grub
DISTROMATIC=off DISTROMATIC=off
if [ "$ARCH" = "i586" ]; then if [ "$ARCH" = "i586" ]; then
KERNEL_EXTRAVER=mamba KERNEL_EXTRAVER=mamba

View File

@ -1,4 +1,4 @@
# livecd post script # livedvd post script
# #
# creates a fake installation aimed at producing a kernel image and initrd # creates a fake installation aimed at producing a kernel image and initrd
# for livecd boot # for livecd boot
@ -6,13 +6,14 @@
# make initramfs # make initramfs
[ -e $MOUNTDIR2/boot/isolinux ] || mkdir -p $MOUNTDIR2/boot/isolinux [ -e $MOUNTDIR2/boot/isolinux ] || mkdir -p $MOUNTDIR2/boot/isolinux
[ -e $MOUNTDIR2/boot/grub ] || mkdir -p $MOUNTDIR2/boot/grub
ISOID= ISOID=
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K} chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K}
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
-a dmsquash-live -o squash-live \ -a dmsquash-live -o squash-live \
--filesystems "autofs4 ext3 ext4 overlay squashfs isofs reiserfs" \ --filesystems "autofs4 ext4 overlay squashfs isofs hfsplus nls_utf8" \
--nomdadmconf --nolvmconf \ --nomdadmconf --nolvmconf \
/boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \ /boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \
${KERNEL_MAJVER}${K} ${KERNEL_MAJVER}${K}
@ -33,7 +34,104 @@ done
# add buildinfo # add buildinfo
buildinfo="`cat $MOUNTDIR/etc/openmamba-release` ${PLATFORM}" buildinfo="`cat $MOUNTDIR/etc/openmamba-release` ${PLATFORM}"
# configure isolinux boot loader # configure grub boot loader
cat > $MOUNTDIR2/boot/grub/grub.cfg << _EOF
#
# GRUB configuration generated by openmamba makedist
#
font=unicode
set gfxmode=auto
insmod all_video
insmod gfxterm
insmod gettext
insmod iso9660
insmod biosdisk
terminal_output=gfxterm
timeout=10
# theme
insmod=png
set menu_color_normal=white/black
set menu_color_highlight=white/green
_EOF
#
# Boot entries
#
for l in $MULTILANGUAGE; do
case $l in
"en") LABEL="English"; LOCALELANG="en_US.UTF-8"; VCONSOLEKEYMAP="us" ;;
"it") LABEL="Italiano"; LOCALELANG="it_IT.UTF-8"; VCONSOLEKEYMAP="it" ;;
"fr") LABEL="Français"; LOCALELANG="fr_FR.UTF-8"; VCONSOLEKEYMAP="fr" ;;
"es") LABEL="Español"; LOCALELANG="es_ES.UTF-8"; VCONSOLEKEYMAP="es" ;;
"de") LABEL="Deutsch"; LOCALELANG="de_DE.UTF-8"; VCONSOLEKEYMAP="de" ;;
*) LABEL="$l"
esac
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
submenu "${LABEL}" {
_EOF
ISOID=
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
menuentry "openmamba GNU/Linux (${KERNEL_MAJVER}${K} - ${l})" {
echo "Loading /boot/vmlinuz${ISOID}"
linux /boot/vmlinuz${ISOID} root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} selinux=0 quiet splash ro locale.LANG=$LOCALELANG vconsole.keymap=$VCONSOLEKEYMAP
echo "Loading /boot/initrd${ISOID}.gz"
initrd /boot/initrd${ISOID}.gz
}
_EOF
ISOID=$(($ISOID + 1))
done
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
submenu "Advanced options for openmamba GNU/Linux" {
_EOF
#ISOID=
#for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
# cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
# menuentry "No modeset (${KERNEL_MAJVER}${K})" {
# echo "Loading /boot/vmlinuz${ISOID}"
# linux /boot/vmlinuz${ISOID} root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} selinux=0 quiet splash ro nomodeset
# echo "Loading /boot/initrd${ISOID}.gz"
# initrd /boot/initrd${ISOID}.gz
# }
#_EOF
# ISOID=$(($ISOID + 1))
#done
ISOID=
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
menuentry "Debug mode (${KERNEL_MAJVER}${K} - ${l})" {
echo "Loading /boot/vmlinuz${ISOID}"
linux /boot/vmlinuz${ISOID} root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 rddebug locale.LANG=$LOCALELANG vconsole.keymap=$VCONSOLEKEYMAP
echo "Loading /boot/initrd${ISOID}.gz"
initrd /boot/initrd${ISOID}.gz
}
_EOF
ISOID=$(($ISOID + 1))
done
ISOID=
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
menuentry "Debug mode with nomodeset (${KERNEL_MAJVER}${K} - ${l})" {
echo "Loading /boot/vmlinuz${ISOID}"
linux /boot/vmlinuz${ISOID} root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 rddebug nomodeset locale.LANG=$LOCALELANG vconsole.keymap=$VCONSOLEKEYMAP
echo "Loading /boot/initrd${ISOID}.gz"
initrd /boot/initrd${ISOID}.gz
}
_EOF
ISOID=$(($ISOID + 1))
done
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
}
}
_EOF
# configure isolinux boot loader (obsolete)
cat > $MOUNTDIR2/boot/isolinux/isolinux.cfg.utf8 << _EOF cat > $MOUNTDIR2/boot/isolinux/isolinux.cfg.utf8 << _EOF
PROMPT 0 PROMPT 0
TIMEOUT 20 TIMEOUT 20
@ -113,11 +211,27 @@ MENU END
_EOF _EOF
done done
cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg.utf8 << _EOF # convert isolinux.cfg from UTF-8 to CP437
iconv -f utf-8 -t cp437 $MOUNTDIR2/boot/isolinux/isolinux.cfg.utf8 > $MOUNTDIR2/boot/isolinux/isolinux.cfg
rm -f $MOUNTDIR2/boot/isolinux/isolinux.cfg.utf8
# install memtest
if [ -e $MOUNTDIR/boot/memtest86+.bin ]; then
cp $MOUNTDIR/boot/memtest86+.bin $MOUNTDIR2/boot/memtest
cat >> $MOUNTDIR2/boot/grub/grub.cfg << _EOF
menuentry 'Memory test' {
insmod part_gpt
insmod fat
linux16 /boot/memtest
}
_EOF
cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF
MENU SEPARATOR MENU SEPARATOR
LABEL memtest LABEL memtest
MENU LABEL Memory test MENU LABEL Memory test
kernel memtest kernel /boot/memtest
MENU SEPARATOR MENU SEPARATOR
MENU SEPARATOR MENU SEPARATOR
LABEL - LABEL -
@ -125,24 +239,10 @@ LABEL -
MENU DISABLE MENU DISABLE
_EOF _EOF
# convert isolinux.cfg from UTF-8 to CP437 else
iconv -f utf-8 -t cp437 $MOUNTDIR2/boot/isolinux/isolinux.cfg.utf8 > $MOUNTDIR2/boot/isolinux/isolinux.cfg echo "Error: /boot/memtest86+.bin not found. Please install the memtest86 package."
rm -f $MOUNTDIR2/boot/isolinux/isolinux.cfg.utf8 exit 1
fi
# install isolinux binary
[ -e $MOUNTDIR/usr/share/syslinux/isolinux.bin ] && cp $MOUNTDIR/usr/share/syslinux/isolinux.bin $MOUNTDIR2/boot/isolinux/isolinux.bin ||
{ echo "Error: /usr/share/syslinux/isolinux.bin not found. Please install the syslinux package.";
exit 1; }
# copy syslinux addons to final root /boot dir
for f in ldlinux.c32 libcom32.c32 libutil.c32 libmenu.c32 menu.c32 vesamenu.c32; do
[ -e $MOUNTDIR/usr/share/syslinux/$f ] && cp $MOUNTDIR/usr/share/syslinux/$f $MOUNTDIR2/boot/isolinux/
done
# install memtest
[ -e $MOUNTDIR/boot/memtest86+.bin ] && cp $MOUNTDIR/boot/memtest86+.bin $MOUNTDIR2/boot/isolinux/memtest ||
{ echo "Error: /boot/memtest.bin not found. Please install the memtest86 package.";
exit 1; }
# copy static files for specific platform # copy static files for specific platform
[ -e $TARGETDIR/platforms/$PLATFORM/root ] && [ -e $TARGETDIR/platforms/$PLATFORM/root ] &&
@ -169,30 +269,6 @@ grub-mkimage -o $MOUNTDIR2/EFI/BOOT/bootx64.efi -O x86_64-efi -p /EFI/BOOT \
errorAndExit $"Error: unable to create GRUB x86_64-efi image" errorAndExit $"Error: unable to create GRUB x86_64-efi image"
} }
# basic extlinux.conf -> grub.cfg conversion
echo "search --no-floppy --label --set=root openmamba_live" > $MOUNTDIR2/EFI/BOOT/grub.cfg
while read line; do
case $line in
"MENU LABEL "*) [ "$CURR_BRACKET_OPEN" = "1" ] && echo "}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
echo "menuentry \"${line/MENU LABEL }\" {" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
CURR_BRACKET_OPEN=1
;;
"kernel "*) CURR_KERNEL="${line/kernel }"
echo "echo \"Loading ${CURR_KERNEL}\"" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
;;
"append "*) set -- ${line/append initrd=}
CURR_INITRD="$1"
CURR_CMDLINE="${line/append initrd=$CURR_INITRD}"
echo "linux ${CURR_KERNEL} ${CURR_CMDLINE}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
echo "echo \"Loading ${CURR_INITRD}\"" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
echo "initrd ${CURR_INITRD}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
echo "}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
CURR_BRACKET_OPEN=0
;;
esac
done < $MOUNTDIR2/boot/isolinux/isolinux.cfg
[ "$CURR_BRACKET_OPEN" = "1" ] && echo "}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
# #
# EFI support section END # EFI support section END
# #

View File

@ -1,4 +1,4 @@
MEDIA=iso MEDIA=iso-grub
MULTILANGUAGE="en it es fr de" MULTILANGUAGE="en it es fr de"
DISTROMATIC=off DISTROMATIC=off