The growth is not terrible, considering what media this is.

Fine with me.

Klemens Nanni <k...@openbsd.org> wrote:

> 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.
> 
> Correction:  needed it for the Pi 4, the PBP had other problems...
> 
> > 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':
> 
> New diff now that amd64 RAMDISK_CD contains igc(4):
> 
>       -9168    obj/bsd.strip
>       +9872    obj/bsd.strip
>       -4272    obj/bsd.gz
>       +4480    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.
> 
> In 512-byte block counts (`du obj/bsd.{strip,gz}`):
> 
>       -18336   obj/bsd.strip
>       +19744   obj/bsd.strip
>       -8544    obj/bsd.gz
>       +8960    obj/bsd.gz
> 
> So I first cranked FSSIZE by 8960 - 8544 = 416, from 10240 to 10686.
> That built, but is more than required, so I bisected it to the minimal
> working value of 10368.
> 
> amd64 builds, boots and works as expected.
> 
> > macppc is still building;  I have no alpha or i386.
> 
> macppc builds, boots and works as expected without cranking FSSIZE.
> 
> 
> Feedback? Objections? OK?
> 
> Index: amd64/ramdisk_cd/Makefile
> ===================================================================
> RCS file: /cvs/src/distrib/amd64/ramdisk_cd/Makefile,v
> retrieving revision 1.32
> diff -u -p -r1.32 Makefile
> --- amd64/ramdisk_cd/Makefile 7 Nov 2021 15:50:15 -0000       1.32
> +++ amd64/ramdisk_cd/Makefile 11 Nov 2021 19:43:56 -0000
> @@ -1,7 +1,7 @@
>  #    $OpenBSD: Makefile,v 1.32 2021/11/07 15:50:15 deraadt 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
> 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   11 Nov 2021 19:44:14 -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