[PATCH 0/3] m68k: virt: add a firmware to the virt machine (petit boot)

Laurent Vivier posted 3 patches 2 years, 2 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220202223528.1260154-1-laurent@vivier.eu
Maintainers: Laurent Vivier <laurent@vivier.eu>
configure                   |   3 +-
hw/m68k/bootinfo.h          |   4 +-
include/hw/misc/virt_ctrl.h |   6 ++
hw/m68k/virt.c              |  38 ++++++++++++
hw/misc/virt_ctrl.c         | 111 +++++++++++++++++++++++++++++++++++-
.gitmodules                 |   6 ++
pc-bios/meson.build         |   3 +
roms/Makefile               |  15 +++++
roms/buildroot              |   1 +
roms/m68k-virt              |   1 +
10 files changed, 183 insertions(+), 5 deletions(-)
create mode 160000 roms/buildroot
create mode 160000 roms/m68k-virt
[PATCH 0/3] m68k: virt: add a firmware to the virt machine (petit boot)
Posted by Laurent Vivier 2 years, 2 months ago
For the moment, the virt machine can only be started by using
QEMU "-kernel" parameter, and thus can only load the kernel/initramfs
from the host filesystem.

Adding a firmware is a good way to allow the machine to boot and update
a kernel from the guest point of view (disk, network, cdrom, ...).

As I don't want to port a firmware to this machine, the easy way to do
that is to use linux. This approach is already in use by petit boot on
the bare metal POWER systems.

This series adds a bootstrap ROM to load the firmware (petit boot),
and a buildroot environment to build the petit boot firmware for
the m68k virt machine.

To build the bootstram ROM:

$ git submodule init roms/m68k-virt
$ git submodule updage roms/m68k-virt
$ make -C roms m68k-virt-bootrom

To build the firmware:

$ git submodule init roms/buildroot
$ git submodule update roms/buildroot
$ make -C roms m68k-virt-firmware

Build qemu-system-m68k and then you can start QEMU and
play with petit boot:
$ ./qemu-system-m68k -M virt -nographic

Petit boot supports various bootloader configuration files, like
grub, pxe, kboot, syslinux...

For instance:

menuentry "Linux 5.16.0-virt (debian 10.0)" {
	search --set=root --label root
	linux /boot/vmlinux-5.16.0-virt ro root=/dev/vda2 console=ttyGF0
}

default="vmlinux-5.16.0-virt"
vmlinux-5.16.0-virt='/boot/vmlinux-5.16.0-virt root=/dev/vda2 console=ttyGF0'

default vmlinux-5.16.0-virt (debian 10.0)
label vmlinux-5.16.0-virt (debian 10.0)
 kernel /boot/vmlinux-5.16.0-virt
 append root=/dev/vda2 console=ttyGF0

Laurent Vivier (3):
  m68k: bootinfo entry size must be aligned on 4 bytes
  m68k: virt: add a bootstrap ROM
  m68k: virt: add a firmware (petitboot)

 configure                   |   3 +-
 hw/m68k/bootinfo.h          |   4 +-
 include/hw/misc/virt_ctrl.h |   6 ++
 hw/m68k/virt.c              |  38 ++++++++++++
 hw/misc/virt_ctrl.c         | 111 +++++++++++++++++++++++++++++++++++-
 .gitmodules                 |   6 ++
 pc-bios/meson.build         |   3 +
 roms/Makefile               |  15 +++++
 roms/buildroot              |   1 +
 roms/m68k-virt              |   1 +
 10 files changed, 183 insertions(+), 5 deletions(-)
 create mode 160000 roms/buildroot
 create mode 160000 roms/m68k-virt

-- 
2.34.1