Control: tags -1 + patch Hi Gunnar, in response to your message,
From: Gunnar Wolf <gw...@debian.org> Subject: Re: Bug#973467: vmdb2 tries to install grub-pc or grub-efi-amd64 on arm64 and does not work on arm64 Date: Sat, 7 Nov 2020 23:33:01 -0600 > As you said here, the workaround is not a fix, as it would make vmdb2 > produce images unable to boot on amd64 - So I'm removing the "patch" > tag. I am also adding the tags "confirmed" and "upstream", as the > comments in the file in question mention: I made the attached patch against the latest upstream git source as attached. I also add "patch" tag to this bts. As far as I tested, the patch seems working well. I also added bind-mount of /proc and /dev/pts as recent version of grub seems to use them. uefi-arm64.vmdb is a test file corresponding to the original uefi.vmdb. Ryutaroh
--- vmdb-git-20201118/vmdb2/vmdb/plugins/grub_plugin.py-orig 2020-11-18 09:34:51.093900848 +0900 +++ vmdb-git-20201118/vmdb2/vmdb/plugins/grub_plugin.py 2020-11-18 12:41:30.056459254 +0900 @@ -93,6 +93,7 @@ "image-dev": "", "quiet": False, "timeout": 0, + "arch": "amd64", } def run(self, values, settings, state): @@ -111,9 +112,23 @@ if efi is None and efi_part is None: raise Exception('"efi" or "efi-part" required in UEFI GRUB installation') + arch = values["arch"] + if arch == "amd64": + grub_package = "grub-efi-amd64" + grub_target = "x86_64-efi" + elif arch == "i386" or arch == "x32": + grub_package = "grub-efi-ia32" + grub_target = "i386-efi" + elif arch == "arm64": + grub_package = "grub-efi-arm64" + grub_target = "arm64-efi" + elif arch == "armhf" or arch == "armel": + grub_package = "grub-efi-arm" + grub_target = "arm-efi" + else: + raise Exception('Currently unsupported architecture for Grub UEFI.') + vmdb.progress("Installing GRUB for UEFI") - grub_package = "grub-efi-amd64" - grub_target = "x86_64-efi" self.install_grub(values, settings, state, grub_package, grub_target) def install_bios(self, values, settings, state): @@ -144,7 +159,7 @@ quiet = values["quiet"] - self.bind_mount_many(chroot, ["/dev", "/sys"], state) + self.bind_mount_many(chroot, ["/dev", "/sys", "/proc", "/dev/pts"], state) if efi_dev: self.mount(chroot, efi_dev, "/boot/efi", state) self.install_package(chroot, grub_package) --- vmdb-git-20201118/vmdb2/vmdb/plugins/grub.mdwn-orig 2020-11-18 13:32:55.989389129 +0900 +++ vmdb-git-20201118/vmdb2/vmdb/plugins/grub.mdwn 2020-11-18 13:36:27.762255325 +0900 @@ -30,6 +30,9 @@ * `timeout` — OPTIONAL; set the grub menu timeout, in seconds. Defaults to 0 seconds. +* `arch` — OPTIONAL; set the target architecture of grub-efi. + Defaults to amd64. Currently, amd64, i386, x32, arm64, armhf and armel are supported. + Example (in the .vmdb file): - grub: bios @@ -41,6 +44,7 @@ tag: root efi: efi console: serial + arch: i386 Install to a real hard disk (named with the `--image` option): @@ -48,3 +52,4 @@ tag: root efi: efi image-dev: "{{ image }}" + arch: arm64 --- /dev/null 2020-11-18 12:39:50.085968484 +0900 +++ vmdb-git-20201118/vmdb2/uefi-arm64.vmdb 2020-11-18 13:00:06.591549633 +0900 @@ -0,0 +1,62 @@ +# This is a sample VMDB2 input file that specifies a simple system for +# a PC that boots with UEFI. + +steps: + - mkimg: "{{ output }}" + size: 4G + + - mklabel: gpt + device: "{{ output }}" + + - mkpart: primary + device: "{{ output }}" + start: 0% + end: 1G + tag: efi + fs-type: 'fat32' + + - mkpart: primary + device: "{{ output }}" + start: 1G + end: 100% + tag: / + fs-type: 'ext4' + + - kpartx: "{{ output }}" + + - mkfs: vfat + partition: efi + + - mkfs: ext4 + partition: / + + - mount: / + + + - unpack-rootfs: / + + - qemu-debootstrap: bullseye + mirror: http://deb.debian.org/debian + arch: arm64 + target: / + unless: rootfs_unpacked + + - apt: install + packages: + - linux-image-arm64 + fs-tag: / + unless: rootfs_unpacked + + - cache-rootfs: / + unless: rootfs_unpacked + + - chroot: / + shell: | + echo uefi-vmdb2 > /etc/hostname + + - fstab: / + + - grub: uefi + tag: / + efi: efi + arch: arm64