From 55131dfc7c59dabb68f1e7da103c10fe7d22005f Mon Sep 17 00:00:00 2001 From: kn Date: Thu, 11 Nov 2021 20:25:56 +0000 Subject: [PATCH] Make "config -e" work with ramdisk kernels amd64, alpha, i386 and macppc strip *all* symbols off the ramdisk bsd.rd (before compressing it) and thus break config(8)'s modification feature: $ gzcat bsd.rd > bsd.rd.raw $ config -e bsd.rd.raw ... config: failed to get first cfdata This is different from "boot> boot /bsd.rd -c" which sucessfully drops into UKC on all platforms regardless of stripping. Having needed "config -e" this on arm64 made me look into this for all platforms. Other platforms work because they don't strip these symbols. Tweak objcopy(1)'s stripping on amd64 and macppc to unbreak permanent modifications. I have no alpha or i386 to test, so these remain broken. macppc works without cranking media size. amd64 was cranked to the smallest possible size. OK deraadt --- distrib/amd64/ramdisk_cd/Makefile | 6 +++--- distrib/macppc/ramdisk/Makefile | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/distrib/amd64/ramdisk_cd/Makefile b/distrib/amd64/ramdisk_cd/Makefile index 388939c6afb..c4241c63081 100644 --- a/distrib/amd64/ramdisk_cd/Makefile +++ b/distrib/amd64/ramdisk_cd/Makefile @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile,v 1.32 2021/11/07 15:50:15 deraadt Exp $ +# $OpenBSD: Makefile,v 1.33 2021/11/11 20:25:56 kn Exp $ FS= miniroot${OSrev}.img -FSSIZE= 10240 +FSSIZE= 10368 FSDISKTYPE= mini34 CDROM= cd${OSrev}.iso MOUNT_POINT= /mnt @@ -56,7 +56,7 @@ MRDISKTYPE= rdrootb MRMAKEFSARGS= -o disklabel=${MRDISKTYPE},minfree=0,density=4096 bsd.gz: bsd.rd - objcopy -S -R .comment -R .SUNW_ctf \ + objcopy -g -x -R .comment -R .SUNW_ctf \ -K rd_root_size -K rd_root_image \ bsd.rd bsd.strip gzip -9cn bsd.strip > bsd.gz diff --git a/distrib/macppc/ramdisk/Makefile b/distrib/macppc/ramdisk/Makefile index 2cb618bee6d..f97e177dcb9 100644 --- a/distrib/macppc/ramdisk/Makefile +++ b/distrib/macppc/ramdisk/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.51 2021/07/26 12:47:46 kn Exp $ +# $OpenBSD: Makefile,v 1.52 2021/11/11 20:25:56 kn Exp $ CDROM= cd${OSrev}.iso MTREE= ${UTILS}/mtree.conf @@ -35,7 +35,7 @@ bsd.gz: bsd.rd gzip -9cn bsd.rd > bsd.gz bsd.rd: mr.fs bsd - objcopy -S -R .comment -R .SUNW_ctf \ + objcopy -g -x -R .comment -R .SUNW_ctf \ -K rd_root_size -K rd_root_image \ bsd bsd.rd rdsetroot bsd.rd mr.fs -- 2.20.1