Merge "Add UEFI dual-boot for image-builder ISO"
This commit is contained in:
commit
3ad2f936c4
@ -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 \
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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/
|
||||
|
@ -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 \
|
||||
|
Loading…
x
Reference in New Issue
Block a user