mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-03-16 23:07:00 +00:00
Merge branch '2023-08-24-enable-more-features-in-qemu-arm' into next
To quote the author: Now that the driver for the Bochs VGA card emulated by QEMU is no longer limited to x86 architectures, this series enables it on arm and arm64 virtual machines to provide a graphical interface. In line with that series this also enables console buffering and USB keyboard. Tested with the Debian 12 installer using GRUB EFI: $ tools/buildman/buildman -o build/qemu_arm64 --boards=qemu_arm64 -w $ cd build/qemu_arm64 $ curl -L -o debian.img \ https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/debian-12.0.0-arm64-netinst.iso $ qemu-system-aarch64 \ -machine virt -cpu cortex-a53 -m 4G -smp 4 \ -bios u-boot.bin \ -serial stdio -device VGA \ -nic user,model=virtio-net-pci \ -device virtio-rng-pci \ -device qemu-xhci,id=xhci -device usb-kbd -device usb-tablet \ -drive if=virtio,file=debian.img,format=raw,readonly=on,media=cdrom And with one using extlinux.conf: $ [...] $ curl -L -o head.img.gz \ https://deb.debian.org/debian/dists/bookworm/main/installer-arm64/current/images/netboot/SD-card-images/gtk/firmware.none.img.gz $ curl -L -o partition.img.gz \ https://deb.debian.org/debian/dists/bookworm/main/installer-arm64/current/images/netboot/SD-card-images/gtk/partition.img.gz $ zcat head.img.gz partition.img.gz >debian.img $ [...] Both can get to a graphical installer just fine, in addition to U-Boot video console showing up in a GTK window.
This commit is contained in:
commit
7c6b18fb54
7 changed files with 98 additions and 4 deletions
|
@ -1037,6 +1037,16 @@ config ARCH_QEMU
|
|||
imply DM_RTC
|
||||
imply RTC_PL031
|
||||
imply OF_HAS_PRIOR_STAGE
|
||||
imply VIDEO
|
||||
imply VIDEO_BOCHS
|
||||
imply SYS_WHITE_ON_BLACK
|
||||
imply SYS_CONSOLE_IS_IN_ENV
|
||||
imply PRE_CONSOLE_BUFFER
|
||||
imply USB
|
||||
imply USB_XHCI_HCD
|
||||
imply USB_XHCI_PCI
|
||||
imply USB_KEYBOARD
|
||||
imply CMD_USB
|
||||
|
||||
config ARCH_RMOBILE
|
||||
bool "Renesas ARM SoCs"
|
||||
|
|
|
@ -12,6 +12,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy
|
|||
imply VIRTIO_NET
|
||||
imply VIRTIO_BLK
|
||||
|
||||
config PRE_CON_BUF_ADDR
|
||||
hex
|
||||
default 0x40100000
|
||||
|
||||
endif
|
||||
|
||||
if TARGET_QEMU_ARM_64BIT && !TFABOOT
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <fdtdec.h>
|
||||
#include <init.h>
|
||||
#include <log.h>
|
||||
#include <usb.h>
|
||||
#include <virtio_types.h>
|
||||
#include <virtio.h>
|
||||
|
||||
|
@ -114,6 +115,10 @@ int board_late_init(void)
|
|||
*/
|
||||
virtio_init();
|
||||
|
||||
/* start usb so that usb keyboard can be used as input device */
|
||||
if (CONFIG_IS_ENABLED(USB_KEYBOARD))
|
||||
usb_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
/* environment for qemu-arm and qemu-arm64 */
|
||||
|
||||
stdin=serial,usbkbd
|
||||
stdout=serial,vidconsole
|
||||
stderr=serial,vidconsole
|
||||
fdt_high=0xffffffff
|
||||
initrd_high=0xffffffff
|
||||
fdt_addr=0x40000000
|
||||
|
|
|
@ -35,7 +35,6 @@ CONFIG_CMD_NVEDIT_EFI=y
|
|||
CONFIG_CMD_DFU=y
|
||||
CONFIG_CMD_MTD=y
|
||||
CONFIG_CMD_PCI=y
|
||||
CONFIG_CMD_USB=y
|
||||
CONFIG_CMD_TPM=y
|
||||
CONFIG_CMD_MTDPARTS=y
|
||||
CONFIG_ENV_IS_IN_FLASH=y
|
||||
|
@ -68,7 +67,6 @@ CONFIG_SYSRESET=y
|
|||
CONFIG_SYSRESET_CMD_POWEROFF=y
|
||||
CONFIG_SYSRESET_PSCI=y
|
||||
CONFIG_TPM2_MMIO=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_EHCI_PCI=y
|
||||
CONFIG_SEMIHOSTING=y
|
||||
|
|
|
@ -36,7 +36,6 @@ CONFIG_CMD_NVEDIT_EFI=y
|
|||
CONFIG_CMD_DFU=y
|
||||
CONFIG_CMD_MTD=y
|
||||
CONFIG_CMD_PCI=y
|
||||
CONFIG_CMD_USB=y
|
||||
CONFIG_CMD_TPM=y
|
||||
CONFIG_CMD_MTDPARTS=y
|
||||
CONFIG_ENV_IS_IN_FLASH=y
|
||||
|
@ -69,7 +68,6 @@ CONFIG_SYSRESET=y
|
|||
CONFIG_SYSRESET_CMD_POWEROFF=y
|
||||
CONFIG_SYSRESET_PSCI=y
|
||||
CONFIG_TPM2_MMIO=y
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_EHCI_PCI=y
|
||||
CONFIG_TPM=y
|
||||
|
|
|
@ -67,6 +67,10 @@ Additional persistent U-Boot environment support can be added as follows:
|
|||
Additional peripherals that have been tested to work in both U-Boot and Linux
|
||||
can be enabled with the following command line parameters:
|
||||
|
||||
- To add a video console, remove "-nographic" and add e.g.::
|
||||
|
||||
-serial stdio -device VGA
|
||||
|
||||
- To add a Serial ATA disk via an Intel ICH9 AHCI controller, pass e.g.::
|
||||
|
||||
-drive if=none,file=disk.img,format=raw,id=mydisk \
|
||||
|
@ -80,6 +84,10 @@ can be enabled with the following command line parameters:
|
|||
|
||||
-device usb-ehci,id=ehci
|
||||
|
||||
- To add a USB keyboard attached to an emulated xHCI controller, pass e.g.::
|
||||
|
||||
-device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0
|
||||
|
||||
- To add an NVMe disk, pass e.g.::
|
||||
|
||||
-drive if=none,file=disk.img,id=mydisk -device nvme,drive=mydisk,serial=foo
|
||||
|
@ -90,6 +98,74 @@ can be enabled with the following command line parameters:
|
|||
|
||||
These have been tested in QEMU 2.9.0 but should work in at least 2.5.0 as well.
|
||||
|
||||
Booting distros
|
||||
---------------
|
||||
|
||||
It is possible to install and boot a standard Linux distribution using
|
||||
qemu_arm64 by setting up a root disk::
|
||||
|
||||
qemu-img create root.img 20G
|
||||
|
||||
then using the installer to install. For example, with Debian 12::
|
||||
|
||||
qemu-system-aarch64 \
|
||||
-machine virt -cpu cortex-a53 -m 4G -smp 4 \
|
||||
-bios u-boot.bin \
|
||||
-serial stdio -device VGA \
|
||||
-nic user,model=virtio-net-pci \
|
||||
-device virtio-rng-pci \
|
||||
-device qemu-xhci,id=xhci \
|
||||
-device usb-kbd -device usb-tablet \
|
||||
-drive if=virtio,file=debian-12.0.0-arm64-netinst.iso,format=raw,readonly=on,media=cdrom \
|
||||
-drive if=virtio,file=root.img,format=raw,media=disk
|
||||
|
||||
The output will be something like this::
|
||||
|
||||
U-Boot 2023.10-rc2-00075-gbe8fbe718e35 (Aug 11 2023 - 08:38:49 +0000)
|
||||
|
||||
DRAM: 4 GiB
|
||||
Core: 51 devices, 14 uclasses, devicetree: board
|
||||
Flash: 64 MiB
|
||||
Loading Environment from Flash... *** Warning - bad CRC, using default environment
|
||||
|
||||
In: serial,usbkbd
|
||||
Out: serial,vidconsole
|
||||
Err: serial,vidconsole
|
||||
Bus xhci_pci: Register 8001040 NbrPorts 8
|
||||
Starting the controller
|
||||
USB XHCI 1.00
|
||||
scanning bus xhci_pci for devices... 3 USB Device(s) found
|
||||
Net: eth0: virtio-net#32
|
||||
Hit any key to stop autoboot: 0
|
||||
Scanning for bootflows in all bootdevs
|
||||
Seq Method State Uclass Part Name Filename
|
||||
--- ----------- ------ -------- ---- ------------------------ ----------------
|
||||
Scanning global bootmeth 'efi_mgr':
|
||||
Scanning bootdev 'fw-cfg@9020000.bootdev':
|
||||
fatal: no kernel available
|
||||
scanning bus for devices...
|
||||
Scanning bootdev 'virtio-blk#34.bootdev':
|
||||
0 efi ready virtio 2 virtio-blk#34.bootdev.par efi/boot/bootaa64.efi
|
||||
** Booting bootflow 'virtio-blk#34.bootdev.part_2' with efi
|
||||
Using prior-stage device tree
|
||||
Failed to load EFI variables
|
||||
Error: writing contents
|
||||
** Unable to write file ubootefi.var **
|
||||
Failed to persist EFI variables
|
||||
Missing TPMv2 device for EFI_TCG_PROTOCOL
|
||||
Booting /efi\boot\bootaa64.efi
|
||||
Error: writing contents
|
||||
** Unable to write file ubootefi.var **
|
||||
Failed to persist EFI variables
|
||||
Welcome to GRUB!
|
||||
|
||||
Standard boot looks through various available devices and finds the virtio
|
||||
disks, then boots from the first one. After a second or so the grub menu appears
|
||||
and you can work through the installer flow normally.
|
||||
|
||||
After the installation, you can boot into the installed system by running QEMU
|
||||
again without the drive argument corresponding to the installer CD image.
|
||||
|
||||
Enabling TPMv2 support
|
||||
----------------------
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue