mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-01 21:23:51 -09:00
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 <fancp2007@gmail.com> [Julien: - add .in suffix to genimage.cfg and grub.cfg template file names - change UUID_TMP template variable to %PARTUUID% - use human readable partition-type-uuid in genimage.cfg.in - break long qemu-system-x86_64 command line in readme.txt - add "-serial stdio" in readme.txt qemu command line for CI ] Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
committed by
Julien Olivain
parent
f5a99c4e91
commit
dd84d05843
32
board/qemu/x86_64-efi/genimage.cfg.in
Normal file
32
board/qemu/x86_64-efi/genimage.cfg.in
Normal file
@@ -0,0 +1,32 @@
|
||||
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 {
|
||||
partition-type-uuid = root-x86-64
|
||||
partition-uuid = %PARTUUID%
|
||||
image = "rootfs.ext2"
|
||||
}
|
||||
}
|
||||
6
board/qemu/x86_64-efi/grub.cfg.in
Normal file
6
board/qemu/x86_64-efi/grub.cfg.in
Normal file
@@ -0,0 +1,6 @@
|
||||
set default="0"
|
||||
set timeout="5"
|
||||
|
||||
menuentry "Buildroot" {
|
||||
linux /bzImage root=PARTUUID=%PARTUUID% rootwait console=tty1 console=ttyS0
|
||||
}
|
||||
59
board/qemu/x86_64-efi/linux.config
Normal file
59
board/qemu/x86_64-efi/linux.config
Normal file
@@ -0,0 +1,59 @@
|
||||
CONFIG_SYSVIPC=y
|
||||
CONFIG_SMP=y
|
||||
CONFIG_HYPERVISOR_GUEST=y
|
||||
CONFIG_PARAVIRT=y
|
||||
CONFIG_EFI=y
|
||||
# CONFIG_GCC_PLUGINS is not set
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_MODULE_UNLOAD=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_PACKET=y
|
||||
CONFIG_UNIX=y
|
||||
CONFIG_INET=y
|
||||
# CONFIG_WIRELESS is not set
|
||||
CONFIG_PCI=y
|
||||
CONFIG_DEVTMPFS=y
|
||||
CONFIG_DEVTMPFS_MOUNT=y
|
||||
CONFIG_VIRTIO_BLK=y
|
||||
CONFIG_BLK_DEV_SD=y
|
||||
CONFIG_SCSI_VIRTIO=y
|
||||
CONFIG_ATA=y
|
||||
CONFIG_ATA_PIIX=y
|
||||
CONFIG_NETDEVICES=y
|
||||
CONFIG_VIRTIO_NET=y
|
||||
CONFIG_NE2K_PCI=y
|
||||
CONFIG_8139CP=y
|
||||
# CONFIG_WLAN is not set
|
||||
CONFIG_INPUT_EVDEV=y
|
||||
CONFIG_SERIAL_8250=y
|
||||
CONFIG_SERIAL_8250_CONSOLE=y
|
||||
CONFIG_VIRTIO_CONSOLE=y
|
||||
CONFIG_HW_RANDOM_VIRTIO=m
|
||||
CONFIG_DRM=y
|
||||
CONFIG_DRM_I915=y
|
||||
CONFIG_DRM_QXL=y
|
||||
CONFIG_DRM_VIRTIO_GPU=y
|
||||
CONFIG_DRM_BOCHS=y
|
||||
CONFIG_FB=y
|
||||
CONFIG_FB_VESA=y
|
||||
CONFIG_FB_EFI=y
|
||||
CONFIG_FIRMWARE_EDID=y
|
||||
CONFIG_SOUND=y
|
||||
CONFIG_SND=y
|
||||
CONFIG_SND_HDA_INTEL=y
|
||||
CONFIG_SND_HDA_GENERIC=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_XHCI_HCD=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_UHCI_HCD=y
|
||||
CONFIG_USB_STORAGE=y
|
||||
CONFIG_VIRTIO_PCI=y
|
||||
CONFIG_VIRTIO_BALLOON=y
|
||||
CONFIG_VIRTIO_INPUT=y
|
||||
CONFIG_VIRTIO_MMIO=y
|
||||
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
|
||||
CONFIG_EXT4_FS=y
|
||||
CONFIG_FUSE_FS=y
|
||||
CONFIG_TMPFS_POSIX_ACL=y
|
||||
CONFIG_SQUASHFS=y
|
||||
CONFIG_UNWINDER_FRAME_POINTER=y
|
||||
11
board/qemu/x86_64-efi/post-build.sh
Executable file
11
board/qemu/x86_64-efi/post-build.sh
Executable file
@@ -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
|
||||
8
board/qemu/x86_64-efi/post-image.sh
Executable file
8
board/qemu/x86_64-efi/post-image.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
BOARD_DIR="$(dirname "$0")"
|
||||
|
||||
PARTUUID=$(dumpe2fs "${BINARIES_DIR}/rootfs.ext2" 2>/dev/null | sed -n 's/^Filesystem UUID: *\(.*\)/\1/p')
|
||||
sed "s/%PARTUUID%/$PARTUUID/g" "${BOARD_DIR}/grub.cfg.in" > "${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg"
|
||||
sed "s/%PARTUUID%/$PARTUUID/g" "${BOARD_DIR}/genimage.cfg.in" > "${BINARIES_DIR}/genimage.cfg"
|
||||
support/scripts/genimage.sh -c "${BINARIES_DIR}/genimage.cfg"
|
||||
28
board/qemu/x86_64-efi/readme.txt
Normal file
28
board/qemu/x86_64-efi/readme.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
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 \
|
||||
-serial stdio \
|
||||
-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.
|
||||
25
configs/qemu_x86_64_efi_defconfig
Normal file
25
configs/qemu_x86_64_efi_defconfig
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user