diff --git a/image-builder/Dockerfile.ubuntu_focal b/image-builder/Dockerfile.ubuntu_focal index 0d4964a..86a91f8 100644 --- a/image-builder/Dockerfile.ubuntu_focal +++ b/image-builder/Dockerfile.ubuntu_focal @@ -56,6 +56,8 @@ ENV boot_src="/opt/grub" RUN apt-get update ;\ apt-get install -y --no-install-recommends \ + dosfstools \ + mtools \ squashfs-tools \ grub-common \ grub2-common \ diff --git a/image-builder/Makefile b/image-builder/Makefile index 012d9dc..648a992 100644 --- a/image-builder/Makefile +++ b/image-builder/Makefile @@ -24,7 +24,7 @@ PUSH_IMAGE ?= false DISTRO ?= ubuntu_focal IMAGE ?= ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO} IMAGE_ALIAS ?= $(DOCKER_REGISTRY)-$(IMAGE_NAME)-$(IMAGE_TAG)-${DISTRO}-${IMAGE_TYPE} -UEFI_BOOT ?= +UEFI_BOOT ?= true PROXY ?= NO_PROXY ?= localhost,127.0.0.1 diff --git a/image-builder/assets/playbooks/roles/iso/tasks/iso.yaml b/image-builder/assets/playbooks/roles/iso/tasks/iso.yaml index dfb5878..bcb6bce 100644 --- a/image-builder/assets/playbooks/roles/iso/tasks/iso.yaml +++ b/image-builder/assets/playbooks/roles/iso/tasks/iso.yaml @@ -13,17 +13,23 @@ shell: cmd: | xorriso \ - -as mkisofs \ - -iso-level 3 \ - -full-iso9660-filenames \ - -volid "config-2" \ - --grub2-boot-info \ - --grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img \ - -eltorito-boot boot/grub/bios.img \ - -no-emul-boot \ - -boot-load-size 4 \ - -boot-info-table \ - --eltorito-catalog boot/grub/boot.cat \ - -output {{ img_output_dir }}/{{ img_name }} \ - -graft-points \ - {{ root_image }} + -as mkisofs \ + -iso-level 3 \ + -full-iso9660-filenames \ + -volid "config-2" \ + -eltorito-boot boot/grub/bios.img \ + -no-emul-boot \ + -boot-load-size 4 \ + -boot-info-table \ + --eltorito-catalog boot/grub/boot.cat \ + --grub2-boot-info \ + --grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img \ + -eltorito-alt-boot \ + -e EFI/efiboot.img \ + -no-emul-boot \ + -append_partition 2 0xef {{ root_image }}/boot/grub/efiboot.img \ + -output {{ img_output_dir }}/{{ img_name }} \ + -graft-points \ + {{ root_image }} \ + /boot/grub/bios.img={{ root_image }}/boot/grub/bios.img \ + /EFI/efiboot.img={{ root_image }}/boot/grub/efiboot.img diff --git a/image-builder/assets/playbooks/roles/livecdcontent/tasks/livecd.yaml b/image-builder/assets/playbooks/roles/livecdcontent/tasks/livecd.yaml index 8cf4f57..d0b045f 100644 --- a/image-builder/assets/playbooks/roles/livecdcontent/tasks/livecd.yaml +++ b/image-builder/assets/playbooks/roles/livecdcontent/tasks/livecd.yaml @@ -35,7 +35,28 @@ template: src: grub-livecd.cfg.j2 dest: "{{ bootimg_builddir.path }}/grub.cfg" -- name: "making standalone grub" + +- name: "making standalone grub - efi" + shell: + cmd: | + grub-mkstandalone \ + --format=x86_64-efi \ + --output="{{ bootimg_builddir.path }}/bootx64.efi" \ + --locales="" \ + --fonts="" \ + boot/grub/grub.cfg="{{ bootimg_builddir.path }}/grub.cfg" + +- name: "setup efi filesystem" + shell: + cmd: | + set -e + cd {{ bootimg_builddir.path }} + dd if=/dev/zero of=efiboot.img bs=1M count=10 + mkfs.vfat efiboot.img + LC_CTYPE=C mmd -i efiboot.img efi efi/boot + LC_CTYPE=C mcopy -i efiboot.img ./bootx64.efi ::efi/boot/ + +- name: "making standalone grub - legacy" shell: cmd: | grub-mkstandalone \ @@ -47,7 +68,6 @@ --fonts="" \ boot/grub/grub.cfg="{{ bootimg_builddir.path }}/grub.cfg" - - name: "ensuring directory {{ root_image }}/boot/grub exists" file: path: "{{ root_image }}/boot/grub" @@ -55,5 +75,6 @@ mode: '0755' - name: "assembling boot img" shell: - cmd: cat /usr/lib/grub/i386-pc/cdboot.img {{ bootimg_builddir.path }}/core.img > {{ root_image }}/boot/grub/bios.img - + cmd: | + cat /usr/lib/grub/i386-pc/cdboot.img {{ bootimg_builddir.path }}/core.img > {{ root_image }}/boot/grub/bios.img + cp {{ bootimg_builddir.path }}/efiboot.img {{ root_image }}/boot/grub/ diff --git a/image-builder/tools/cut_image.sh b/image-builder/tools/cut_image.sh index b21a3cc..9288170 100755 --- a/image-builder/tools/cut_image.sh +++ b/image-builder/tools/cut_image.sh @@ -58,6 +58,7 @@ if [[ $build_type = iso ]]; then --env NO_PROXY=$noproxy \ ${image} disk1="--disk path=${workdir}/ephemeral.iso,device=cdrom" + uefi_boot_arg='--boot uefi' elif [[ $build_type == qcow ]]; then sudo -E modprobe nbd sudo -E docker run -t --rm \