configs/qemu_x86_64_efi_defconfig: new defconfig
PATCH 1/1 configs/qemu_x86_64_efi_defconfig: new defconfig
This defconfig enables EDK2 UEFI firmware and grub2 x86_64-efi boot of a Linux Kernel in QEMU virt machine.
Signed-off-by Scott Fan <[email protected]>
--- board/qemu/x86_64-efi/genimage.cfg | 35 +++++++++++++++++ board/qemu/x86_64-efi/grub.cfg | 6 +++ board/qemu/x86_64-efi/linux.config | 59 +++++++++++++++++++++++++++++ board/qemu/x86_64-efi/post-build.sh | 11 ++++++ board/qemu/x86_64-efi/post-image.sh | 8 ++++ board/qemu/x86_64-efi/readme.txt | 21 ++++++++++ configs/qemu_x86_64_efi_defconfig | 25 ++++++++++++ 7 files changed, 165 insertions(+) create mode 100644 board/qemu/x86_64-efi/genimage.cfg create mode 100644 board/qemu/x86_64-efi/grub.cfg create mode 100644 board/qemu/x86_64-efi/linux.config create mode 100755 board/qemu/x86_64-efi/post-build.sh create mode 100755 board/qemu/x86_64-efi/post-image.sh create mode 100644 board/qemu/x86_64-efi/readme.txt create mode 100644 configs/qemu_x86_64_efi_defconfig
board/qemu/x86_64-efi/genimage.cfg new file +35 -0
@@ -0,0 +1,35 @@ +image efi-part.vfat { + vfat { + file EFI { + image = "efi-part/EFI" + } + + file bzImage { + image = "bzImage" + } + } + + size = 16352K # 16MB - 32KB +} + +image disk.img { + hdimage { + partition-table-type = "gpt" + } + + partition boot { + image = "efi-part.vfat" + partition-type-uuid = U + offset = 32K + bootable = true + } + + partition root { + # For partition-type-uuid value, see: + # https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ + # SD_GPT_ROOT_X86_64 + partition-type-uuid = 4f68bce3-e8cd-4db1-96e7-fbcaf984b709 + partition-uuid = UUID_TMP + image = "rootfs.ext2" + } +}
board/qemu/x86_64-efi/grub.cfg new file +6 -0
@@ -0,0 +1,6 @@ +set default="0" +set timeout="5" + +menuentry "Buildroot" { + linux /bzImage root=PARTUUID=UUID_TMP rootwait console=tty1 console=ttyS0 +}
board/qemu/x86_64-efi/linux.config new file +59 -0
59 lines not on this page · raw message
board/qemu/x86_64-efi/post-build.sh new file +11 -0
@@ -0,0 +1,11 @@ +#!/bin/sh + +set -u +set -e + +# Add a console on tty1 +if [ -e "${TARGET_DIR}/etc/inittab" ]; then + grep -qE '^tty1::' "${TARGET_DIR}/etc/inittab" || \ + sed -i '/GENERIC_SERIAL/a\ +tty1::respawn:/sbin/getty -L tty1 0 vt100 # QEMU graphical window' "${TARGET_DIR}/etc/inittab" +fi
board/qemu/x86_64-efi/post-image.sh new file +8 -0
@@ -0,0 +1,8 @@ +#!/bin/sh + +BOARD_DIR="$(dirname "$0")" + +UUID=$(dumpe2fs "${BINARIES_DIR}/rootfs.ext2" 2>/dev/null | sed -n 's/^Filesystem UUID: *\(.*\)/\1/p') +sed "s/UUID_TMP/$UUID/g" "${BOARD_DIR}/grub.cfg" > "${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg" +sed "s/UUID_TMP/$UUID/g" "${BOARD_DIR}/genimage.cfg" > "${BINARIES_DIR}/genimage.cfg" +support/scripts/genimage.sh -c "${BINARIES_DIR}/genimage.cfg"
board/qemu/x86_64-efi/readme.txt new file +21 -0
@@ -0,0 +1,21 @@ +Intro +===== + +This is a x86_64 UEFI Linux boot demo in QEMU virt machine. + +Build +===== + + make qemu_x86_64_efi_defconfig + make + +Emulation +========= + +Run the emulation with: + + qemu-system-x86_64 -M pc -m 1024 -bios output/images/OVMF.fd -drive file=output/images/disk.img,format=raw -netdev user,id=net0 -device virtio-net-pci,netdev=net0 # qemu_x86_64_efi_defconfig + +Optionally add -smp N to emulate a SMP system with N CPUs. + +The login prompt will appear in the graphical window.
configs/qemu_x86_64_efi_defconfig new file +25 -0
@@ -0,0 +1,25 @@ +BR2_x86_64=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y +BR2_GLOBAL_PATCH_DIR="board/qemu/patches" +BR2_DOWNLOAD_FORCE_CHECK_HASHES=y +BR2_SYSTEM_DHCP="eth0" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86_64-efi/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh board/qemu/x86_64-efi/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.47" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86_64-efi/linux.config" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y +BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y +BR2_TARGET_ROOTFS_EXT2=y +# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_EDK2=y +BR2_TARGET_GRUB2=y +BR2_TARGET_GRUB2_X86_64_EFI=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_QEMU=y +BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
Signature · 6 lines
2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Julien Olivain via buildroot
AppliedQuoted 4 lines · Scott Fan
This defconfig enables EDK2 UEFI firmware and grub2 x86_64-efi boot of a Linux Kernel in QEMU virt machine.
Signed-off-by Scott Fan <[email protected]>
Applied to master, thanks. For info, I made few minor changes. See:
https://gitlab.com/buildroot.org/buildroot/-/commit/dd84d0584393a5f9209120bf83fcb62c86b4947f
Best regards,
Julien.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot