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 ;\
|
RUN apt-get update ;\
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
|
dosfstools \
|
||||||
|
mtools \
|
||||||
squashfs-tools \
|
squashfs-tools \
|
||||||
grub-common \
|
grub-common \
|
||||||
grub2-common \
|
grub2-common \
|
||||||
|
@ -24,7 +24,7 @@ PUSH_IMAGE ?= false
|
|||||||
DISTRO ?= ubuntu_focal
|
DISTRO ?= ubuntu_focal
|
||||||
IMAGE ?= ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO}
|
IMAGE ?= ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO}
|
||||||
IMAGE_ALIAS ?= $(DOCKER_REGISTRY)-$(IMAGE_NAME)-$(IMAGE_TAG)-${DISTRO}-${IMAGE_TYPE}
|
IMAGE_ALIAS ?= $(DOCKER_REGISTRY)-$(IMAGE_NAME)-$(IMAGE_TAG)-${DISTRO}-${IMAGE_TYPE}
|
||||||
UEFI_BOOT ?=
|
UEFI_BOOT ?= true
|
||||||
PROXY ?=
|
PROXY ?=
|
||||||
NO_PROXY ?= localhost,127.0.0.1
|
NO_PROXY ?= localhost,127.0.0.1
|
||||||
|
|
||||||
|
@ -13,17 +13,23 @@
|
|||||||
shell:
|
shell:
|
||||||
cmd: |
|
cmd: |
|
||||||
xorriso \
|
xorriso \
|
||||||
-as mkisofs \
|
-as mkisofs \
|
||||||
-iso-level 3 \
|
-iso-level 3 \
|
||||||
-full-iso9660-filenames \
|
-full-iso9660-filenames \
|
||||||
-volid "config-2" \
|
-volid "config-2" \
|
||||||
--grub2-boot-info \
|
-eltorito-boot boot/grub/bios.img \
|
||||||
--grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img \
|
-no-emul-boot \
|
||||||
-eltorito-boot boot/grub/bios.img \
|
-boot-load-size 4 \
|
||||||
-no-emul-boot \
|
-boot-info-table \
|
||||||
-boot-load-size 4 \
|
--eltorito-catalog boot/grub/boot.cat \
|
||||||
-boot-info-table \
|
--grub2-boot-info \
|
||||||
--eltorito-catalog boot/grub/boot.cat \
|
--grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img \
|
||||||
-output {{ img_output_dir }}/{{ img_name }} \
|
-eltorito-alt-boot \
|
||||||
-graft-points \
|
-e EFI/efiboot.img \
|
||||||
{{ root_image }}
|
-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:
|
template:
|
||||||
src: grub-livecd.cfg.j2
|
src: grub-livecd.cfg.j2
|
||||||
dest: "{{ bootimg_builddir.path }}/grub.cfg"
|
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:
|
shell:
|
||||||
cmd: |
|
cmd: |
|
||||||
grub-mkstandalone \
|
grub-mkstandalone \
|
||||||
@ -47,7 +68,6 @@
|
|||||||
--fonts="" \
|
--fonts="" \
|
||||||
boot/grub/grub.cfg="{{ bootimg_builddir.path }}/grub.cfg"
|
boot/grub/grub.cfg="{{ bootimg_builddir.path }}/grub.cfg"
|
||||||
|
|
||||||
|
|
||||||
- name: "ensuring directory {{ root_image }}/boot/grub exists"
|
- name: "ensuring directory {{ root_image }}/boot/grub exists"
|
||||||
file:
|
file:
|
||||||
path: "{{ root_image }}/boot/grub"
|
path: "{{ root_image }}/boot/grub"
|
||||||
@ -55,5 +75,6 @@
|
|||||||
mode: '0755'
|
mode: '0755'
|
||||||
- name: "assembling boot img"
|
- name: "assembling boot img"
|
||||||
shell:
|
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 \
|
--env NO_PROXY=$noproxy \
|
||||||
${image}
|
${image}
|
||||||
disk1="--disk path=${workdir}/ephemeral.iso,device=cdrom"
|
disk1="--disk path=${workdir}/ephemeral.iso,device=cdrom"
|
||||||
|
uefi_boot_arg='--boot uefi'
|
||||||
elif [[ $build_type == qcow ]]; then
|
elif [[ $build_type == qcow ]]; then
|
||||||
sudo -E modprobe nbd
|
sudo -E modprobe nbd
|
||||||
sudo -E docker run -t --rm \
|
sudo -E docker run -t --rm \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user