Subject: expanding
To: None <tech-userlevel@netbsd.org, tech-install@netbsd.org>
From: Simon Burge <simonb@netbsd.org>
List: tech-install
Date: 04/25/1999 13:45:57
[[ Not sure which list to send this to - sorry for the double-up ]]

I've got some patches to "make release" that nearly DTRT for building a
complete pmax release, but want to run them past people before I commit
them.  It's not real pretty stuff, but it seems to work well for me.

In a nutshell, etc/Makefile has "snap_md" split into "snap_md_pre" and
"snap_md_post", and the directories to build in ${RELEASEDIR} are now
in an extendable list.  The section that builds extra (but not shipped)
kernels I think could be better (it's XXX'd), but I can think how off
the top of my head.

Right now, "build release" does everything for a pmax release but put
the INSTALL notes in the top level ${RELEASEDIR} directory.  The only
reason I haven't done this is that the pmax notes are still lacking and
I don't want them there yet :-(

Comments anyone (especially Curt & Scott who have tinkered with this
recently)?

Simon.
--
Index: etc/Makefile
===================================================================
RCS file: /cvsroot/src/etc/Makefile,v
retrieving revision 1.116
diff -u -r1.116 Makefile
--- Makefile	1999/04/10 04:41:52	1.116
+++ Makefile	1999/04/25 03:44:54
@@ -51,6 +51,11 @@
 BIN2=
 BIN3=
 
+# Directories to build in ${RELEASEDIR}.   MD Makefile.inc files can
+# add to this.
+INSTALLATION_DIRS= \
+	binary binary/sets binary/kernel binary/security installation
+
 .if exists(etc.${MACHINE}/Makefile.inc)
 .include "etc.${MACHINE}/Makefile.inc"
 .endif
@@ -215,11 +220,11 @@
 	cd ${DESTDIR}; rm -f sys; ln -s usr/src/sys sys
 
 .if !defined(RELEASEDIR)
-release snapshot snap_pre:
+release snapshot snap_pre snap_md_pre snap_kern snap_md_post:
 	@echo setenv RELEASEDIR before doing that!
 	@false
 .else
-release snapshot: distribution snap_pre snap_md snap_kern 
+release snapshot: distribution snap_pre snap_md_pre snap_kern snap_md_post
 	sh ../distrib/sets/maketars -s ../distrib/sets \
 		-d ${DESTDIR} -t ${RELEASEDIR}/binary/sets
 .if exists(../domestic) && !defined(EXPORTABLE_SYSTEM)
@@ -247,11 +252,9 @@
 snap_pre:
 	/bin/rm -rf ${RELEASEDIR}
 	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}
-	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary
-	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/sets
-	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/kernel
-	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/binary/security
-	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/installation
+.for dir in ${INSTALLATION_DIRS}
+	${INSTALL} -d -o root -g wheel -m 755 ${RELEASEDIR}/${dir}
+.endfor
 
 # the regular expression does a basename(1) on .CURDIR so that we don't
 # have to keep looking up .. at compile time.
@@ -282,6 +285,8 @@
 	cd ${KERNOBJDIR}/GENERIC &&	\
 		tar cf - `${GETKERNELAWK} ${KERNCONFDIR}/GENERIC` |\
 		gzip -c -9 > ${RELEASEDIR}/binary/sets/kern.tgz
+# XXX use same loop for ${EXTRA_KERNELS} and ${BUILD_KERNELS} but
+# XXX only install ${EXTRA_KERNELS} in binary/kernel???
 .for configfile in ${EXTRA_KERNELS}
 	cd ${KERNCONFDIR} && config \
 		-b ${KERNOBJDIR}/${configfile} -s ${KERNSRCDIR} ${configfile}
@@ -295,10 +300,21 @@
 		gzip -c -9 < $${kernel} > \
 			${RELEASEDIR}/binary/kernel/$${kernel}.${configfile}.gz ; }
 .endfor # EXTRA_KERNELS
+.for configfile in ${BUILD_KERNELS}
+	cd ${KERNCONFDIR} && config \
+		-b ${KERNOBJDIR}/${configfile} -s ${KERNSRCDIR} ${configfile}
+.ifndef UPDATE
+	cd ${KERNOBJDIR}/${configfile} && ${MAKE} clean 
+.endif
+	cd ${KERNOBJDIR}/${configfile} && ${MAKE} depend && ${MAKE} ${_J}
+.endfor # BUILD_KERNELS
 
 .endif # RELEASEDIR check
+
+snap_md_pre:
+# nothing here -- look in the machine-dependent Makefile.inc
 
-snap_md:
+snap_md_post:
 # nothing here -- look in the machine-dependent Makefile.inc
 
 .endif	# DESTDIR check
Index: etc/etc.pmax/Makefile.inc
===================================================================
RCS file: /cvsroot/src/etc/etc.pmax/Makefile.inc,v
retrieving revision 1.3
diff -u -r1.3 Makefile.inc
--- Makefile.inc	1999/02/05 03:01:52	1.3
+++ Makefile.inc	1999/04/25 03:44:55
@@ -6,3 +6,48 @@
 # Set this for any kernels beyond GENERIC you want to include
 # in the distribution.
 #EXTRA_KERNELS+=
+
+# Set this for any kernels beyond GENERIC and ${EXTRA_KERNELS} you
+# need to build to make installation tools/media.
+BUILD_KERNELS+=INSTALL RAMDISK
+
+# Add any extra release directories to be made
+INSTALLATION_DIRS+=installation/diskimage installation/netboot
+
+# location of the source diskimage
+DISKIMAGE_DIR!=		cd ${.CURDIR}/../distrib/pmax/instkernel && ${MAKE} -s print-objdir
+DISKIMAGE=		${DISKIMAGE_DIR}/diskimage.gz
+
+# location of the source netboot diskimage tar file
+DISKIMAGE_TAR_DIR!=	cd ${.CURDIR}/../distrib/pmax/ramdisk && ${MAKE} -s print-objdir
+DISKIMAGE_TAR=		${DISKIMAGE_TAR_DIR}/diskimage.tgz
+
+# location of the ramdisk install kernel
+INSTALLKERN_DIR!=	cd ${.CURDIR}/../distrib/pmax/instkernel && ${MAKE} -s print-objdir
+INSTALLKERN=		${INSTALLKERN_DIR}/netbsd.gz
+INSTALLKERNNAME=	install.gz
+
+# location and name of the stripped down NFS install kernel
+NFSCONF=		INSTALL
+NFSKERNNAME=		nfsnetbsd
+# We don't know about ${KERNOBJDIR} yet ...
+NFSKERNDIR=		${.CURDIR:C/[^\/]+$//}sys/arch/${MACHINE}/compile/${NFSCONF}
+NFSKERN=		${NFSKERNDIR}/${NFSKERNNAME}
+
+snap_md_post: ${DISKIMAGE} ${DISKIMAGE_TAR} ${INSTALLKERN}
+	${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o root -g wheel \
+		-m ${BINMODE} ${NFSKERN}.ecoff \
+		${RELEASEDIR}/binary/kernel/${NFSKERNNAME}
+	gzip -9 ${RELEASEDIR}/binary/kernel/${NFSKERNNAME}
+	${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o root -g wheel \
+		-m ${BINMODE} ${INSTALLKERN} \
+		${RELEASEDIR}/binary/kernel/${INSTALLKERNNAME}
+	${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o root -g wheel \
+		-m ${NONBINMODE} ${DISKIMAGE} \
+		${RELEASEDIR}/installation/diskimage
+	${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o root -g wheel \
+		-m ${NONBINMODE} ${DISKIMAGE_TAR} \
+		${RELEASEDIR}/installation/netboot
+
+${DISKIMAGE} ${DISKIMAGE_TAR} ${INSTALLKERN}:
+	cd ${.CURDIR}/../distrib/pmax && ${MAKE} ${_J}