Skip to content
Snippets Groups Projects
Commit acd1cd8f authored by Timo Teräs's avatar Timo Teräs
Browse files

scripts/mkimg.base: add efi loaders to the iso image

Strictly the 'efi' folder is not needed since it's in the efi.img.
However, converting .iso to USB stick is a lot simpler when the
EFI folder is in the .iso too. This allows just copying .iso contents
to the USB stick and EFI boot will work. While Rufus supports
extracting the boot files from efi.img, it was considered more
portable to add the copy. This also simplifies updating setup-bootable
to prepare EFI bootable disks.
parent 8959fb7c
No related branches found
No related tags found
No related merge requests found
...@@ -165,28 +165,20 @@ grub_gen_earlyconf() { ...@@ -165,28 +165,20 @@ grub_gen_earlyconf() {
EOF EOF
} }
build_grubefi_img() { build_grub_efi() {
local _format="$1" local _format="$1"
local _efi="$2" local _efi="$2"
local _tmpdir="$WORKDIR/efiboot.$3"
# extra packages needed: grub-efi mtools
# Prepare grub-efi bootloader # Prepare grub-efi bootloader
mkdir -p "$_tmpdir/efi/boot" mkdir -p "$DESTDIR/efi/boot"
grub_gen_earlyconf > "$_tmpdir"/grub_early.cfg grub_gen_earlyconf > "$WORKDIR/grub_early.$3.cfg"
grub-mkimage \ grub-mkimage \
--config="$_tmpdir"/grub_early.cfg \ --config="$WORKDIR/grub_early.$3.cfg" \
--prefix="/boot/grub" \ --prefix="/boot/grub" \
--output="$_tmpdir/efi/boot/$_efi" \ --output="$DESTDIR/efi/boot/$_efi" \
--format="$_format" \ --format="$_format" \
--compression="xz" \ --compression="xz" \
$grub_mod $grub_mod
# Create the EFI image
mkdir -p ${DESTDIR}/boot/grub/
mformat -i ${DESTDIR}/boot/grub/efi.img -C -f 1440 ::
mcopy -i ${DESTDIR}/boot/grub/efi.img -s $_tmpdir/efi ::
} }
section_grubieee1275() { section_grubieee1275() {
...@@ -197,7 +189,7 @@ section_grubieee1275() { ...@@ -197,7 +189,7 @@ section_grubieee1275() {
build_section grub_cfg boot/grub/grub.cfg $(grub_gen_config | checksum) build_section grub_cfg boot/grub/grub.cfg $(grub_gen_config | checksum)
} }
section_grubefi() { section_grub_efi() {
[ -n "$grub_mod" ] || return 0 [ -n "$grub_mod" ] || return 0
[ "$output_format" = "iso" ] || return 0 [ "$output_format" = "iso" ] || return 0
...@@ -217,7 +209,7 @@ section_grubefi() { ...@@ -217,7 +209,7 @@ section_grubefi() {
esac esac
build_section grub_cfg boot/grub/grub.cfg $(grub_gen_config | checksum) build_section grub_cfg boot/grub/grub.cfg $(grub_gen_config | checksum)
build_section grubefi_img $_format $_efi $(grub_gen_earlyconf | checksum) build_section grub_efi $_format $_efi $(grub_gen_earlyconf | checksum)
} }
create_image_iso() { create_image_iso() {
...@@ -236,8 +228,12 @@ create_image_iso() { ...@@ -236,8 +228,12 @@ create_image_iso() {
-boot-info-table -boot-info-table
" "
fi fi
if [ -e "${DESTDIR}/boot/grub/efi.img" ]; then if [ -e "${DESTDIR}/efi" -a -e "${DESTDIR}/boot/grub" ]; then
# efi boot enabled # Create the EFI boot partition image
mformat -i ${DESTDIR}/boot/grub/efi.img -C -f 1440 ::
mcopy -i ${DESTDIR}/boot/grub/efi.img -s ${DESTDIR}/efi ::
# Enable EFI boot
if [ -z "$_isolinux" ]; then if [ -z "$_isolinux" ]; then
# efi boot only # efi boot only
_efiboot=" _efiboot="
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment