From cd2083ccf9294d380f428e66a6c0cd27d0cb5c99 Mon Sep 17 00:00:00 2001 From: krw Date: Mon, 7 Feb 2022 15:21:38 +0000 Subject: [PATCH] Use fdisk's -b to create boot partitions instead of -e scripts. Build, boot and install tested by visa@ ok visa@ --- distrib/loongson/ramdisk/Makefile | 7 +++++-- distrib/loongson/ramdisk/install.md | 32 ++++++++--------------------- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/distrib/loongson/ramdisk/Makefile b/distrib/loongson/ramdisk/Makefile index 48459c40b80..11bb35b2068 100644 --- a/distrib/loongson/ramdisk/Makefile +++ b/distrib/loongson/ramdisk/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.31 2021/07/26 12:47:46 kn Exp $ +# $OpenBSD: Makefile,v 1.32 2022/02/07 15:21:38 krw Exp $ FS= miniroot${OSrev}.img FSSIZE= 18432 @@ -14,13 +14,16 @@ UTILS= ${.CURDIR}/../../miniroot MRDISKTYPE= rdroot MRMAKEFSARGS= -o disklabel=${MRDISKTYPE},minfree=0,density=4096 +MSDOSSTART= 63 +MSDOSSIZE!= expr ${FSSIZE} - ${MSDOSSTART} + all: ${FS} ${CDROM} # PMON cannot load a gzipped kernel ${FS}: bsd.strip dd if=/dev/zero of=${FS} bs=512 count=${FSSIZE} vnconfig -v -t ${FSDISKTYPE} ${FS} > vnd - echo 'u\ne 0\n83\n\n63\n*\nw\nq\n' | fdisk -e `cat vnd` > /dev/null + fdisk -iy -b "${MSDOSSIZE}@${MSDOSSTART}:83" `cat vnd` > /dev/null echo 'w\ny\nq\n' | disklabel -E `cat vnd` > /dev/null newfs_ext2fs /dev/r`cat vnd`i mount /dev/`cat vnd`i ${MOUNT_POINT} diff --git a/distrib/loongson/ramdisk/install.md b/distrib/loongson/ramdisk/install.md index cab42dcd50b..a9a3513e406 100644 --- a/distrib/loongson/ramdisk/install.md +++ b/distrib/loongson/ramdisk/install.md @@ -1,4 +1,4 @@ -# $OpenBSD: install.md,v 1.29 2020/12/09 15:45:58 deraadt Exp $ +# $OpenBSD: install.md,v 1.30 2022/02/07 15:21:38 krw Exp $ # # Copyright (c) 1996 The NetBSD Foundation, Inc. # All rights reserved. @@ -46,7 +46,7 @@ md_installboot() { } md_prep_fdisk() { - local _disk=$1 _q _d _s _o + local _disk=$1 _q _d _o while :; do _d=whole @@ -64,37 +64,21 @@ md_prep_fdisk() { [wW]*) case $(sysctl -n hw.product) in Gdium) - _s=32 + echo -n "Creating a 32MB ext2 partition and an OpenBSD partition for rest of $_disk..." + fdisk -iy -b "65536@1:83" $_disk >/dev/null _o="-O 1 -b 4096" ;; EBT700) - _s=1 + echo -n "Creating a 1MB ext2 partition and an OpenBSD partition for rest of $_disk..." + fdisk -iy -b "2048@1:83" $_disk >/dev/null _o="-O 1" ;; *) - _s=1 + echo -n "Creating a 1MB ext2 partition and an OpenBSD partition for rest of $_disk..." + fdisk -iy -b "2048@1:83" $_disk >/dev/null _o="" ;; esac - echo -n "Creating a ${_s}MB ext2 partition and an OpenBSD partition for rest of $_disk..." - fdisk -e $_disk <<__EOT >/dev/null -re -e 0 -83 - -1 -$((_s * 2048)) -e 3 -0 -e 3 -A6 - -$((_s * 2048 + 1)) -* -update -write -quit -__EOT echo "done." disklabel $_disk 2>/dev/null | grep -q "^ i:" || disklabel -w -d $_disk newfs -qt ext2fs $_o ${_disk}i -- 2.20.1