Hi,

The following diff makes rdsetroot -x (extract the disk.fs image) to
work again for stripped bsd.rd.

It passes options to keep rd_root_size and rd_root_image symbols while
stripping. These symbols are the ones used by rdsetroot to insert or
extract disk image into RAMDISK.

If it matter, on my i386 test, the bsd.rd size grows to 284 bytes
before gzip and 113 bytes after gzip.

While here, uniformize a bit the sections removed (.comment section
wasn't removed on some archs while stripping).

Comments or OK ?
-- 
Sebastien Marie

Index: distrib/alpha/miniroot/Makefile
===================================================================
RCS file: /cvs/src/distrib/alpha/miniroot/Makefile,v
retrieving revision 1.21
diff -u -p -r1.21 Makefile
--- distrib/alpha/miniroot/Makefile     13 Feb 2021 18:48:23 -0000      1.21
+++ distrib/alpha/miniroot/Makefile     14 Feb 2021 13:58:49 -0000
@@ -62,7 +62,10 @@ ${CDROM}: bsd.gz
        rm -f vnd
 
 bsd.gz: bsd.rd
-       objcopy -S -R .comment -R .SUNW_ctf -R .eh_frame -R .shstrtab bsd.rd 
bsd.strip
+       objcopy -S -R .comment -R .SUNW_ctf \
+           -K rd_root_size -K rd_root_image \
+           -R .eh_frame -R .shstrtab \
+           bsd.rd bsd.strip
        gzip -9cn bsd.strip > bsd.gz
 
 bsd.rd: mr.fs bsd
Index: distrib/amd64/ramdiskA/Makefile
===================================================================
RCS file: /cvs/src/distrib/amd64/ramdiskA/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- distrib/amd64/ramdiskA/Makefile     13 Feb 2021 18:52:08 -0000      1.14
+++ distrib/amd64/ramdiskA/Makefile     14 Feb 2021 13:58:49 -0000
@@ -33,7 +33,9 @@ MRDISKTYPE=   rdroot
 MRMAKEFSARGS=  -o disklabel=${MRDISKTYPE},minfree=0,density=4096
 
 bsd.gz: bsd.rd
-       objcopy -S -R .comment -R .SUNW_ctf bsd.rd bsd.strip
+       objcopy -S -R .comment -R .SUNW_ctf \
+           -K rd_root_size -K rd_root_image \
+           bsd.rd bsd.strip
        gzip -9cn bsd.strip > bsd.gz
 
 bsd.rd: mr.fs bsd
Index: distrib/amd64/ramdisk_cd/Makefile
===================================================================
RCS file: /cvs/src/distrib/amd64/ramdisk_cd/Makefile,v
retrieving revision 1.28
diff -u -p -r1.28 Makefile
--- distrib/amd64/ramdisk_cd/Makefile   13 Feb 2021 18:52:08 -0000      1.28
+++ distrib/amd64/ramdisk_cd/Makefile   14 Feb 2021 13:58:49 -0000
@@ -56,7 +56,9 @@ MRDISKTYPE=   rdrootb
 MRMAKEFSARGS=  -o disklabel=${MRDISKTYPE},minfree=0,density=4096
 
 bsd.gz: bsd.rd
-       objcopy -S -R .comment -R .SUNW_ctf bsd.rd bsd.strip
+       objcopy -S -R .comment -R .SUNW_ctf \
+           -K rd_root_size -K rd_root_image \
+           bsd.rd bsd.strip
        gzip -9cn bsd.strip > bsd.gz
 
 bsd.rd: mr.fs bsd
Index: distrib/i386/ramdisk/Makefile
===================================================================
RCS file: /cvs/src/distrib/i386/ramdisk/Makefile,v
retrieving revision 1.13
diff -u -p -r1.13 Makefile
--- distrib/i386/ramdisk/Makefile       13 Feb 2021 18:52:08 -0000      1.13
+++ distrib/i386/ramdisk/Makefile       14 Feb 2021 13:58:49 -0000
@@ -34,7 +34,9 @@ MRDISKTYPE=   rdroot
 MRMAKEFSARGS=  -o disklabel=${MRDISKTYPE},minfree=0,density=4096
 
 bsd.gz: bsd.rd
-       objcopy -S -R .comment -R .SUNW_ctf bsd.rd bsd.strip
+       objcopy -S -R .comment -R .SUNW_ctf \
+           -K rd_root_size -K rd_root_image \
+           bsd.rd bsd.strip
        gzip -9cn bsd.strip > bsd.gz
 
 bsd.rd: mr.fs bsd
Index: distrib/i386/ramdisk_cd/Makefile
===================================================================
RCS file: /cvs/src/distrib/i386/ramdisk_cd/Makefile,v
retrieving revision 1.22
diff -u -p -r1.22 Makefile
--- distrib/i386/ramdisk_cd/Makefile    13 Feb 2021 18:52:08 -0000      1.22
+++ distrib/i386/ramdisk_cd/Makefile    14 Feb 2021 13:58:49 -0000
@@ -53,7 +53,9 @@ MRDISKTYPE=   rdrootb
 MRMAKEFSARGS=  -o disklabel=${MRDISKTYPE},minfree=0,density=4096
 
 bsd.gz: bsd.rd
-       objcopy -S -R .comment -R .SUNW_ctf bsd.rd bsd.strip
+       objcopy -S -R .comment -R .SUNW_ctf \
+           -K rd_root_size -K rd_root_image \
+           bsd.rd bsd.strip
        gzip -9cn bsd.strip > bsd.gz
 
 bsd.rd: mr.fs bsd
Index: distrib/macppc/ramdisk/Makefile
===================================================================
RCS file: /cvs/src/distrib/macppc/ramdisk/Makefile,v
retrieving revision 1.48
diff -u -p -r1.48 Makefile
--- distrib/macppc/ramdisk/Makefile     5 Jan 2021 15:10:43 -0000       1.48
+++ distrib/macppc/ramdisk/Makefile     14 Feb 2021 13:58:49 -0000
@@ -35,9 +35,10 @@ bsd.gz: bsd.rd
        gzip -9cn bsd.rd > bsd.gz
 
 bsd.rd: mr.fs bsd
-       cp bsd bsd.rd
+       objcopy -S -R .comment -R .SUNW_ctf \
+           -K rd_root_size -K rd_root_image \
+           bsd bsd.rd
        rdsetroot bsd.rd mr.fs
-       strip -R .SUNW_ctf bsd.rd
 
 bsd:
        cd ${.CURDIR}/../../../sys/arch/${MACHINE}/compile/${RAMDISK} && \
Index: distrib/sparc64/miniroot/Makefile
===================================================================
RCS file: /cvs/src/distrib/sparc64/miniroot/Makefile,v
retrieving revision 1.25
diff -u -p -r1.25 Makefile
--- distrib/sparc64/miniroot/Makefile   13 Feb 2021 18:41:52 -0000      1.25
+++ distrib/sparc64/miniroot/Makefile   14 Feb 2021 13:58:49 -0000
@@ -59,7 +59,9 @@ ${CDROM}: bsd.rd ${FS}
        mksuncd f ${CDROM} ${FS}
 
 bsd.gz: bsd.rd
-       objcopy -S -R .comment -R .SUNW_ctf bsd.rd bsd.strip
+       objcopy -S -R .comment -R .SUNW_ctf \
+           -K rd_root_size -K rd_root_image \
+           bsd.rd bsd.strip
        gzip -9cn bsd.strip > bsd.gz
 
 bsd.rd: mr.fs bsd
Index: distrib/sparc64/ramdisk/Makefile
===================================================================
RCS file: /cvs/src/distrib/sparc64/ramdisk/Makefile,v
retrieving revision 1.52
diff -u -p -r1.52 Makefile
--- distrib/sparc64/ramdisk/Makefile    13 Feb 2021 18:46:52 -0000      1.52
+++ distrib/sparc64/ramdisk/Makefile    14 Feb 2021 13:58:49 -0000
@@ -32,7 +32,9 @@ ${FS}: bsd.gz
        rm -f vnd
 
 bsd.gz: bsd.rd
-       objcopy -S -R .SUNW_ctf bsd.rd bsd.strip
+       objcopy -S -R .comment -R .SUNW_ctf \
+           -K rd_root_size -K rd_root_image \
+           bsd.rd bsd.strip
        gzip -9cn bsd.strip > bsd.gz
 
 bsd.rd: mr.fs bsd
Index: distrib/sparc64/ramdiskB/Makefile
===================================================================
RCS file: /cvs/src/distrib/sparc64/ramdiskB/Makefile,v
retrieving revision 1.48
diff -u -p -r1.48 Makefile
--- distrib/sparc64/ramdiskB/Makefile   13 Feb 2021 18:46:52 -0000      1.48
+++ distrib/sparc64/ramdiskB/Makefile   14 Feb 2021 13:58:49 -0000
@@ -32,7 +32,9 @@ ${FS}: bsd.gz
        rm -f vnd
 
 bsd.gz: bsd.rd
-       objcopy -S -R .SUNW_ctf bsd.rd bsd.strip
+       objcopy -S -R .SUNW_ctf -R .comment \
+           -K rd_root_size -K rd_root_image \
+           bsd.rd bsd.strip
        gzip -9cn bsd.strip > bsd.gz
 
 bsd.rd: mr.fs bsd

Reply via email to