From 22942c2ff50fedfe2890177aea2f5af781557ccb Mon Sep 17 00:00:00 2001 From: kn Date: Wed, 7 Sep 2022 10:21:03 +0000 Subject: [PATCH] Fix passing explicit stage files Every platform ought to set `stages', `stage1' and optionally `stage2' in md_init(), otherwise passing explicit files results won't work as `stages' is zero-initialised and no default path is set: # installboot -v sd0 /root/BOOTAA64.EFI usage: installboot [-npv] [-r root] disk [stage1] This is correct synopsis and ought to work, but efi_installboot.c has an empty md_init(). Set stage bits to fix this: # ./obj/installboot -nv sd0 /root/BOOTAA64.EFI Using / as root would install bootstrap on /dev/rsd0c using first-stage /root/BOOTAA64.EFI would copy /root/BOOTAA64.EFI to /tmp/installboot.2bGhLGT1eF/efi/boot/bootaa64.efi would write /tmp/installboot.2bGhLGT1eF/efi/boot/startup.nsh This makes regress/usr.sbin/installboot pass on armv7, arm64 and riscv64 (while being lucky or carrying miod's fix for the kernel disklabel race manifesting on vnd). --- usr.sbin/installboot/efi_installboot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/installboot/efi_installboot.c b/usr.sbin/installboot/efi_installboot.c index 7f422f4c6a6..eb3c3112467 100644 --- a/usr.sbin/installboot/efi_installboot.c +++ b/usr.sbin/installboot/efi_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efi_installboot.c,v 1.3 2022/08/31 20:52:15 krw Exp $ */ +/* $OpenBSD: efi_installboot.c,v 1.4 2022/09/07 10:21:03 kn Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -76,6 +76,8 @@ static int findmbrfat(int, struct disklabel *); void md_init(void) { + stages = 1; + stage1 = "/usr/mdec/" BOOTEFI_SRC; } void -- 2.20.1