From: kn Date: Sun, 12 May 2024 19:47:14 +0000 (+0000) Subject: Rerun installboot(8) after fw_update(8) to pick up Apple boot firmware X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=152c4722be445a76327dddf45ea5c5403445d91f;p=openbsd Rerun installboot(8) after fw_update(8) to pick up Apple boot firmware Firmware is fetched after bootstraps are installed, i.e. on fresh installs apple-boot is not there yet when installboot ought to place it onto the EFI System Partition. Rerun --only on Apple silicon-- to replace Asahi u-boot and boot straight into ours, nicely visible my different logo. Input sthen deraadt --- diff --git a/distrib/arm64/ramdisk/install.md b/distrib/arm64/ramdisk/install.md index 51d20be4079..535011f767e 100644 --- a/distrib/arm64/ramdisk/install.md +++ b/distrib/arm64/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.49 2024/04/17 04:36:39 kn Exp $ +# $OpenBSD: install.md,v 1.50 2024/05/12 19:47:14 kn Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -39,10 +39,11 @@ MOUNT_ARGS_msdos="-o-l" KEEP_EFI_SYS=false md_installboot() { - local _disk=$1 _chunks _bootdisk _mdec _plat + local _disk=$1 _reason=$2 _rerun=false _chunks _bootdisk _mdec _plat case ${COMPATIBLE} in - apple,*) _plat=apple;; + apple,*) _plat=apple + [[ $_reason == apple-boot ]] && _rerun=true;; raspberrypi,*) _plat=rpi;; esac @@ -52,6 +53,8 @@ md_installboot() { exit fi + $_rerun && return + # Apply some final tweaks on selected platforms _mdec=/usr/mdec/$_plat @@ -83,6 +86,10 @@ md_installboot() { esac } +md_fw() { + md_installboot "$@" +} + md_prep_fdisk() { local _disk=$1 _d _type=MBR diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index e0679456207..28144871bca 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1263 2024/03/15 17:31:21 kn Exp $ +# $OpenBSD: install.sub,v 1.1264 2024/05/12 19:47:14 kn Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer @@ -3011,7 +3011,11 @@ if ((${#_KERNV[*]} == 1)); then fi __EOT - [ -x /mnt/usr/sbin/fw_update ] && DESTDIR=/mnt /mnt/usr/sbin/fw_update + if [[ -x /mnt/usr/sbin/fw_update ]]; then + DESTDIR=/mnt /mnt/usr/sbin/fw_update + # Rerun installboot(8) to pick up just fetched boot firmware. + typeset -f md_fw >/dev/null && md_fw $ROOTDISK apple-boot + fi if [[ -f $_kernel_dir.tgz ]]; then echo -n "Relinking to create unique kernel..." @@ -3584,6 +3588,7 @@ umount -af >/dev/null 2>&1 # md_consoleinfo() - set CDEV, CTTY, CSPEED, CPROM # # The following functions can be provided if required: +# md_fw() - device specific firmware quirks # md_prep_fdisk() - put a partition table on the disk # # The following variables can be provided if required: