On Thu, Nov 04, 2021 at 10:49:46PM +0000, Klemens Nanni wrote:
> amd64, alpha, i386 and macppc strip all symbols off the ramdisk bsd.rd
> (before gzipping it) and thus break config(8)'s modification feature:
> 
>       $ gzcat bsd.rd > bsd.rd.raw
>       $ config -e bsd.rd.raw
>       WARNING no output file specified
>       WARNING this kernel doesn't contain all information needed!
>       WARNING the commands add and change might not work.
>       WARNING this kernel doesn't support pseudo devices.
>       WARNING this kernel doesn't support modification of NKMEMPAGES.
>       config: failed to get first cfdata
> 
> Needing 'disable xhci' on arm64/Pinebook Pro right now, I looked into
> all of bsd.re-config(5), UKC and how we build bsd.rd for all platforms.
> 
> That's how I noticed modifying a ramdisk kernel on these for platforms
> wouldn't work in the first place.
> 
> Needing it to fix or upgrade systems can be crucial, so I figured it's
> worth addressing.
> 
> While `boot /bsd.rd -c' does work on amd64 and macppc regardless of
> symbols, its changes do not persist and `config -e' is more convenient.
> 
> So I propose to strip less symbols such to make this work.
> 
> On amd64, this accounts for 200K growth in bsd.gz according to `du -k':
> 
>       -9144   obj/bsd.strip
>       +9840   obj/bsd.strip
>       -4264   obj/bsd.gz
>       +4464   obj/bsd.gz
> 
> I cranked FSSIZE to the smallest possible volume that would build.
> The resulting miniroot70.img boots fine in vmm(4) and on a X250.
> 
> macppc is still building;  I have no alpha or i386.

macppc builds and boots on a Mac without FSSIZE cranking and I can edit
it with `config -e' as expected.

> Feedback? Objections? OK?


Index: amd64/ramdisk_cd/Makefile
===================================================================
RCS file: /cvs/src/distrib/amd64/ramdisk_cd/Makefile,v
retrieving revision 1.31
diff -u -p -r1.31 Makefile
--- amd64/ramdisk_cd/Makefile   26 Jul 2021 12:47:45 -0000      1.31
+++ amd64/ramdisk_cd/Makefile   4 Nov 2021 18:42:51 -0000
@@ -1,7 +1,7 @@
 #      $OpenBSD: Makefile,v 1.31 2021/07/26 12:47:45 kn Exp $
 
 FS=            miniroot${OSrev}.img
-FSSIZE=                9920
+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
Index: macppc/ramdisk/Makefile
===================================================================
RCS file: /cvs/src/distrib/macppc/ramdisk/Makefile,v
retrieving revision 1.51
diff -u -p -r1.51 Makefile
--- macppc/ramdisk/Makefile     26 Jul 2021 12:47:46 -0000      1.51
+++ macppc/ramdisk/Makefile     5 Nov 2021 00:02:12 -0000
@@ -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

Reply via email to