Re: Making install CDs contain the full sets

Martin Husemann <[email protected]>
Newsgroups gmane.os.netbsd.devel.installation
Message-ID <[email protected]>
I added support to strip all "rump" or "compat" marked files from the
extracted sets and the images became resonably sized again:

-r--r--r--  1 root  wheel  450M Aug 12 14:57 NetBSD-7.99.1-amd64.iso
-r--r--r--  1 root  wheel  449M Aug 12 14:54 NetBSD-7.99.1-i386.iso
-r--r--r--  1 root  wheel  421M Aug 12 12:43 NetBSD-7.99.1-sparc64.iso
-r--r--r--  1 root  wheel  287M Aug 12 10:46 NetBSD-7.99.1-vax.iso

I think this is acceptable, and it saves quite some maintenance overhead,
simplifies the makefiles and makes the CDs more generally usefull.

I wonder if build.sh should be able to deal with an invocation like
"build.sh release iso-image" and enforce the (now necessarry) variant
"build.sh release sets iso-image".

Actually I'd like "build.sh iso-image" to automagically expand to that.

Comments? Review?

Martin
patch (text/plain, 13.5 KB)
Index: amd64/cdroms/Makefile.cdrom
===================================================================
RCS file: /cvsroot/src/distrib/amd64/cdroms/Makefile.cdrom,v
retrieving revision 1.10
diff -u -r1.10 Makefile.cdrom
--- amd64/cdroms/Makefile.cdrom	26 Jul 2014 19:34:08 -0000	1.10
+++ amd64/cdroms/Makefile.cdrom	12 Aug 2014 13:08:33 -0000
@@ -11,61 +11,11 @@
 CDKERNELS=	netbsd-GENERIC.gz       netbsd
 CDRELEASE_NOISOS=	true
 
-CDRUNTIME+=	./bin
-CDRUNTIME+=	./dev/MAKEDEV
-CDRUNTIME+=	./etc
-CDRUNTIME+=	./lib
-CDRUNTIME+=	./libdata
-CDRUNTIME+=	./libexec/ld.elf_so
-CDRUNTIME+=	./libexec/lfs_cleanerd
-CDRUNTIME+=	./libexec/dhcpcd-run-hooks
-CDRUNTIME+=	./libexec/resolvconf/
-CDRUNTIME+=	./mnt
-CDRUNTIME+=	./sbin
-CDRUNTIME+=	./stand
-CDRUNTIME+=	./tmp
-CDRUNTIME+=	./usr/bin/ftp
-CDRUNTIME+=	./usr/bin/grep
-CDRUNTIME+=	./usr/bin/gzip
-CDRUNTIME+=	./usr/bin/less
-CDRUNTIME+=	./usr/bin/more
-CDRUNTIME+=	./usr/bin/netstat
-CDRUNTIME+=	./usr/bin/progress
-CDRUNTIME+=	./usr/bin/sed
-CDRUNTIME+=	./usr/bin/sort
-CDRUNTIME+=	./usr/bin/tip
-CDRUNTIME+=	./usr/bin/tput
-CDRUNTIME+=	./usr/bin/vi
-CDRUNTIME+=	./usr/bin/vmstat
-CDRUNTIME+=	./usr/lib/libbz2.so*
-CDRUNTIME+=	./usr/lib/libc.so*
-CDRUNTIME+=	./usr/lib/libcurses.so*
-CDRUNTIME+=	./usr/lib/libedit.so*
-CDRUNTIME+=	./usr/lib/libgcc_s.so*
-CDRUNTIME+=	./usr/lib/libintl.so*
-CDRUNTIME+=	./usr/lib/libkvm.so*
-CDRUNTIME+=	./usr/lib/liblzma.so*
-CDRUNTIME+=	./usr/lib/libterminfo.so*
-CDRUNTIME+=	./usr/lib/libutil.so*
-CDRUNTIME+=	./usr/lib/libz.so*
-.if (${MKCRYPTO} != "no")
-CDRUNTIME+=	./usr/lib/libcrypto.so*
-CDRUNTIME+=	./usr/lib/libssl.so*
-.endif
-CDRUNTIME+=	./usr/libexec/ld.elf_so
-CDRUNTIME+=	./usr/libexec/getty
-CDRUNTIME+=	./usr/mdec
-CDRUNTIME+=	./usr/sbin/chroot
-CDRUNTIME+=	./usr/sbin/installboot
-CDRUNTIME+=	./usr/sbin/wiconfig
-CDRUNTIME+=	./usr/share/misc/terminfo.cdb
-CDRUNTIME+=	./usr/share/locale
-
 image_md_pre:
 	${MKDIR} cdrom/libexec/dhcpcd-hooks
 	${INSTALL} ${COPY} ${.CURDIR}/../../../common/10-resolv.conf cdrom/libexec/dhcpcd-hooks
 	${INSTALL} ${COPY} ${.CURDIR}/../../../common/99-print-sysinst cdrom/libexec/dhcpcd-hooks
-	${MKDIR} cdrom/etc
+	${RM} -f cdrom/etc/gettytab cdrom/etc/ttys cdrom/etc/rc
 	${HOST_LN} -fs /tmp/gettytab cdrom/etc/gettytab
 	${INSTALL} ${COPY} ${.CURDIR}/../etc.ttys cdrom/etc/ttys
 	${INSTALL} ${COPY} ${.CURDIR}/../etc.rc cdrom/etc/rc
Index: common/Makefile.bootcd
===================================================================
RCS file: /cvsroot/src/distrib/common/Makefile.bootcd,v
retrieving revision 1.25
diff -u -r1.25 Makefile.bootcd
--- common/Makefile.bootcd	31 May 2014 10:18:47 -0000	1.25
+++ common/Makefile.bootcd	12 Aug 2014 13:08:33 -0000
@@ -31,6 +31,9 @@
 #	CDKERNELS	couples of the form:
 #				source	name_on_cd
 #	CDRUNTIME	files/directories to copy from $DESTDIR onto the CD
+#	CD_SETS		sets to be extracted onto the CD
+#			(default: base modules etc)
+#	SETS_DIR	where the CD_SETS are found (default provided)
 # source kernels are copied from ${CDINSTKERNEL} (or its obj dir)
 # note that as of yet, bootxx_cd9660 can't load kernel names of more than
 # 8 chars (though they can be in a sub-directory meaning the pathname is
@@ -56,6 +59,9 @@
 CDRELEASE_EXCLUDE+=	-s ',./installation/installimage.*,,gp'
 .endif
 
+CD_SETS?=	base modules etc
+SETS_DIR?=	${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
+
 .include <bsd.own.mk> 		# For PRINTOBJDIR
 .include <bsd.kernobj.mk>	# For KERNSRCDIR
 
@@ -81,10 +87,12 @@
 .else
 CDIMAGE=	NetBSD-${DISTRIBVER}-${CDBASE:S/cd$//}.iso
 .endif
+WORKSPEC=	fs.spec
+CDMAKEFSEXTRAOPTS+=-F ${WORKSPEC}
 
 CLEANFILES+=	${CDIMAGE}
 CLEANFILES+=	bootxx.${MACHINE}
-
+CLEANFILES+=	${WORKSPEC}
 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
@@ -205,8 +213,45 @@
 			cd $$curdir;					\
 		done;							\
 	fi
+.for set in ${CD_SETS}
+	@if [ ! -f ${SETS_DIR}/${set}.tgz ]; then		\
+		echo "Missing ${SETS_DIR}/${set}.tgz, aborting"; \
+		false;						\
+	fi
+	@echo Extracting ${set}.tgz ...
+	@(cd cdrom; ${TOOL_PAX} -rnz -f ${SETS_DIR}/${set}.tgz . )
+	@echo Removing compat and rump parts from ${set}.tgz ...
+	@(cd cdrom; 				\
+		FULL=/tmp/list.$$$$.full;		\
+		PART=/tmp/list.$$$$.part;		\
+		${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makeflist ${set} | \
+			sort -u > $${FULL};	\
+		MKRUMP=no; MKCOMPAT=no; export MKDEBUG=no; MKDEBUGLIB=no; \
+		export MKRUMP MKCOMPAT MKDEBUG MKDEBUGLIB;	\
+		${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makeflist ${set} | \
+			sort -u > $${PART};	\
+		comm -23 $${FULL} $${PART} | xargs -I{} rm -f {};	\
+		rm $${FULL} $${PART} )
+.endfor
 
 image:
+	@echo Preparing spec files for makefs...
+	${RM} -f ${WORKSPEC}
+	cat cdrom/etc/mtree/* |					\
+	    ${TOOL_SED} -e 's/ size=[0-9]*//'				\
+	     -e '/^\.\/etc\/gettytab/d' > ${WORKSPEC}
+	${HOST_SH} cdrom/dev/MAKEDEV -s all |			\
+	    ${TOOL_SED} -e '/^\. type=dir/d' -e 's,^\.,./dev,' >> ${WORKSPEC}
+.if defined(SPEC_IN)
+	cat ${SPEC_IN} >> ${WORKSPEC}
+.endif
+.if defined(SECONDARY_BOOT)
+	echo "./${SECONDARY_BOOT} type=file uname=root gname=wheel mode=0444" \
+	    >> ${WORKSPEC}
+.endif
+.if defined(SPEC_EXTRA)
+	cat ${SPEC_EXTRA} >> ${WORKSPEC}
+.endif
 	${TOOL_MAKEFS} -t cd9660 ${CDMAKEFSEXTRAOPTS} -o ${_CDMAKEFSOPTIONS:Q} ${CDIMAGE} cdrom
 
 .if ${CDRELEASE} == false
Index: i386/cdroms/Makefile.cdrom
===================================================================
RCS file: /cvsroot/src/distrib/i386/cdroms/Makefile.cdrom,v
retrieving revision 1.30
diff -u -r1.30 Makefile.cdrom
--- i386/cdroms/Makefile.cdrom	26 Jul 2014 19:34:08 -0000	1.30
+++ i386/cdroms/Makefile.cdrom	12 Aug 2014 13:08:33 -0000
@@ -11,61 +11,11 @@
 CDKERNELS=	netbsd-GENERIC.gz       netbsd
 CDRELEASE_NOISOS=	true
 
-CDRUNTIME+=	./bin
-CDRUNTIME+=	./dev/MAKEDEV
-CDRUNTIME+=	./etc
-CDRUNTIME+=	./lib
-CDRUNTIME+=	./libdata
-CDRUNTIME+=	./libexec/ld.elf_so
-CDRUNTIME+=	./libexec/lfs_cleanerd
-CDRUNTIME+=	./libexec/dhcpcd-run-hooks
-CDRUNTIME+=	./libexec/resolvconf/
-CDRUNTIME+=	./mnt
-CDRUNTIME+=	./sbin
-CDRUNTIME+=	./stand
-CDRUNTIME+=	./tmp
-CDRUNTIME+=	./usr/bin/ftp
-CDRUNTIME+=	./usr/bin/grep
-CDRUNTIME+=	./usr/bin/gzip
-CDRUNTIME+=	./usr/bin/less
-CDRUNTIME+=	./usr/bin/more
-CDRUNTIME+=	./usr/bin/netstat
-CDRUNTIME+=	./usr/bin/progress
-CDRUNTIME+=	./usr/bin/sed
-CDRUNTIME+=	./usr/bin/sort
-CDRUNTIME+=	./usr/bin/tip
-CDRUNTIME+=	./usr/bin/tput
-CDRUNTIME+=	./usr/bin/vi
-CDRUNTIME+=	./usr/bin/vmstat
-CDRUNTIME+=	./usr/lib/libbz2.so*
-CDRUNTIME+=	./usr/lib/libc.so*
-CDRUNTIME+=	./usr/lib/libcurses.so*
-CDRUNTIME+=	./usr/lib/libedit.so*
-CDRUNTIME+=	./usr/lib/libgcc_s.so*
-CDRUNTIME+=	./usr/lib/libintl.so*
-CDRUNTIME+=	./usr/lib/libkvm.so*
-CDRUNTIME+=	./usr/lib/liblzma.so*
-CDRUNTIME+=	./usr/lib/libterminfo.so*
-CDRUNTIME+=	./usr/lib/libutil.so*
-CDRUNTIME+=	./usr/lib/libz.so*
-.if (${MKCRYPTO} != "no")
-CDRUNTIME+=	./usr/lib/libcrypto.so*
-CDRUNTIME+=	./usr/lib/libssl.so*
-.endif
-CDRUNTIME+=	./usr/libexec/ld.elf_so
-CDRUNTIME+=	./usr/libexec/getty
-CDRUNTIME+=	./usr/mdec
-CDRUNTIME+=	./usr/sbin/chroot
-CDRUNTIME+=	./usr/sbin/installboot
-CDRUNTIME+=	./usr/sbin/wiconfig
-CDRUNTIME+=	./usr/share/misc/terminfo.cdb
-CDRUNTIME+=	./usr/share/locale
-
 image_md_pre:
 	${MKDIR} cdrom/libexec/dhcpcd-hooks
 	${INSTALL} ${COPY} ${.CURDIR}/../../../common/10-resolv.conf cdrom/libexec/dhcpcd-hooks
 	${INSTALL} ${COPY} ${.CURDIR}/../../../common/99-print-sysinst cdrom/libexec/dhcpcd-hooks
-	${MKDIR} cdrom/etc
+	${RM} -f cdrom/etc/gettytab cdrom/etc/ttys cdrom/etc/rc cdrom/install.sh
 	${HOST_LN} -fs /tmp/gettytab cdrom/etc/gettytab
 	${INSTALL} ${COPY} ${.CURDIR}/../etc.ttys cdrom/etc/ttys
 	${INSTALL} ${COPY} ${.CURDIR}/../etc.rc cdrom/etc/rc
Index: sparc64/cdroms/installcd/Makefile
===================================================================
RCS file: /cvsroot/src/distrib/sparc64/cdroms/installcd/Makefile,v
retrieving revision 1.18
diff -u -r1.18 Makefile
--- sparc64/cdroms/installcd/Makefile	26 Jul 2014 19:34:08 -0000	1.18
+++ sparc64/cdroms/installcd/Makefile	12 Aug 2014 13:08:34 -0000
@@ -1,6 +1,7 @@
 #	$NetBSD: Makefile,v 1.18 2014/07/26 19:34:08 dholland Exp $
 CDBASE=		sparc64cd		# gives ${CDBASE}.iso
 CDRELEASE=	true			# include $RELEASEDIR/$MACHINE
+CDKERNELS=	${RELEASEDIR}/${MACHINE}/binary/kernel/netbsd-GENERIC.gz	netbsd
 
 # for PRINTOBJDIR
 .include <bsd.own.mk>
@@ -12,63 +13,11 @@
 CDBOOTIMAGE=    ${CDBOOTIMAGEDIR}/boot.fs
 SUN_BOOT_ARGS:=  - - - - ${CDBOOTIMAGE}
 
-CDRUNTIME+=	./bin
-CDRUNTIME+=	./dev/MAKEDEV
-CDRUNTIME+=	./etc
-CDRUNTIME+=	./lib
-CDRUNTIME+=	./libdata
-CDRUNTIME+=	./libexec
-CDRUNTIME+=	./mnt
-CDRUNTIME+=	./sbin
-# CDRUNTIME+=	./stand
-CDRUNTIME+=	./tmp
-CDRUNTIME+=	./usr/bin/ftp
-CDRUNTIME+=	./usr/bin/getopt
-CDRUNTIME+=	./usr/bin/gunzip
-CDRUNTIME+=	./usr/bin/gzcat
-CDRUNTIME+=	./usr/bin/gzip
-CDRUNTIME+=	./usr/bin/grep
-CDRUNTIME+=	./usr/bin/less
-CDRUNTIME+=	./usr/bin/more
-CDRUNTIME+=	./usr/bin/netstat
-CDRUNTIME+=	./usr/bin/progress
-CDRUNTIME+=	./usr/bin/sed
-CDRUNTIME+=	./usr/bin/sort
-CDRUNTIME+=	./usr/bin/tip
-CDRUNTIME+=	./usr/bin/tput
-CDRUNTIME+=	./usr/bin/vi
-CDRUNTIME+=	./usr/bin/vmstat
-CDRUNTIME+=	./usr/lib/libbz2.so*
-CDRUNTIME+=	./usr/lib/libc.so*
-CDRUNTIME+=	./usr/lib/libcurses.so*
-CDRUNTIME+=	./usr/lib/libedit.so*
-CDRUNTIME+=	./usr/lib/libgcc_s.so*
-CDRUNTIME+=	./usr/lib/libintl.so*
-CDRUNTIME+=	./usr/lib/libkvm.so*
-CDRUNTIME+=	./usr/lib/liblzma.so*
-CDRUNTIME+=	./usr/lib/libterminfo.so*
-CDRUNTIME+=	./usr/lib/libutil.so*
-CDRUNTIME+=	./usr/lib/libz.so*
-.if (${MKCRYPTO} != "no")
-CDRUNTIME+=	./usr/lib/libcrypto.so*
-CDRUNTIME+=	./usr/lib/libssl.so*
-.endif
-CDRUNTIME+=	./usr/libexec/ld.elf_so
-CDRUNTIME+=	./usr/libexec/getty
-CDRUNTIME+=	./usr/mdec
-CDRUNTIME+=	./usr/sbin/chat
-CDRUNTIME+=	./usr/sbin/chroot
-CDRUNTIME+=	./usr/sbin/installboot
-CDRUNTIME+=	./usr/sbin/pppd
-CDRUNTIME+=	./usr/sbin/wiconfig
-CDRUNTIME+=	./usr/share/misc/terminfo.cdb
-CDRUNTIME+=	./usr/share/locale
-
 image_md_pre:
 	${RM} -rf cdrom/libexec/dhcpcd-hooks/*
 	${CP} ${.CURDIR}/../../../common/10-resolv.conf cdrom/libexec/dhcpcd-hooks
 	${CP} ${.CURDIR}/../../../common/99-print-sysinst cdrom/libexec/dhcpcd-hooks
-	${MKDIR} cdrom/etc
+	${RM} -f cdrom/etc/gettytab cdrom/etc/ttys cdrom/etc/rc
 	${HOST_LN} -fs /tmp/gettytab cdrom/etc/gettytab
 	${INSTALL} ${COPY} ${.CURDIR}/etc.ttys cdrom/etc/ttys
 	${INSTALL} ${COPY} ${.CURDIR}/etc.rc cdrom/etc/rc
@@ -78,14 +27,10 @@
 	for f in ${SYSINSTDIR}/sysinstmsgs.??; do \
 		${INSTALL} ${COPY} $$f cdrom; \
 	done
-	${MKDIR} cdrom/var
-	${MKDIR} cdrom/kern
-	${CP} ${RELEASEDIR}/sparc64/binary/kernel/netbsd-GENERIC.gz cdrom/netbsd
 
 image_md_post:
 	SUNLABEL=${TOOL_SUNLABEL:Q} \
 		${HOST_SH} ${NETBSDSRCDIR}/distrib/common/sunbootcd.sh \
 		${CDIMAGE} ${SUN_BOOT_ARGS}
-	
 
 .include "${.CURDIR}/../../../common/Makefile.bootcd"
Index: vax/cdroms/installcd/Makefile
===================================================================
RCS file: /cvsroot/src/distrib/vax/cdroms/installcd/Makefile,v
retrieving revision 1.8
diff -u -r1.8 Makefile
--- vax/cdroms/installcd/Makefile	26 Jul 2014 19:34:08 -0000	1.8
+++ vax/cdroms/installcd/Makefile	12 Aug 2014 13:08:34 -0000
@@ -3,9 +3,7 @@
 CDRELEASE=	true			# include $RELEASEDIR/$MACHINE
 CDKERNELS=	${RELEASEDIR}/${MACHINE}/binary/kernel/netbsd-GENERIC.gz	netbsd.gz
 CDRELEASE_NOISOS=true
-CDMAKEFSEXTRAOPTS+=-F ./fs.spec
-
-CLEANFILES+= fs.spec
+CD_SETS=	base etc	# no modules for VAX
 
 # for PRINTOBJDIR
 .include <bsd.own.mk>
@@ -21,7 +19,7 @@
 	${MKDIR} -p cdrom/libexec/dhcpcd-hooks
 	${CP} ${.CURDIR}/../../../common/10-resolv.conf cdrom/libexec/dhcpcd-hooks
 	${CP} ${.CURDIR}/../../../common/99-print-sysinst cdrom/libexec/dhcpcd-hooks
-	${MKDIR} cdrom/etc
+	${RM} -f cdrom/etc/gettytab cdrom/etc/ttys cdrom/etc/rc
 	${HOST_LN} -fs /tmp/gettytab cdrom/etc/gettytab
 	${INSTALL} ${COPY} ${.CURDIR}/etc.ttys cdrom/etc/ttys
 	${INSTALL} ${COPY} ${.CURDIR}/etc.rc cdrom/etc/rc
@@ -32,66 +30,9 @@
 		${INSTALL} ${COPY} $$f cdrom; \
 	done
 	${TOOL_GZIP} -d -f cdrom/netbsd.gz
-	echo '. type=dir optional' > ./fs.spec
-	echo './dev type=dir optional' >> ./fs.spec
-	${HOST_SH} cdrom/dev/MAKEDEV -s all | ${TOOL_SED} -e '1d' -e 's:^\./:./dev/:' >> ./fs.spec
-	${MKDIR} cdrom/var
-	${MKDIR} cdrom/kern
 
 # make the CD bootable
 image_md_post:
 	${TOOL_INSTALLBOOT} -m${MACHINE} ${CDIMAGE} bootxx.${MACHINE}
 
-CDRUNTIME+=	./bin
-CDRUNTIME+=	./dev/MAKEDEV
-CDRUNTIME+=	./etc
-CDRUNTIME+=	./lib
-CDRUNTIME+=	./libdata
-CDRUNTIME+=	./libexec
-CDRUNTIME+=	./mnt
-CDRUNTIME+=	./sbin
-# CDRUNTIME+=	./stand
-CDRUNTIME+=	./tmp
-CDRUNTIME+=	./usr/bin/ftp
-CDRUNTIME+=	./usr/bin/getopt
-CDRUNTIME+=	./usr/bin/gunzip
-CDRUNTIME+=	./usr/bin/gzcat
-CDRUNTIME+=	./usr/bin/gzip
-CDRUNTIME+=	./usr/bin/grep
-CDRUNTIME+=	./usr/bin/less
-CDRUNTIME+=	./usr/bin/more
-CDRUNTIME+=	./usr/bin/netstat
-CDRUNTIME+=	./usr/bin/progress
-CDRUNTIME+=	./usr/bin/sed
-CDRUNTIME+=	./usr/bin/sort
-CDRUNTIME+=	./usr/bin/tip
-CDRUNTIME+=	./usr/bin/tput
-CDRUNTIME+=	./usr/bin/vi
-CDRUNTIME+=	./usr/bin/vmstat
-CDRUNTIME+=	./usr/lib/libbz2.so*
-CDRUNTIME+=	./usr/lib/libc.so*
-CDRUNTIME+=	./usr/lib/libcurses.so*
-CDRUNTIME+=	./usr/lib/libedit.so*
-CDRUNTIME+=	./usr/lib/libgcc_s.so*
-CDRUNTIME+=	./usr/lib/libintl.so*
-CDRUNTIME+=	./usr/lib/libkvm.so*
-CDRUNTIME+=	./usr/lib/liblzma.so*
-CDRUNTIME+=	./usr/lib/libterminfo.so*
-CDRUNTIME+=	./usr/lib/libutil.so*
-CDRUNTIME+=	./usr/lib/libz.so*
-.if (${MKCRYPTO} != "no")
-CDRUNTIME+=	./usr/lib/libcrypto.so*
-CDRUNTIME+=	./usr/lib/libssl.so*
-.endif
-CDRUNTIME+=	./usr/libexec/ld.elf_so
-CDRUNTIME+=	./usr/libexec/getty
-CDRUNTIME+=	./usr/mdec
-CDRUNTIME+=	./usr/sbin/chat
-CDRUNTIME+=	./usr/sbin/chroot
-CDRUNTIME+=	./usr/sbin/installboot
-CDRUNTIME+=	./usr/sbin/pppd
-CDRUNTIME+=	./usr/sbin/wiconfig
-CDRUNTIME+=	./usr/share/misc/terminfo.cdb
-CDRUNTIME+=	./usr/share/locale
-
 .include "${.CURDIR}/../../../common/Makefile.bootcd"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.