From 1a7bc0bf9406d0be22ac126e5163a3dc4254f6f8 Mon Sep 17 00:00:00 2001 From: krw Date: Thu, 10 Feb 2022 20:07:47 +0000 Subject: [PATCH] Use fdisk's -b to create boot partitions instead of -e scripts. Build, boot and install tested by bluhm@ ok bluhm@ --- distrib/arm64/iso/Makefile | 6 ++---- distrib/arm64/ramdisk/Makefile | 6 ++---- distrib/arm64/ramdisk/install.md | 34 +++++++++++--------------------- 3 files changed, 16 insertions(+), 30 deletions(-) diff --git a/distrib/arm64/iso/Makefile b/distrib/arm64/iso/Makefile index 68c30398cea..c944cd52e62 100644 --- a/distrib/arm64/iso/Makefile +++ b/distrib/arm64/iso/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 2021/04/17 21:19:41 sthen Exp $ +# $OpenBSD: Makefile,v 1.3 2022/02/10 20:07:47 krw Exp $ FS= install${OSrev}.img FSSIZE= 1032192 @@ -19,7 +19,6 @@ XBASE= ${RELXDIR}/xbase${OSrev}.tgz ${RELXDIR}/xfont${OSrev}.tgz \ # this offset is required by Rockchip MSDOSSTART= 32768 MSDOSSIZE= 16384 -FFSSTART!= expr ${MSDOSSTART} + ${MSDOSSIZE} NEWFS_ARGS_msdos=-L boot -c1 -F16 MOUNT_ARGS_msdos=-o-l @@ -50,8 +49,7 @@ all: ${FS} ${FS}: ${BASE} ${XBASE} dd if=/dev/zero of=${FS} bs=512 count=${FSSIZE} vnconfig -v ${FS} > vnd - echo 'u\ne 0\nc\nn\n${MSDOSSTART}\n${MSDOSSIZE}\ne 3\nA6\nn\n${FFSSTART}\n*\nf 0\nw\nq\n' \ - | fdisk -e `cat vnd` >/dev/null + fdisk -iy -b "${MSDOSSIZE}@${MSDOSSTART}:c" `cat vnd` >/dev/null echo 'a a\n\n\n\nw\nq\n' | disklabel -E `cat vnd` >/dev/null newfs -t msdos ${NEWFS_ARGS_msdos} /dev/r`cat vnd`i mount ${MOUNT_ARGS_msdos} /dev/`cat vnd`i ${MOUNT_POINT} diff --git a/distrib/arm64/ramdisk/Makefile b/distrib/arm64/ramdisk/Makefile index 5dda462c0f4..8ef480fee9d 100644 --- a/distrib/arm64/ramdisk/Makefile +++ b/distrib/arm64/ramdisk/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.23 2021/07/26 12:47:45 kn Exp $ +# $OpenBSD: Makefile,v 1.24 2022/02/10 20:07:47 krw Exp $ FS= miniroot${OSrev}.img FSSIZE= 88064 @@ -9,7 +9,6 @@ RAMDISK= RAMDISK # this offset is required by Rockchip MSDOSSTART= 32768 MSDOSSIZE= 16384 -FFSSTART!= expr ${MSDOSSTART} + ${MSDOSSIZE} NEWFS_ARGS_msdos=-L boot -c1 -F16 MOUNT_ARGS_msdos=-o-l @@ -46,8 +45,7 @@ all: ${FS} ${FS}: bsd.rd dd if=/dev/zero of=${FS} bs=512 count=${FSSIZE} vnconfig -v ${FS} > vnd - echo 'u\ne 0\nc\nn\n${MSDOSSTART}\n${MSDOSSIZE}\ne 3\nA6\nn\n${FFSSTART}\n*\nf 0\nw\nq\n' \ - | fdisk -e `cat vnd` >/dev/null + fdisk -iy -b "${MSDOSSIZE}@${MSDOSSTART}:c" `cat vnd` >/dev/null echo 'a a\n\n\n\nw\nq\n' | disklabel -E `cat vnd` >/dev/null newfs -t msdos ${NEWFS_ARGS_msdos} /dev/r`cat vnd`i mount ${MOUNT_ARGS_msdos} /dev/`cat vnd`i ${MOUNT_POINT} diff --git a/distrib/arm64/ramdisk/install.md b/distrib/arm64/ramdisk/install.md index fae0f4e1383..b169d48fd7b 100644 --- a/distrib/arm64/ramdisk/install.md +++ b/distrib/arm64/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.24 2022/02/04 16:08:39 kettenis Exp $ +# $OpenBSD: install.md,v 1.25 2022/02/10 20:07:47 krw Exp $ # # # Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -79,17 +79,14 @@ md_installboot() { md_prep_fdisk() { local _disk=$1 _d _type=MBR - local bootpart= local bootparttype="C" local bootsectorstart="32768" local bootsectorsize="32768" - local bootsectorend=$(($bootsectorstart + $bootsectorsize)) local bootfstype="msdos" while :; do _d=whole if disk_has $_disk gpt; then - [[ $_disk == $ROOTDISK ]] && bootpart="-b ${bootsectorsize}" _type=GPT fdisk $_disk elif disk_has $_disk mbr; then @@ -102,26 +99,19 @@ md_prep_fdisk() { [wW]*) echo -n "Creating a ${bootfstype} partition and an OpenBSD partition for rest of $_disk..." if disk_has $_disk gpt apfsisc; then - fdisk -Ay ${bootpart} ${_disk} >/dev/null + if [[ $_disk == $ROOTDISK ]]; then + fdisk -Ay -b "${bootsectorsize}" ${_disk} >/dev/null + else + fdisk -Ay ${_disk} >/dev/null + fi elif disk_has $_disk gpt; then - fdisk -gy ${bootpart} ${_disk} >/dev/null + if [[ $_disk == $ROOTDISK ]]; then + fdisk -gy -b "${bootsectorsize}" ${_disk} >/dev/null + else + fdisk -gy ${_disk} >/dev/null + fi else - fdisk -e ${_disk} <<__EOT >/dev/null -reinit -e 0 -${bootparttype} -n -${bootsectorstart} -${bootsectorsize} -f 0 -e 3 -A6 -n -${bootsectorend} - -write -quit -__EOT + fdisk -iy -b "${bootsectorsize}@${bootsectorstart}:${bootparttype}" ${_disk} >/dev/null fi echo "done." installboot -p $_disk -- 2.20.1