UEFI: Use EFISTUB more better, qemu test, kernel flavors

The Wayland QEMU isn't currently working yet.
This commit is contained in:
Andrea Rogers 2024-11-13 10:55:50 -06:00
commit 2e4307270b
3 changed files with 54 additions and 7 deletions

View file

@ -27,6 +27,14 @@ else
include mk/simplefs.mk include mk/simplefs.mk
endif endif
ifneq (,$(WAYLAND_DISPLAY))
XDG_BASEDIR := $(shell dirname $(XDG_RUNTIME_DIR))
WAYLAND_ASSIST := env WAYLAND_DISPLAY="$(XDG_RUNTIME_DIR)/$(WAYLAND_DISPLAY)" \
XDG_BASEDIR="$(XDG_BASEDIR)/0"
else
WAYLAND_ASSIST :=
endif
RUNLEVEL_BOOT_CMDS := $(foreach SERVICE,$(RUNLEVEL_BOOT),\ RUNLEVEL_BOOT_CMDS := $(foreach SERVICE,$(RUNLEVEL_BOOT),\
rc-update add $(SERVICE) boot &&) rc-update add $(SERVICE) boot &&)
RUNLEVEL_SYSINIT_CMDS := $(foreach SERVICE,$(RUNLEVEL_SYSINIT),\ RUNLEVEL_SYSINIT_CMDS := $(foreach SERVICE,$(RUNLEVEL_SYSINIT),\
@ -176,9 +184,15 @@ $(MOUNTPOINT)/.install-done: fstab services fastest-repo
install: $(MOUNTPOINT)/.install-done install: $(MOUNTPOINT)/.install-done
bootloader: $(MOUNTPOINT)/.bootloader-done
### POST-INSTALL TOOLS ###
# Launch a shell into the installed volume
install-chroot: $(MOUNTPOINT)/.install-done $(ACHROOT) install-chroot: $(MOUNTPOINT)/.install-done $(ACHROOT)
$(ACHROOTI_CMD)' && sh' $(ACHROOTI_CMD)' && sh'
# Launch a shell into the local bootstrapped root
chroot: $(DESTROOT)/.bootstrap-done $(ACHROOT) chroot: $(DESTROOT)/.bootstrap-done $(ACHROOT)
$(ACHROOT_CMD)' && sh' $(ACHROOT_CMD)' && sh'

View file

@ -6,7 +6,9 @@ else
endif endif
PLATFORM_PHONYS := partition kernel PLATFORM_PHONYS := partition kernel
PLATFORM_PKGS := linux-rpi KERNEL_FLAVOR := rpi
KERNEL_PKG := linux-$(KERNEL_FLAVOR)
PLATFORM_PKGS := $(KERNEL_PKG)
BOOTFS_PART := 1 BOOTFS_PART := 1
ROOTFS_PART := 2 ROOTFS_PART := 2

View file

@ -1,5 +1,7 @@
PLATFORM_PHONYS := partition kernel PLATFORM_PHONYS := partition kernel
PLATFORM_PKGS := linux-lts KERNEL_FLAVOR ?= lts
KERNEL_PKG := linux-$(KERNEL_FLAVOR)
PLATFORM_PKGS := $(KERNEL_PKG)
BOOTFS_PART := 1 BOOTFS_PART := 1
ROOTFS_PART := 2 ROOTFS_PART := 2
@ -7,15 +9,44 @@ ROOTFS_PART := 2
RUNLEVEL_BOOT ?= hwclock modules bootmisc hostname networking seedrng swap RUNLEVEL_BOOT ?= hwclock modules bootmisc hostname networking seedrng swap
RUNLEVEL_DEFAULT ?= acpid crond RUNLEVEL_DEFAULT ?= acpid crond
ifeq ($(ARCH),x86_64)
OVMF_ARCH := x64
else ifeq ($(ARCH),x86)
OVMF_ARCH := ia32
else ifneq (,$(findstring arm,$(ARCH)))
OVMF_ARCH := arm
else
OVMF_ARCH := $(ARCH)
endif
ifeq ($(ARCH),$(shell uname -m))
KVMFLAGS := -enable-kvm -cpu host
else
KVMFLAGS :=
endif
QEMU_OVMF ?= /usr/share/ovmf/$(OVMF_ARCH)/OVMF.fd
QEMU_SMP ?= 2
QEMU_MEM ?= 1G
partition: blkcheck partition: blkcheck
$(DOSU) fdisk $(BLKDEV) <<<$$'g\nw\n' $(DOSU) fdisk $(BLKDEV) <<<$$'g\nw\n'
$(DOSU) sfdisk $(BLKDEV) <<<$$',1G,C12A7328-F81F-11D2-BA4B-00A0C93EC93B,*\n,,0FC63DAF-8483-4772-8E79-3D69D8477DE4,\n' $(DOSU) sfdisk $(BLKDEV) <<<$$',1G,C12A7328-F81F-11D2-BA4B-00A0C93EC93B,*\n,,0FC63DAF-8483-4772-8E79-3D69D8477DE4,\n'
$(MOUNTPOINT)/boot/grub: $(MOUNTPOINT)/boot/startup.nsh:
$(MAKE) $(ACHROOT) $(MAKE) blkcheck
$(ACHROOTI_CMD)' && grub-install --target=x86_64-efi --efi-directory=/boot' @echo 'vmlinuz-$(KERNEL_FLAVOR) rw root=UUID=$(shell lsblk -rno UUID $(BLKDEV)$(P)$(ROOTFS_PART)) initrd=\initramfs-$(KERNEL_FLAVOR)' \
| $(DOSU) tee $@
$(MOUNTPOINT)/.bootloader-done: $(MOUNTPOINT)/boot/grub $(MOUNTPOINT)/.bootloader-done: $(MOUNTPOINT)/boot/startup.nsh
touch $@ touch $@
bootloader: $(MOUNTPOINT)/.bootloader-done qemu-test: umount
$(DOSU) $(WAYLAND_ASSIST) qemu-system-$(ARCH) \
$(KVMFLAGS) \
-smp $(QEMU_SMP) \
-m $(QEMU_MEM) \
-bios $(QEMU_OVMF) \
-vga std -display gtk \
-drive driver=raw,file.filename=$(BLKDEV) \
-net user