diff --git a/platforms/livecd/Makefile b/platforms/livecd/Makefile index 1ca514e..e8b6eed 100644 --- a/platforms/livecd/Makefile +++ b/platforms/livecd/Makefile @@ -1,4 +1,4 @@ -$(MAKEDIST_TARGET)-livecd: openmamba-release memtest86+ syslinux macbook-tools dracut +$(MAKEDIST_TARGET)-livecd: openmamba-release memtest86+ syslinux macbook-tools dracut grub-efi-x86_64 # Localized targets $(MAKEDIST_TARGET)-livecd-en: $(MAKEDIST_TARGET)-livecd-it: diff --git a/platforms/livecd/post.inc.sh b/platforms/livecd/post.inc.sh index 486ecf5..67aaf7e 100644 --- a/platforms/livecd/post.inc.sh +++ b/platforms/livecd/post.inc.sh @@ -122,6 +122,47 @@ cp $MOUNTDIR/usr/share/syslinux/vesamenu.c32 $MOUNTDIR2/boot/isolinux/ buildinfo="`cat $MOUNTDIR/etc/openmamba-release` [$PRODUCT_NAME build:`date +%c`]" sed -i "s|%buildinfo%|$buildinfo|" $MOUNTDIR2/boot/isolinux/menu.txt +# +# EFI support section BEGIN +# + +# create EFI grub 32 and 64 bit images +mkdir -p $MOUNTDIR2/EFI/BOOT/ +grub-mkimage -o $MOUNTDIR2/EFI/BOOT/bootx64.efi -O x86_64-efi -p /EFI/BOOT \ + part_gpt part_msdos ntfs ntfscomp hfsplus fat ext2 normal chain boot linux echo \ + help gfxterm gettext png efi_gop efi_uga search search_label search_fs_uuid \ + iso9660 configfile || { + 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 +# + #echo "Adding binary packages from pkggroups.db..." #. $LOCALSTATEDIR/.${MEDIA_NAMES[0]}.distinfo #LANG=${LANGUAGE:0:2} . $MOUNTDIR/usr/share/openmamba/pkggroups.db diff --git a/platforms/livedvd/Makefile b/platforms/livedvd/Makefile index f3170a2..40cfedc 100644 --- a/platforms/livedvd/Makefile +++ b/platforms/livedvd/Makefile @@ -1,4 +1,4 @@ -$(MAKEDIST_TARGET)-livedvd: openmamba-release memtest86+ syslinux macbook-tools +$(MAKEDIST_TARGET)-livedvd: openmamba-release memtest86+ syslinux macbook-tools dracut grub-efi-x86_64 # Localized targets $(MAKEDIST_TARGET)-livedvd-en: $(MAKEDIST_TARGET)-livedvd-it: diff --git a/platforms/livedvd/post.inc.sh b/platforms/livedvd/post.inc.sh index ef67465..8bc2903 100644 --- a/platforms/livedvd/post.inc.sh +++ b/platforms/livedvd/post.inc.sh @@ -150,6 +150,47 @@ cp $MOUNTDIR/usr/share/syslinux/vesamenu.c32 $MOUNTDIR2/boot/isolinux/ buildinfo="`cat $MOUNTDIR/etc/openmamba-release` [$PRODUCT_NAME build:`date +%c`]" sed -i "s|%buildinfo%|$buildinfo|" $MOUNTDIR2/boot/isolinux/menu.txt +# +# EFI support section BEGIN +# + +# create EFI grub 32 and 64 bit images +mkdir -p $MOUNTDIR2/EFI/BOOT/ +grub-mkimage -o $MOUNTDIR2/EFI/BOOT/bootx64.efi -O x86_64-efi -p /EFI/BOOT \ + part_gpt part_msdos ntfs ntfscomp hfsplus fat ext2 normal chain boot linux echo \ + help gfxterm gettext png efi_gop efi_uga search search_label search_fs_uuid \ + iso9660 configfile || { + 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 +# + #echo "Adding binary packages from pkggroups.db..." #. $LOCALSTATEDIR/.${MEDIA_NAMES[0]}.distinfo #LANG=${LANGUAGE:0:2} . $MOUNTDIR/usr/share/openmamba/pkggroups.db