xref: /freebsd/release/Makefile (revision 0a0743b52a41a552fe27c4b29e9b62de29f6e213)
197d92980SPeter Wemm# $FreeBSD$
20202c140SRodney W. Grimes#
3aeb6d603SJordan K. Hubbard# make release CHROOTDIR=/some/dir BUILDNAME=somename [ RELEASETAG=tag ]
4bd668f6fSPoul-Henning Kamp#
5aeb6d603SJordan K. Hubbard# Where "/some/dir" is the pathname of a directory on a some
68e291261SJohn Polstra# filesystem with at least 1000MB of free space, "somename" is what
7aeb6d603SJordan K. Hubbard# you want the release to call itself and, optionally, which CVS "tag"
8aeb6d603SJordan K. Hubbard# name should be used when checking out the sources to build the release
9aeb6d603SJordan K. Hubbard# (default is HEAD).
10bd668f6fSPoul-Henning Kamp#
11aeb6d603SJordan K. Hubbard# Please note: the vn driver must also be compiled into your kernel,
12f1a03fb6SAndreas Klemm# otherwise the target 'release.8' and possibly others will fail.
13f1a03fb6SAndreas Klemm#
14aeb6d603SJordan K. Hubbard# Set these, release builder!
15d013a27bSJoerg Wunsch#
16d013a27bSJoerg Wunsch# Fixed version:
1720ffc587SYoshihiro Takahashi#BUILDNAME=5.0-RELEASE
18d013a27bSJoerg Wunsch#
19d013a27bSJoerg Wunsch# Automatic SNAP versioning:
20fcab936bSDag-Erling SmørgravDATE != date +%Y%m%d
2120ffc587SYoshihiro TakahashiBASE = 5.0
2264938abfSJordan K. HubbardBUILDNAME?=${BASE}-${DATE}-SNAP
23d013a27bSJoerg Wunsch#
24fe85fe95SJordan K. Hubbard#CHROOTDIR=/junk/release
253da2229cSBrian Somers# If this is a -stable snapshot, then set
2616cca1b2SAlexander Langer#RELEASETAG=RELENG_4
273f17d264SSatoshi Asami#
283f17d264SSatoshi Asami# Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
293f17d264SSatoshi Asami# are building an official release.  Otherwise, we are building for
303f17d264SSatoshi Asami# a branch.
313f17d264SSatoshi Asami.if defined(RELEASETAG)
323f17d264SSatoshi AsamiISRELEASE!=	expr ${RELEASETAG} : '^RELENG_.*_RELEASE$$' || true
333f17d264SSatoshi Asami.if ${ISRELEASE} != 0
343f17d264SSatoshi Asami# Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees.
353f17d264SSatoshi AsamiAUXRELEASETAG!=	echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//'
365be3b5d9SJordan K. HubbardDOCRELEASETAG?=		${AUXRELEASETAG}
375be3b5d9SJordan K. HubbardPORTSRELEASETAG?=	${AUXRELEASETAG}
383f17d264SSatoshi Asami.endif
393f17d264SSatoshi Asami.endif
40ab0e9cdcSPoul-Henning Kamp
41968f82b7SWarner LoshKERNCONF=GENERIC
421a95b917SMark Murray
43fff8eb57SJohn Baldwin# If you want to pass flags to the world build such as -j X, use
44fff8eb57SJohn Baldwin# WORLD_FLAGS.  Similarly, you can specify make flags for kernel
45fff8eb57SJohn Baldwin# builds via KERNEL_FLAGS.
46fff8eb57SJohn Baldwin#WORLD_FLAGS=-j4
47fff8eb57SJohn Baldwin#KERNEL_FLAGS=-j4
48fff8eb57SJohn Baldwin
490c9cba52SMike Smith# If you are using a local CVS repository with components stored in
500c9cba52SMike Smith# non-standard modules, override these on the make commandline or
510c9cba52SMike Smith# in the environment.
520c9cba52SMike SmithRELEASESRCMODULE?=	src
530c9cba52SMike SmithRELEASEDOCMODULE?=	doc
540c9cba52SMike SmithRELEASEPORTSMODULE?=	ports
550c9cba52SMike Smith
5654d7af2eSJordan K. Hubbard# Unless set elsewhere, indicate the object format we'll be using.
57e8341fd0SJordan K. HubbardOBJFORMAT?=		elf
5854d7af2eSJordan K. Hubbard
59e97fdb25SJordan K. Hubbard# Uncomment this to disable the doc.1 target.  It is also an ERROR
60e97fdb25SJordan K. Hubbard# to set NOPORTS and not set NODOC since docs depend on ports.
6185486998SJordan K. Hubbard#NODOC=  YES
62d6c7028cSJohn Hay#NOPORTS=  YES
6350ee7e6cSJordan K. Hubbard# Set ALLLANG=no if you want the release documentation to be
648f24c563SJoseph Koshy# in English only.
6550ee7e6cSJordan K. HubbardALLLANG?=	yes
662f332092SJordan K. HubbardDOCPORTS=	textproc/docproj
67f6ede19cSJohn Baldwin# Set this to wherever the distfiles required by ${DOCPORTS} live.
68065aa0a0SJohn BaldwinDOCDISTFILES?=	${.CURDIR}/../../ports/distfiles
69ce51a9fcSJordan K. Hubbard# Set this to 1 if you want -P to be used for automatic keyboard detection
70ce51a9fcSJordan K. Hubbard# on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
71ce51a9fcSJordan K. HubbardAUTO_KEYBOARD_DETECT?= 0
72ce51a9fcSJordan K. Hubbard
737a9a71e0SJordan K. Hubbard
74ed517874SJordan K. HubbardDIST_DOCS= ABOUT.TXT ERRATA.TXT LAYOUT.TXT README.TXT HARDWARE.TXT \
75022090a6SJordan K. Hubbard           RELNOTES.TXT TROUBLE.TXT UPGRADE.TXT INSTALL.TXT
76ed517874SJordan K. Hubbard
77bd668f6fSPoul-Henning Kamp# Things which without too much trouble can be considered variables
787284556fSJordan K. Hubbard# BIN_DISTS are special in that they get full /etc installation sets.
797284556fSJordan K. Hubbard#
809f08adb1SDavid E. O'BrienCOMPAT_DISTS?=	compat1x compat20 compat21 compat22 compat3x
8148084fddSJordan K. HubbardOTHER_DISTS?=	manpages catpages games proflibs dict info doc
82470f825fSJordan K. HubbardCRYPTO_DISTS?=	crypto krb4 krb5
837284556fSJordan K. HubbardBIN_DISTS?=	bin
840a9e93bfSJordan K. HubbardDISTRIBUTIONS?=	${BIN_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
8516c61233SJordan K. HubbardKERNELS?=	GENERIC
86785bd4b4SPoul-Henning Kamp
87fb71f0f6SJordan K. HubbardBOOT1=	etc/protocols etc/defaults/rc.conf
881cdab3d4SJordan K. Hubbard
897c474103SPoul-Henning Kamp# mountpoint for filesystems.
907c474103SPoul-Henning KampMNT=			/mnt
91518a1d34SPoul-Henning Kamp
92a5ddb8cfSJordan K. Hubbard# Various floppy image parameters.
93a5ddb8cfSJordan K. Hubbard#
94b98c5f70STatsumi Hosokawa
95b98c5f70STatsumi Hosokawa.if ${MACHINE_ARCH} == "i386"
96a40915d7SYoshihiro Takahashi.if ${MACHINE} == "pc98"
977920b17fSYoshihiro TakahashiSMALLBOOTSIZE=		1200
987920b17fSYoshihiro TakahashiBOOTSIZE=		1440
99a40915d7SYoshihiro TakahashiFIXITSIZE=		1440
100a40915d7SYoshihiro TakahashiMFSSIZE=		2880
101a40915d7SYoshihiro TakahashiBOOTINODE=		80000
10208945429SJohn BaldwinFIXITINODE=		4000
103a40915d7SYoshihiro TakahashiMFSINODE=		8000
1047920b17fSYoshihiro TakahashiSMALLBOOTLABEL=		fd1200
1057920b17fSYoshihiro TakahashiBOOTLABEL=		fd1440
106a40915d7SYoshihiro TakahashiFIXITLABEL=		fd1440
107a40915d7SYoshihiro TakahashiMFSLABEL=		minimum2
108a40915d7SYoshihiro Takahashi.else
109a5ddb8cfSJordan K. HubbardBOOTSIZE=		1440
110a5ddb8cfSJordan K. HubbardFIXITSIZE=		1440
111b98c5f70STatsumi HosokawaMFSSIZE=		4320
112b5d01310SJordan K. HubbardBIGBOOTSIZE=		2880
11383e16716SJordan K. HubbardBOOTINODE=		80000
11408945429SJohn BaldwinFIXITINODE=		4000
115a40915d7SYoshihiro TakahashiMFSINODE=		8000
116a5ddb8cfSJordan K. HubbardBOOTLABEL=		fd1440
1177385073dSJordan K. HubbardFIXITLABEL=		fd1440
118b98c5f70STatsumi HosokawaMFSLABEL=		minimum3
119a40915d7SYoshihiro TakahashiBIGBOOTLABEL=		minimum2
120a40915d7SYoshihiro Takahashi.endif
121b98c5f70STatsumi Hosokawa.elif ${MACHINE_ARCH} == "alpha"
122b98c5f70STatsumi HosokawaBOOTSIZE=		1440
1237385073dSJordan K. HubbardFIXITSIZE=		2880
124b98c5f70STatsumi HosokawaMFSSIZE=		2880
125b98c5f70STatsumi HosokawaBIGBOOTSIZE=		2880
126b98c5f70STatsumi HosokawaBOOTINODE=		80000
127b98c5f70STatsumi HosokawaFIXITINODE=		4000
128b98c5f70STatsumi HosokawaMFSINODE=		8000
129b98c5f70STatsumi HosokawaBOOTLABEL=		fd1440
130a5ddb8cfSJordan K. HubbardFIXITLABEL=		minimum2
131b98c5f70STatsumi HosokawaMFSLABEL=		minimum2
132b98c5f70STatsumi HosokawaBIGBOOTLABEL=		minimum2
1337f047619SJoerg Wunsch.endif
1340202c140SRodney W. Grimes
13530c107ccSJordan K. HubbardZIPNSPLIT=		gzip --no-name -9 -c | split -b 240640 -
13600063f88SPoul-Henning Kamp
137d5cf6f60SAndrey A. Chernov
1384f059134SJohn HayVNDEVICE?=		vn0
1394f059134SJohn Hay
1407284556fSJordan K. Hubbard# Things which may get you into trouble if you change them
14148327bc9SPoul-Henning KampMTREEFILES=		${.CURDIR}/../etc/mtree
142335d64e6SJordan K. Hubbard_R=			/R
143335d64e6SJordan K. HubbardRD=			${_R}/stage
144335d64e6SJordan K. HubbardFD=			${_R}/ftp
145335d64e6SJordan K. HubbardCD=			${_R}/cdrom
1461bac119bSJordan K. HubbardCD_DISC1=		${CD}/disc1
1471bac119bSJordan K. HubbardCD_DISC2=		${CD}/disc2
14848327bc9SPoul-Henning Kamp
1490c5b292cSJordan K. Hubbard# Where the bootstrap ports (see DOCPORTS) get installed.
1500c5b292cSJordan K. HubbardLOCALDIR=		/usr/local/bin
1510c5b292cSJordan K. Hubbard
152571240d7SJoerg Wunsch# ${BOOTSTRAPDIR} is for those utilities that refer to the hosting
1539c3b2346SDaniel O'Callaghan# environment, rather than the target environment.  This is specifically
1549c3b2346SDaniel O'Callaghan# intended for kernel-dependent utilities that are used during the build.
155571240d7SJoerg Wunsch#
156571240d7SJoerg Wunsch# ${BOOTSTRAPDIR} is actually being used by prepending it to the normal
157571240d7SJoerg Wunsch# ${PATH}.  Thus, it's also available to outside utilities like doFS.sh.
158571240d7SJoerg WunschBOOTSTRAPDIR=	/bootstrap
159571240d7SJoerg Wunsch#
160571240d7SJoerg Wunsch# The mount subsystem has been changed between 2.2 and 3.0 by the
161571240d7SJoerg Wunsch# Lite2 import.
162571240d7SJoerg WunschBOOTSTRAPUTILS=	/sbin/mount /sbin/umount
163571240d7SJoerg Wunsch#
164571240d7SJoerg Wunsch# 3.0 cpio tries to reference lchown(2) which is not available in 2.2
165571240d7SJoerg WunschBOOTSTRAPUTILS+= /usr/bin/cpio
166571240d7SJoerg Wunsch
1677284556fSJordan K. Hubbard.if !defined(CRUNCH_TARGETS)
1687284556fSJordan K. HubbardCRUNCH_TARGETS=	boot fixit
1693525074dSPoul-Henning Kamp.endif
1703525074dSPoul-Henning Kamp
171a40915d7SYoshihiro Takahashi.if ${MACHINE} == "pc98"
172a40915d7SYoshihiro TakahashiEXTRAS= ftp.1
173a5986baeSTatsumi Hosokawa.else
174d219716cSJordan K. HubbardEXTRAS= cdrom.1 ftp.1
175a5986baeSTatsumi Hosokawa.endif
176793e8c6fSJordan K. Hubbard
177793e8c6fSJordan K. Hubbard.if !defined(NODOC)
178793e8c6fSJordan K. HubbardDOCREL= doc.1
179793e8c6fSJordan K. Hubbard.endif
180793e8c6fSJordan K. Hubbard
18150ee7e6cSJordan K. Hubbard.if !defined(NOPORTREADMES)
18250ee7e6cSJordan K. HubbardMAKEREADMES=	make readmes PORTSDIR=${CHROOTDIR}/usr/ports
18350ee7e6cSJordan K. Hubbard.else
18450ee7e6cSJordan K. HubbardMAKEREADMES=	true
18550ee7e6cSJordan K. Hubbard.endif
18650ee7e6cSJordan K. Hubbard
187288fe4dbSPoul-Henning Kamprerelease release:
188574c2247SJordan K. Hubbard.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
189574c2247SJordan K. Hubbard	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
1907eb11201SPoul-Henning Kamp.endif
191d191a99cSJohn Baldwin.if defined(NOPORTS) && !defined(NODOC)
192d191a99cSJohn Baldwin	@echo "Ports are required for building the docs.  Either set NODOC or"
193d191a99cSJohn Baldwin	@echo "unset NOPORTS!"
194d191a99cSJohn Baldwin	@exit 1
195d191a99cSJohn Baldwin.endif
1966415544bSTatsumi Hosokawa	-vnconfig 2>/dev/null
197288fe4dbSPoul-Henning Kamp.if make(release)
198682078bdSRodney W. Grimes.if exists(${CHROOTDIR})
19972ac7e4dSJohn Polstra# The first command will fail on a handful of files that have their schg
20072ac7e4dSJohn Polstra# flags set.  But it greatly speeds up the next two commands.
20127b5e4fdSJordan K. Hubbard	-rm -rf ${CHROOTDIR} 2>/dev/null
202492cf9a4SJohn Polstra	-chflags -R noschg ${CHROOTDIR}/.
203b7738481SJoerg Wunsch	-rm -rf ${CHROOTDIR}
204682078bdSRodney W. Grimes.endif
205335d64e6SJordan K. Hubbard	mkdir -p ${CHROOTDIR}
2064dddeb49SJordan K. Hubbard	@echo ">>> make release started on `LC_TIME=C TZ=GMT date`"
207288fe4dbSPoul-Henning Kamp	cd ${.CURDIR}/../etc && ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
208288fe4dbSPoul-Henning Kamp	cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR}
2098e8d540fSSADA Kenji	if [ -f /etc/resolv.conf ]; then \
2108e8d540fSSADA Kenji		cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
2118e8d540fSSADA Kenji	fi
2126b94cd72SJordan K. Hubbard	cd ${.CURDIR}/.. && ${MAKE} installworld DESTDIR=${CHROOTDIR} NOMAN=1
213571240d7SJoerg Wunsch	mkdir ${CHROOTDIR}/${BOOTSTRAPDIR}
214571240d7SJoerg Wunsch	for i in ${BOOTSTRAPUTILS} ; do \
215571240d7SJoerg Wunsch		cp -p ${CHROOTDIR}$$i ${CHROOTDIR}/${BOOTSTRAPDIR} ; \
216571240d7SJoerg Wunsch	done
217bd668f6fSPoul-Henning Kamp.if !defined(RELEASETAG)
21862bb2153SPaul Traina	cd ${CHROOTDIR}/usr && rm -rf src && \
2193d9c8a5dSPoul-Henning Kamp		cvs -R -d ${CVSROOT} co -P ${RELEASESRCMODULE}
220bd668f6fSPoul-Henning Kamp.else
22162bb2153SPaul Traina	cd ${CHROOTDIR}/usr && rm -rf src && \
2223d9c8a5dSPoul-Henning Kamp		cvs -R -d ${CVSROOT} co -P -r ${RELEASETAG} ${RELEASESRCMODULE}
223288fe4dbSPoul-Henning Kamp.endif
22462bb2153SPaul Traina.if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
22575f462f4SJordan K. Hubbard	cd ${CHROOTDIR}/usr/src && patch ${PATCH_FLAGS} < ${LOCAL_PATCHES}
22662bb2153SPaul Traina.endif
22748f1b394SJordan K. Hubbard.if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
22848f1b394SJordan K. Hubbard	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
22948f1b394SJordan K. Hubbard.endif
23097febce7SJoerg Wunsch.if !defined(NOPORTS)
2315be3b5d9SJordan K. Hubbard.if defined(PORTSRELEASETAG)
2325be3b5d9SJordan K. Hubbard	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
2333f17d264SSatoshi Asami.else
23450ee7e6cSJordan K. Hubbard	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
2356e5cd2d2SJordan K. Hubbard.endif
2363f17d264SSatoshi Asami.endif
237aeb6d603SJordan K. Hubbard.if !defined(NODOC)
2385be3b5d9SJordan K. Hubbard.if defined(DOCRELEASETAG)
2395be3b5d9SJordan K. Hubbard	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P -r ${DOCRELEASETAG} ${RELEASEDOCMODULE}
2403f17d264SSatoshi Asami.else
2413d9c8a5dSPoul-Henning Kamp	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P ${RELEASEDOCMODULE}
2423f17d264SSatoshi Asami.endif
243f6ede19cSJohn Baldwin	if [ -d ${DOCDISTFILES}/ ]; then \
244f6ede19cSJohn Baldwin		cp -rp ${DOCDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
2458e8d540fSSADA Kenji	fi
246aeb6d603SJordan K. Hubbard.endif
247288fe4dbSPoul-Henning Kamp.endif
248288fe4dbSPoul-Henning Kamp.if make(rerelease)
249288fe4dbSPoul-Henning Kamp.if !defined(RELEASENOUPDATE)
250288fe4dbSPoul-Henning Kamp.if !defined(RELEASETAG)
2513d9c8a5dSPoul-Henning Kamp	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d
252288fe4dbSPoul-Henning Kamp.else
2533d9c8a5dSPoul-Henning Kamp	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d -r ${RELEASETAG}
254288fe4dbSPoul-Henning Kamp.endif
25597febce7SJoerg Wunsch.if !defined(NOPORTS)
2563d9c8a5dSPoul-Henning Kamp	cd ${CHROOTDIR}/usr/ports && cvs -R -q update -P -d
2576e5cd2d2SJordan K. Hubbard.endif
258aeb6d603SJordan K. Hubbard.if !defined(NODOC)
2593d9c8a5dSPoul-Henning Kamp	cd ${CHROOTDIR}/usr/doc && cvs -R -q update -P -d
260aeb6d603SJordan K. Hubbard.endif
261288fe4dbSPoul-Henning Kamp.endif
262bd668f6fSPoul-Henning Kamp.endif
2637284556fSJordan K. Hubbard	# Add version information to those things that need it.
264ab0e9cdcSPoul-Henning Kamp	( cd ${CHROOTDIR}/usr/src/sys/conf && \
265288fe4dbSPoul-Henning Kamp	  mv newvers.sh foo && \
266288fe4dbSPoul-Henning Kamp	  sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && rm foo )
267a4abb1d0SJordan K. Hubbard	echo OBJFORMAT=${OBJFORMAT} > ${CHROOTDIR}/etc/objformat
268d4983966SPaul Traina	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
26920e5d523SJordan K. Hubbard	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
27020e5d523SJordan K. Hubbard	echo "set -ex"				>> ${CHROOTDIR}/mk
2710276d282SJordan K. Hubbard	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${CHROOTDIR}/mk
272c4da8a34SJordan K. Hubbard	echo "export CFLAGS='-O -pipe'"	>> ${CHROOTDIR}/mk
2737284556fSJordan K. Hubbard	echo "export DISTRIBUTIONS=\"${DISTRIBUTIONS}\"" >> ${CHROOTDIR}/mk
27446e90709SJoerg Wunsch	echo "export BUILDNAME=${BUILDNAME}"	>> ${CHROOTDIR}/mk
2754f059134SJohn Hay	echo "export VNDEVICE=${VNDEVICE}"	>> ${CHROOTDIR}/mk
2760f31af31SJordan K. Hubbard	echo "export OBJFORMAT=${OBJFORMAT}"	>> ${CHROOTDIR}/mk
27746e90709SJoerg Wunsch.if defined(RELEASETAG)
27837ca025aSJoerg Wunsch	echo "export RELEASETAG=${RELEASETAG}"	>> ${CHROOTDIR}/mk
27946e90709SJoerg Wunsch.endif
28097febce7SJoerg Wunsch.if defined(NOPORTS)
28197febce7SJoerg Wunsch	echo "export NOPORTS=${NOPORTS}"	>> ${CHROOTDIR}/mk
28237ca025aSJoerg Wunsch.endif
283793e8c6fSJordan K. Hubbard.if defined(NODOC)
284793e8c6fSJordan K. Hubbard	echo "export NODOC=${NODOC}"		>> ${CHROOTDIR}/mk
285793e8c6fSJordan K. Hubbard.endif
28650ee7e6cSJordan K. Hubbard.if defined(ALLLANG) && ${ALLLANG} != "NO" && ${ALLLANG} != "no"
2878f24c563SJoseph Koshy	echo "export ALLLANG=${ALLLANG}"	>> ${CHROOTDIR}/mk
288fa937880SNik Clayton.else
2895916b53aSNik Clayton	echo "export DOC_LANG=en_US.ISO_8859-1"	>> ${CHROOTDIR}/mk
2908f24c563SJoseph Koshy.endif
2914731faa3SJordan K. Hubbard.if defined(NOSRC)
2924731faa3SJordan K. Hubbard	echo "export NOSRC=${NOSRC}"		>> ${CHROOTDIR}/mk
2934731faa3SJordan K. Hubbard.endif
29451038afbSPaul Traina.if defined(NOSHARED)
29551038afbSPaul Traina	echo "export NOSHARED=${NOSHARED}"	>> ${CHROOTDIR}/mk
29651038afbSPaul Traina.endif
297871b7d1cSJordan K. Hubbard.if defined(USA_RESIDENT)
298871b7d1cSJordan K. Hubbard	echo "export USA_RESIDENT=${USA_RESIDENT}" >> ${CHROOTDIR}/mk
299871b7d1cSJordan K. Hubbard.endif
30051038afbSPaul Traina.if defined(BOOT_CONFIG)
30151038afbSPaul Traina	echo "export BOOT_CONFIG=\"${BOOT_CONFIG}\"">> ${CHROOTDIR}/mk
30251038afbSPaul Traina.endif
303fff8eb57SJohn Baldwin.if defined(KERNEL_FLAGS)
304fff8eb57SJohn Baldwin	echo "export KERNEL_FLAGS=\"${KERNEL_FLAGS}\"" >> ${CHROOTDIR}/mk
305fff8eb57SJohn Baldwin.endif
30643276d06SJoerg Wunsch	# Don't remove this, or the build will fall over!
307335d64e6SJordan K. Hubbard	echo "export RELEASEDIR=${_R}"		>> ${CHROOTDIR}/mk
3080c5b292cSJordan K. Hubbard	echo "export PATH=${BOOTSTRAPDIR}:$${PATH}:${LOCALDIR}" >> ${CHROOTDIR}/mk
3093e5ef0fdSJordan K. Hubbard	echo "if [ ! -f /tmp/.world_done ]; then" >> ${CHROOTDIR}/mk
31020e5d523SJordan K. Hubbard	echo "	cd /usr/src"			>> ${CHROOTDIR}/mk
311288fe4dbSPoul-Henning Kamp.if make(release)
3122ec59376SJoerg Wunsch	echo "	(cd etc; make distrib-dirs distribution)" >> ${CHROOTDIR}/mk
313fff8eb57SJohn Baldwin	echo "	make ${WORLD_FLAGS} world && \\"	>> ${CHROOTDIR}/mk
3146edfc50cSJordan K. Hubbard.endif
315288fe4dbSPoul-Henning Kamp.if make(rerelease)
316fff8eb57SJohn Baldwin	echo "	make ${WORLD_FLAGS} all install && \\" >> ${CHROOTDIR}/mk
317288fe4dbSPoul-Henning Kamp.endif
3183e5ef0fdSJordan K. Hubbard	echo "	touch /tmp/.world_done"		>> ${CHROOTDIR}/mk
3193e5ef0fdSJordan K. Hubbard	echo "fi"				>> ${CHROOTDIR}/mk
320c67c1d08SJordan K. Hubbard	echo "cd /usr/src/release/sysinstall"	>> ${CHROOTDIR}/mk
321c67c1d08SJordan K. Hubbard	echo "make obj"				>> ${CHROOTDIR}/mk
322a3e12198SJordan K. Hubbard	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
3230276d282SJordan K. Hubbard	echo "make \$${_RELTARGET}"		>> ${CHROOTDIR}/mk
324c8d2a747SJordan K. Hubbard	echo "echo \">>> make ${.TARGET} finished on \`LC_TIME=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
32520e5d523SJordan K. Hubbard	chmod 755 ${CHROOTDIR}/mk
32620e5d523SJordan K. Hubbard	chroot ${CHROOTDIR} /mk
32720e5d523SJordan K. Hubbard
328bd668f6fSPoul-Henning Kampclean:
329a40915d7SYoshihiro Takahashi	rm -rf boot_crunch release.[0-9]
330bd668f6fSPoul-Henning Kamp
331335d64e6SJordan K. Hubbard# Clean out ${_R} and make the directory structure.
332bd668f6fSPoul-Henning Kamprelease.1:
333335d64e6SJordan K. Hubbard	mkdir -p ${_R}
334cd8d8dacSJordan K. Hubbard	-rm -rf ${_R}/* 2> /dev/null
335335d64e6SJordan K. Hubbard	-chflags -R noschg ${_R}/.
336335d64e6SJordan K. Hubbard	rm -rf ${_R}/*
337bd668f6fSPoul-Henning Kamp	mkdir ${RD}
338bd668f6fSPoul-Henning Kamp	mkdir ${RD}/floppies
339e12c4355SPoul-Henning Kamp	mkdir ${RD}/trees
340bd668f6fSPoul-Henning Kamp	mkdir ${RD}/dists
341bb91094aSPoul-Henning Kamp	mkdir ${RD}/kernels
3427284556fSJordan K. Hubbard	for i in ${DISTRIBUTIONS} ; do \
343288fe4dbSPoul-Henning Kamp		mkdir ${RD}/trees/$$i && \
344288fe4dbSPoul-Henning Kamp		mkdir ${RD}/dists/$$i && \
34511017a68SMarcel Moolenaar		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
346288fe4dbSPoul-Henning Kamp		    -p ${RD}/trees/$$i > /dev/null && \
34711017a68SMarcel Moolenaar		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
348288fe4dbSPoul-Henning Kamp		    -p ${RD}/trees/$$i/usr > /dev/null && \
34911017a68SMarcel Moolenaar		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
350288fe4dbSPoul-Henning Kamp		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
35111017a68SMarcel Moolenaar		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
352e12c4355SPoul-Henning Kamp		    -p ${RD}/trees/$$i/var > /dev/null ; \
35348327bc9SPoul-Henning Kamp	done
354bd668f6fSPoul-Henning Kamp	touch release.1
3557f986648SPoul-Henning Kamp
356bd668f6fSPoul-Henning Kamp# Install the system into the various distributions.
357bd668f6fSPoul-Henning Kamprelease.2:
3583c331140SJordan K. Hubbard	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin
3590a0743b5SMarcel Moolenaar	cd ${.CURDIR}/.. && make distribworld DISTDIR=${RD}/trees
360ce737050SPoul-Henning Kamp.if exists(${.CURDIR}/../kerberosIV) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
36164fd8fa8SJordan K. Hubbard	cd ${.CURDIR}/../kerberosIV && ( \
36297febce7SJoerg Wunsch		make bootstrap &&\
36397febce7SJoerg Wunsch		make obj all help-distribute DISTDIR=${RD}/trees &&\
36497febce7SJoerg Wunsch		make kprog \
36597febce7SJoerg Wunsch	)
36697febce7SJoerg Wunsch.endif
367470f825fSJordan K. Hubbard.if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
368470f825fSJordan K. Hubbard	cd ${.CURDIR}/../kerberos5 && ( \
369470f825fSJordan K. Hubbard		make bootstrap &&\
370470f825fSJordan K. Hubbard		make obj all help-distribute DISTDIR=${RD}/trees &&\
371470f825fSJordan K. Hubbard		make kprog \
372470f825fSJordan K. Hubbard	)
373470f825fSJordan K. Hubbard.endif
3745966cedcSJoerg Wunsch	-chflags -R noschg ${RD}/trees
37597febce7SJoerg Wunsch	touch release.2
37697febce7SJoerg Wunsch
37797febce7SJoerg Wunsch# Make and install the generic kernel(s).
37897febce7SJoerg Wunschrelease.3:
37916c61233SJordan K. Hubbard.for kernel in ${KERNELS}
380a8730a56SDavid E. O'Brien	-chflags -R noschg ${RD}/kernels/${kernel}
381a8730a56SDavid E. O'Brien	rm -rf ${RD}/kernels/${kernel}
38216c61233SJordan K. Hubbard	rm -rf ${.CURDIR}/../sys/compile/${kernel}
383a8730a56SDavid E. O'Brien	cd ${.CURDIR} && ${MAKE} doSTDKERNEL KERNEL=${kernel} KODIR=/${kernel}
38416c61233SJordan K. Hubbard	rm -rf ${.CURDIR}/../sys/compile/${kernel}
385a8730a56SDavid E. O'Brien	-mkdir ${RD}/trees/bin/boot/${kernel}
386a8730a56SDavid E. O'Brien	cp -p ${RD}/kernels/${kernel}/kernel ${RD}/trees/bin/boot/${kernel}
38716c61233SJordan K. Hubbard.endfor
388a8730a56SDavid E. O'Brien	# Install a standard boot kernel+modules
389a00533ecSDavid E. O'Brien	mkdir -p ${RD}/trees/bin/boot/kernel
390a00533ecSDavid E. O'Brien	cp -Rp ${RD}/kernels/GENERIC/* ${RD}/trees/bin/boot/kernel
391bd668f6fSPoul-Henning Kamp	touch release.3
392bd668f6fSPoul-Henning Kamp
39301feef2cSPoul-Henning Kamp# Make and install the three crunched binaries which live on the floppies.
394bd668f6fSPoul-Henning Kamp# You are not supposed to like this :-)
395cd6f5820SJoerg Wunsch#
396cd6f5820SJoerg Wunsch# NB: the "RELEASE_BUILD_FIXIT" magic prevents vi from including the
397cd6f5820SJoerg Wunsch# Tcl and Perl APIs.  See also /usr/src/usr.bin/vi/Makefile.
3983ad254b3SJosef Karthauser# It also prevents ls linking against termcap by disabling color support.
3993ad254b3SJosef Karthauser# See /usr/src/bin/ls/Makefile.
400bd668f6fSPoul-Henning Kamprelease.4:
40165d6daa0SJordan K. Hubbard	@mkdir -p /stand
4020f37309eSTatsumi Hosokawa	cd ${.CURDIR}/sysinstall && make obj depend all install
403518a1d34SPoul-Henning Kamp	rm -rf ${RD}/crunch
404518a1d34SPoul-Henning Kamp	mkdir -p ${RD}/crunch
405cd6f5820SJoerg Wunsch	export RELEASE_BUILD_FIXIT=noway ; \
4067284556fSJordan K. Hubbard	for j in ${CRUNCH_TARGETS} ; do \
407518a1d34SPoul-Henning Kamp		rm -rf $${j}_crunch && \
408518a1d34SPoul-Henning Kamp		mkdir $${j}_crunch && \
409518a1d34SPoul-Henning Kamp		( cd $${j}_crunch && \
4107ec62217SYoshihiro Takahashi		  ( ( [ -f ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ] && \
4117ec62217SYoshihiro Takahashi		    crunchgen ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ) || \
4127ec62217SYoshihiro Takahashi		    ( crunchgen ${.CURDIR}/$${j}_crunch.conf ) ) && \
4137a0b248eSJordan K. Hubbard		  ${MAKE} -DRELEASE_CRUNCH -f $${j}_crunch.mk subclean all \
414ced716c3SBrian Somers		    NOCRYPT=yes "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY") && \
415518a1d34SPoul-Henning Kamp		mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
4165bb88366SJoerg Wunsch		true || { rm -rf $${j}_crunch ; false ; } ; \
417bd668f6fSPoul-Henning Kamp	done
418bd668f6fSPoul-Henning Kamp	touch release.4
419bd668f6fSPoul-Henning Kamp
42030e8b491SPoul-Henning Kamp#
42130e8b491SPoul-Henning Kamp# --==## Fix up the distributions. ##==--
42230e8b491SPoul-Henning Kamp#
423bd668f6fSPoul-Henning Kamprelease.5:
42404f11c61SJordan K. Hubbard	# Handle some grief caused by the munition braindeadness.
42585e427ccSGregory Neil Shapiro	for i in sbin/init bin/ed usr.sbin/ppp usr.sbin/pppd usr.sbin/sendmail usr.sbin/tcpdump/tcpdump ; do \
4264f9a3d48SJoerg Wunsch		( cd ${.CURDIR}/../$$i; \
4274f9a3d48SJoerg Wunsch		  make -DNOCRYPT clean all distribute DISTDIR=${RD}/trees ) ; \
4284f9a3d48SJoerg Wunsch	done
4294f9a3d48SJoerg Wunsch
4307284556fSJordan K. Hubbard	# Create any "synthetic dists" now.
4317284556fSJordan K. Hubbard	@for i in ${DISTRIBUTIONS}; do \
4327284556fSJordan K. Hubbard		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
4337284556fSJordan K. Hubbard			echo -n "Running $$i dist creation script... "; \
434839de40eSJohn Birrell			env OBJFORMAT=${OBJFORMAT} RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
43558183fc7SJordan K. Hubbard			echo "Done."; \
4367284556fSJordan K. Hubbard		fi \
4377284556fSJordan K. Hubbard	done \
4387284556fSJordan K. Hubbard
4392fb96ab9SJoerg Wunsch	# Create symlinks for the MD5-based crypt lib, too.  The
4402fb96ab9SJoerg Wunsch	# automatically created links still point to the DES stuff,
4412fb96ab9SJoerg Wunsch	# which went into its own distribution.
44280e2640fSJordan K. Hubbard	for i in ${RD}/trees/bin/usr/lib/libscrypt* ; do \
4432fb96ab9SJoerg Wunsch		c=`echo $$i | sed -e 's/libscrypt/libcrypt/'` ; \
4442fb96ab9SJoerg Wunsch		rm -f $$c ; \
4452fb96ab9SJoerg Wunsch		ln -s `basename $$i` $$c ; \
4462fb96ab9SJoerg Wunsch	done
44734fca5ddSJoerg Wunsch
44830e8b491SPoul-Henning Kamp	# Remove all the directories we don't need.
44927d44115SPoul-Henning Kamp	-cd ${RD}/trees && \
4500a9e93bfSJordan K. Hubbard		find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
451bd668f6fSPoul-Henning Kamp	touch release.5
452f14786ddSJordan K. Hubbard
45330e8b491SPoul-Henning Kamp#
4547284556fSJordan K. Hubbard# --==## Package up the tarballs from assembled trees ##==--
45530e8b491SPoul-Henning Kamp#
456bd668f6fSPoul-Henning Kamprelease.6:
45795e34bfcSJordan K. Hubbard	rm -rf ${RD}/dists
45895e34bfcSJordan K. Hubbard	mkdir -p ${RD}/dists
45995e34bfcSJordan K. Hubbard	@for i in ${DISTRIBUTIONS} ; \
46095e34bfcSJordan K. Hubbard	do \
46195e34bfcSJordan K. Hubbard		if [ -d ${RD}/trees/$${i} ] ; then \
46230e8b491SPoul-Henning Kamp			cd ${.CURDIR} && $(MAKE) doTARBALL \
46330e8b491SPoul-Henning Kamp				SD=${RD}/trees/$${i} \
464288fe4dbSPoul-Henning Kamp				TN=$$i TD=$$i ARG="." && \
46595e34bfcSJordan K. Hubbard			echo "$${i} distribution is finished."; \
46695e34bfcSJordan K. Hubbard		fi ; \
46795e34bfcSJordan K. Hubbard	done
4687284556fSJordan K. Hubbard	# More munition braindeadness.
46930e8b491SPoul-Henning Kamp	( cd ${RD}/dists && \
470470f825fSJordan K. Hubbard		if [ -f krb4/krb4.aa ] ; then mv krb4/* crypto && rmdir krb4 ; fi )
471470f825fSJordan K. Hubbard	( cd ${RD}/dists && \
472470f825fSJordan K. Hubbard		if [ -f krb5/krb5.aa ] ; then mv krb5/* crypto && rmdir krb5 ; fi )
4730412e9f7SJordan K. Hubbard	touch release.6
47495e34bfcSJordan K. Hubbard
47595e34bfcSJordan K. Hubbard
47630e8b491SPoul-Henning Kamp#
47730e8b491SPoul-Henning Kamp# --==## Make source dists ##==--
47830e8b491SPoul-Henning Kamp#
47995e34bfcSJordan K. Hubbardrelease.7:
4804731faa3SJordan K. Hubbard.if !defined(NOSRC)
481288fe4dbSPoul-Henning Kamp	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
48295e34bfcSJordan K. Hubbard		TD=src TN=sbase ARG="[A-Z]*"
483fb29e2cfSJordan K. Hubbard	@for i in `cd /usr/src && echo [a-z]*` ; do \
48430e8b491SPoul-Henning Kamp		if [ -d /usr/src/$$i ] ; then \
48530e8b491SPoul-Henning Kamp			cd ${.CURDIR} && $(MAKE) doTARBALL \
486470f825fSJordan K. Hubbard				TN=`echo s$$i | tr -d '.' | \
487470f825fSJordan K. Hubbard				    sed -e 's/usr/u/' \
488470f825fSJordan K. Hubbard					-e 's/kerberosIV/krb4/' \
489470f825fSJordan K. Hubbard					-e 's/kerberos5/krb5/'` \
49030e8b491SPoul-Henning Kamp				SD=/usr/src TD=src ARG="$$i" ; \
49195e34bfcSJordan K. Hubbard		fi ; \
49295e34bfcSJordan K. Hubbard	done
49340b0c0d9SPeter Wemm.if defined(EXTRA_SRC)
494288fe4dbSPoul-Henning Kamp	@set ${EXTRA_SRC} && \
49540b0c0d9SPeter Wemm	while [ $$# -ge 2 ] ; do \
49630e8b491SPoul-Henning Kamp		if [ -d /usr/src/$$1 ] ; then \
49730e8b491SPoul-Henning Kamp			cd ${.CURDIR} && $(MAKE) doTARBALL \
49830e8b491SPoul-Henning Kamp				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
49930e8b491SPoul-Henning Kamp		fi && shift && shift ; \
50040b0c0d9SPeter Wemm	done
50140b0c0d9SPeter Wemm.endif
502470f825fSJordan K. Hubbard	if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
503470f825fSJordan K. Hubbard		if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
504470f825fSJordan K. Hubbard		if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
5050de00367SJohn Hay		if [ -f skrb4.aa ] ; then mv skrb4.* ../crypto ; fi && \
506470f825fSJordan K. Hubbard		if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; ) ; fi
50795e34bfcSJordan K. Hubbard	@echo "src distribution is finished."
5084731faa3SJordan K. Hubbard.endif
5090412e9f7SJordan K. Hubbard	touch release.7
51095e34bfcSJordan K. Hubbard
51195e34bfcSJordan K. Hubbard# Complete the bootfd
512409f9329SJordan K. Hubbard#
513409f9329SJordan K. Hubbard# Now, just to get this picture down once and for all:
514409f9329SJordan K. Hubbard#
515409f9329SJordan K. Hubbard# +------------------------------------------------------------------------+
516409f9329SJordan K. Hubbard# |boot.flp                                                                |
517409f9329SJordan K. Hubbard# +-----+-----+------------------------------------------------------------+
518409f9329SJordan K. Hubbard# |boot1|boot2|floppy filesystem "bootfd"                                  |
519409f9329SJordan K. Hubbard# +-----+-----+-+--------------------------------------------------------+-+
520409f9329SJordan K. Hubbard#               |kernel                                                  |
521409f9329SJordan K. Hubbard#               +------------+-----------------------------------------+-+
522409f9329SJordan K. Hubbard#                            |mfs filesystem "mfsfd"                   |
523409f9329SJordan K. Hubbard#                            +-----------------------------------------+
524409f9329SJordan K. Hubbard#
525409f9329SJordan K. Hubbard
52623aac4b3SJordan K. Hubbardrelease.8: write_mfs_in_kernel
527409f9329SJordan K. Hubbard	rm -rf ${RD}/mfsfd
528409f9329SJordan K. Hubbard	mkdir ${RD}/mfsfd
529409f9329SJordan K. Hubbard	cd ${RD}/mfsfd && \
53015558ea0SMitsuru IWASAKI		mkdir -p etc/defaults dev mnt stand/help
5313df0e2afSPoul-Henning Kamp	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
532a91fd119SPoul-Henning Kamp		DIR=${RD}/mfsfd/stand ZIP=false
5333df0e2afSPoul-Henning Kamp	( cd ${RD}/trees/bin/dev && \
5342931df8aSHajimu UMEMOTO		ls console tty bpf0 ttyv0 ttyv1 ttyv2 ttyv3 null zero card0 card1 card2 card3 usb usb0 uhid0 ums0 ulpt0 ugen0 kbd0 kmem mem | \
535409f9329SJordan K. Hubbard	cpio -dump ${RD}/mfsfd/dev )
5365bf8036aSJordan K. Hubbard	( cd ${RD}/mfsfd/dev && rm -f *[swo]d*[bdefgh] )
537dc2475c5SJohn Baldwin	( cd ${RD}/mfsfd && \
538dc2475c5SJohn Baldwin	  for dir in bin sbin ; do \
539dc2475c5SJohn Baldwin		ln -sf /stand $$dir; \
540dc2475c5SJohn Baldwin	  done )
541dc2475c5SJohn Baldwin	cp /sbin/dhclient-script ${RD}/mfsfd/stand
542e8bbfc06SMitsuru IWASAKI	cp ${.CURDIR}/../etc/defaults/pccard.conf ${RD}/mfsfd/etc/defaults/pccard.conf
543fead5c44SJohn Baldwin	cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
5443df0e2afSPoul-Henning Kamp	cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
545d3628763SRodney W. Grimes	echo "nameserver      42/tcp name"	> ${RD}/mfsfd/stand/etc/services
546d3628763SRodney W. Grimes	echo "ftp             21/tcp"		>> ${RD}/mfsfd/stand/etc/services
547d3628763SRodney W. Grimes	echo "domain          53/tcp          nameserver" >> ${RD}/mfsfd/stand/etc/services
548d3628763SRodney W. Grimes	echo "domain          53/udp          nameserver" >> ${RD}/mfsfd/stand/etc/services
549e7fc885eSJordan K. Hubbard	echo "cmd             514/tcp    shell" >> ${RD}/mfsfd/stand/etc/services
5507953e823SJordan K. Hubbard	gzip -9c ${.CURDIR}/../COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz
5517114cf8cSJordan K. Hubbard	@for i in README.TXT RELNOTES.TXT INSTALL.TXT UPGRADE.TXT HARDWARE.TXT; do \
5527114cf8cSJordan K. Hubbard	  if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \
5537114cf8cSJordan K. Hubbard	     gzip -9c ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} > ${RD}/mfsfd/stand/help/$${i}.gz; \
5547114cf8cSJordan K. Hubbard	  else \
5557114cf8cSJordan K. Hubbard	     gzip -9c ${.CURDIR}/texts/$${i} > ${RD}/mfsfd/stand/help/$${i}.gz; \
5567114cf8cSJordan K. Hubbard	  fi; \
5577114cf8cSJordan K. Hubbard	done
558605ec649SJordan K. Hubbard	-test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
55971696ba3SJordan K. Hubbard	@mkdir -p ${RD}/mfsfd/boot
56071696ba3SJordan K. Hubbard	@cp /boot/boot* ${RD}/mfsfd/boot
561fcc943bcSJordan K. Hubbard	@cp /boot/loader.help ${RD}/mfsfd/boot
562b98c5f70STatsumi Hosokawa	@cd ${.CURDIR} && ${MAKE} createBOOTMFS
563b98c5f70STatsumi Hosokawa.if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
564b98c5f70STatsumi Hosokawa	@cd ${.CURDIR} && ${MAKE} doMODULES KERNEL=BOOTMFS KERNEL_KO=BOOTMFS KODIR=""
565b98c5f70STatsumi Hosokawa.endif
5666545b6a5SJordan K. Hubbard	@echo "Making the regular boot floppy."
56792e86f99SJordan K. Hubbard	@tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \
56892e86f99SJordan K. Hubbard		tar xf - -C ${RD}/mfsfd/stand
5696545b6a5SJordan K. Hubbard	@echo "Compressing doc files..."
570891258b7SJordan K. Hubbard	@gzip -9 ${RD}/mfsfd/stand/help/*.hlp
571b98c5f70STatsumi Hosokawa.if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
572b98c5f70STatsumi Hosokawa	@mkdir -p ${RD}/mfsfd/stand/modules
573b98c5f70STatsumi Hosokawa	@perl ${.CURDIR}/scripts/driver-copy2.pl \
574b98c5f70STatsumi Hosokawa		${.CURDIR}/${MACHINE_ARCH}/drivers.conf \
575b98c5f70STatsumi Hosokawa		${RD}/kernels ${RD}/mfsfd/stand/modules
576b98c5f70STatsumi Hosokawa.endif
57750895b89SJordan K. Hubbard	sh -e ${.CURDIR}/scripts/doFS.sh -s mfsroot ${RD} ${MNT} \
57850895b89SJordan K. Hubbard		${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
5797953e823SJordan K. Hubbard	@gzip -9vc mfsroot > mfsroot.gz
5807920b17fSYoshihiro Takahashi.if ${MACHINE} == "pc98"
581b0976c14SYoshihiro Takahashi	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
582b0976c14SYoshihiro Takahashi		${RD} ${MNT} ${SMALLBOOTSIZE} mfsroot.gz \
583b0976c14SYoshihiro Takahashi		${BOOTINODE} ${SMALLBOOTLABEL}
5847920b17fSYoshihiro Takahashi	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern-small FDSIZE=SMALL
585643f7da0SJordan K. Hubbard	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
5867920b17fSYoshihiro Takahashi.else
587b0976c14SYoshihiro Takahashi	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
588b0976c14SYoshihiro Takahashi		${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL}
5897920b17fSYoshihiro Takahashi	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
5907920b17fSYoshihiro Takahashi	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot FDSIZE=BIG
591a40915d7SYoshihiro Takahashi.endif
59292e86f99SJordan K. Hubbard	@rm mfsroot mfsroot.gz mfsroot.size
593f21b983cSJordan K. Hubbard	@echo "Regular and MFS boot floppies made."
5940412e9f7SJordan K. Hubbard	touch release.8
595bd668f6fSPoul-Henning Kamp
59630e8b491SPoul-Henning Kamp#
59730e8b491SPoul-Henning Kamp# --==## Create a fixit floppy ##==--
59830e8b491SPoul-Henning Kamp#
599b53e8a34SJordan K. Hubbardrelease.9:
60092e86f99SJordan K. Hubbard	@echo "Making fixit floppy."
60192e86f99SJordan K. Hubbard	@rm -rf ${RD}/fixitfd
60292e86f99SJordan K. Hubbard	@mkdir ${RD}/fixitfd
60392e86f99SJordan K. Hubbard	@cd ${RD}/fixitfd && \
604fbc6f9e0SJoerg Wunsch		mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
605d26a815bSJordan K. Hubbard		usr/share/misc
6063df0e2afSPoul-Henning Kamp	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
607518c7f2aSJoerg Wunsch		DIR=${RD}/fixitfd/stand ZIP=false
60892e86f99SJordan K. Hubbard	@( cd ${RD}/fixitfd/dev && \
609d7775439SDon Lewis		cp ${RD}/trees/bin/dev/MAKEDEV MAKEDEV && \
610a18763d0SJoerg Wunsch		chmod 755 MAKEDEV && \
6117f047619SJoerg Wunsch		sh MAKEDEV fixit )
61292e86f99SJordan K. Hubbard	@cp ${RD}/trees/bin/etc/spwd.db ${RD}/trees/bin/etc/group \
613518c7f2aSJoerg Wunsch		${RD}/trees/bin/etc/protocols ${RD}/fixitfd/etc
61492e86f99SJordan K. Hubbard	@cp ${RD}/trees/bin/usr/share/misc/scsi_modes \
615fbc6f9e0SJoerg Wunsch		${RD}/fixitfd/usr/share/misc
61692e86f99SJordan K. Hubbard	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
61792e86f99SJordan K. Hubbard	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
61892e86f99SJordan K. Hubbard	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
61992e86f99SJordan K. Hubbard	@chmod 555 ${RD}/fixitfd/stand/tar
62092e86f99SJordan K. Hubbard	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/fixit.flp ${RD} \
62192e86f99SJordan K. Hubbard		${MNT} ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL}
6226e5cd2d2SJordan K. Hubbard# Do our last minute floppies directory setup in a convenient place.
62392e86f99SJordan K. Hubbard	@cp ${.CURDIR}/texts/FLOPPIES.TXT ${RD}/floppies/README.TXT
6244b861c74STatsumi Hosokawa	@(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
625b53e8a34SJordan K. Hubbard	touch release.9
6263bc93c76SPoul-Henning Kamp
62730e8b491SPoul-Henning Kamp#
62830e8b491SPoul-Henning Kamp# --==## Setup a suitable ftp-area ##==--
62930e8b491SPoul-Henning Kamp#
630e12c4355SPoul-Henning Kampftp.1:
63192e86f99SJordan K. Hubbard	@echo "Setting up FTP distribution area"
63292e86f99SJordan K. Hubbard	@mkdir -p ${FD}
633518aacadSPoul-Henning Kamp	-@ln -s . ${FD}/${BUILDNAME}
63492e86f99SJordan K. Hubbard	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
63592e86f99SJordan K. Hubbard	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
63696fa8770SJordan K. Hubbard	@for i in ${DIST_DOCS}; do \
63710c6fb3dSWilko Bulte	  if [ -f ${.CURDIR}/texts/$${i} ]; then \
63896fa8770SJordan K. Hubbard	     cp ${.CURDIR}/texts/$${i} ${FD}; \
63910c6fb3dSWilko Bulte	  fi; \
6408e0f26e8SWilko Bulte	  if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \
6418e0f26e8SWilko Bulte	     echo "=== Platform specifics for ${MACHINE_ARCH}" >> ${FD}/$${i}; \
6428e0f26e8SWilko Bulte	     cat ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} >> ${FD}/$${i}; \
64396fa8770SJordan K. Hubbard	  fi; \
64496fa8770SJordan K. Hubbard	done
64592e86f99SJordan K. Hubbard	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
6460206d3bdSJordan K. Hubbard.if !defined(NOPORTS)
64714870ecfSJordan K. Hubbard	@tar --exclude CVS -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
6480206d3bdSJordan K. Hubbard.endif
6499999fb15SJohn Baldwin	touch ftp.1
6503bc93c76SPoul-Henning Kamp
65130e8b491SPoul-Henning Kamp#
65230e8b491SPoul-Henning Kamp# --==## Setup a suitable cdrom-area ##==--
65330e8b491SPoul-Henning Kamp#
654c5b0a909SPoul-Henning Kampcdrom.1:
65592e86f99SJordan K. Hubbard	@echo "Setting up CDROM distribution area"
65692e86f99SJordan K. Hubbard	@mkdir -p ${CD_DISC1} ${CD_DISC2}
65792e86f99SJordan K. Hubbard	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
65892e86f99SJordan K. Hubbard	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
659431463e0SJordan K. Hubbard	@ln -f ${RD}/kernels/MFSKERNEL.boot ${CD_DISC1}/kernel
66092e86f99SJordan K. Hubbard	@for i in ${DISTRIBUTIONS} ; \
661c5b0a909SPoul-Henning Kamp	do \
662c5b0a909SPoul-Henning Kamp		if [ -d ${RD}/trees/$${i} ] ; then \
663ad5ebf3fSDag-Erling Smørgrav			chflags -R noschg ${RD}/trees/$${i} || true ; \
66401feef2cSPoul-Henning Kamp			( cd ${RD}/trees/$${i} && \
6651bac119bSJordan K. Hubbard			find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
666c5b0a909SPoul-Henning Kamp		fi \
667c5b0a909SPoul-Henning Kamp	done
66892e86f99SJordan K. Hubbard	@rm -f ${CD_DISC2}/.profile
66992e86f99SJordan K. Hubbard	@cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
67092e86f99SJordan K. Hubbard	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
67192e86f99SJordan K. Hubbard	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
67296fa8770SJordan K. Hubbard	@for i in ${DIST_DOCS}; do \
673f4da27bfSWilko Bulte	  if [ -f ${.CURDIR}/texts/$${i} ]; then \
67496fa8770SJordan K. Hubbard	     cp ${.CURDIR}/texts/$${i} ${CD_DISC1}; \
67510c6fb3dSWilko Bulte	  fi; \
6768e0f26e8SWilko Bulte	  if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \
6777b5036ebSDavid E. O'Brien	     echo "=== Platform specifics for ${MACHINE_ARCH}" >> ${CD_DISC1}/$${i}; \
6788e0f26e8SWilko Bulte	     cat ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} >> ${CD_DISC1}/$${i}; \
67996fa8770SJordan K. Hubbard	  fi; \
68096fa8770SJordan K. Hubbard        done
6812a76df63SDavid E. O'Brien.if ${MACHINE_ARCH} == "alpha"
6822a76df63SDavid E. O'Brien	@echo "Setting up Alpha CD disc1 for booting"
6832a76df63SDavid E. O'Brien	@cp -Rp ${RD}/image.boot/boot ${CD_DISC1}
6842a0bb855SDavid E. O'Brien	@ln -f ${CD_DISC2}/boot/cdboot ${CD_DISC1}/boot
6852a0bb855SDavid E. O'Brien	@ln -f ${CD_DISC1}/boot/loader.rc ${CD_DISC2}/boot
6862a0bb855SDavid E. O'Brien	@ln -f ${CD_DISC1}/kernel ${CD_DISC2}/kernel
6872a76df63SDavid E. O'Brien.endif
68897febce7SJoerg Wunsch.if !defined(NOPORTS)
68992e86f99SJordan K. Hubbard	@-rm -rf /usr/ports/distfiles/*
69092e86f99SJordan K. Hubbard	@mkdir -p ${CD_DISC1}/ports && \
69114870ecfSJordan K. Hubbard	  tar --exclude CVS -czf ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
692a43aa360SJordan K. Hubbard	  cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \
693a43aa360SJordan K. Hubbard	  && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
694d219716cSJordan K. Hubbard.endif
6959999fb15SJohn Baldwin	touch cdrom.1
696c5b0a909SPoul-Henning Kamp
697793e8c6fSJordan K. Hubbarddoc.1:
69892e86f99SJordan K. Hubbard	@echo "Making docs..."
69992e86f99SJordan K. Hubbard	@for i in ${DOCPORTS}; do \
70070af253aSJordan K. Hubbard	  cd /usr/ports/$$i && make all install clean JADETEX=no FORCE_PKG_REGISTER=yes; \
701b59d8897SJordan K. Hubbard	done
7025916b53aSNik Clayton	@cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/bin/usr/share/doc
703a5ddb8cfSJordan K. Hubbard	touch doc.1
704793e8c6fSJordan K. Hubbard
7057eb11201SPoul-Henning Kamp# Various "subroutine" and other supporting targets.
7067eb11201SPoul-Henning Kamp
707470f825fSJordan K. Hubbard# RD=
708470f825fSJordan K. Hubbard# SD=
709470f825fSJordan K. Hubbard# TD=
710470f825fSJordan K. Hubbard# ARG=
711bd668f6fSPoul-Henning KampdoTARBALL:
712bd668f6fSPoul-Henning Kamp.if !defined(SD)
713288fe4dbSPoul-Henning Kamp	@echo "SD undefined in doTARBALL" && exit 1
714bd668f6fSPoul-Henning Kamp.endif
715bd668f6fSPoul-Henning Kamp.if !defined(TD)
716288fe4dbSPoul-Henning Kamp	@echo "TB undefined in doTARBALL" && exit 1
717bd668f6fSPoul-Henning Kamp.endif
718bd668f6fSPoul-Henning Kamp.if !defined(ARG)
719288fe4dbSPoul-Henning Kamp	@echo "ARG undefined in doTARBALL" && exit 1
720bd668f6fSPoul-Henning Kamp.endif
72192e86f99SJordan K. Hubbard	@rm -rf ${RD}/dists/${TD}/${TN}*
72292e86f99SJordan K. Hubbard	@mkdir -p ${RD}/dists/${TD}
72392e86f99SJordan K. Hubbard	@( cd ${SD} && \
724d2b98961SPoul-Henning Kamp		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
725d2b98961SPoul-Henning Kamp		echo rolling ${TD}/$$tn tarball &&\
7260ef3fb22SJoerg Wunsch		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
72795e34bfcSJordan K. Hubbard		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
72820ff6b88SJordan K. Hubbard		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \
729ac0a5268SJordan K. Hubbard		   ${RD}/dists/${TD}/$$tn.inf && \
7301e104a1eSJordan K. Hubbard		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
7311e104a1eSJordan K. Hubbard		  cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
7321e104a1eSJordan K. Hubbard		fi && \
73316c61233SJordan K. Hubbard		if [ "${SD}" != "/usr/src" ]; then \
73411017a68SMarcel Moolenaar			mtree -c -i -p ${SD}/${ARG} \
73516c61233SJordan K. Hubbard			  -k gname,md5digest,mode,nlink,uname,size,link,type \
73691f2535eSJordan K. Hubbard			  > ${RD}/dists/${TD}/$$tn.mtree ; \
73791f2535eSJordan K. Hubbard		else \
73891f2535eSJordan K. Hubbard			true; \
73991f2535eSJordan K. Hubbard		fi; \
74091f2535eSJordan K. Hubbard		(cd ${RD}/dists/${TD}; \
74191f2535eSJordan K. Hubbard		   rm -f CHECKSUM.MD5; \
74291f2535eSJordan K. Hubbard		   md5 * > CHECKSUM.MD5) \
74391f2535eSJordan K. Hubbard	)
7447eb11201SPoul-Henning Kamp
7453fe1f923SJordan K. HubbarddoRELEASE:  release.1 release.2 ${DOCREL} release.3 release.4 release.5 \
746793e8c6fSJordan K. Hubbard		release.6 release.7 release.8 release.9
74792e86f99SJordan K. Hubbard	@cd ${.CURDIR} && ${MAKE} ${EXTRAS}
7487eb11201SPoul-Henning Kamp	@echo "Release done"
7497eb11201SPoul-Henning Kamp
7500ead1f1dSJordan K. Hubbardfloppies:
75192e86f99SJordan K. Hubbard	@cd ${.CURDIR} && ${MAKE} boot.flp
75292e86f99SJordan K. Hubbard	@cd ${.CURDIR} && ${MAKE} fixit.flp
75392e86f99SJordan K. Hubbard	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
7540ead1f1dSJordan K. Hubbard
7553525074dSPoul-Henning Kampboot.flp:
75692e86f99SJordan K. Hubbard	@rm -f release.4 release.8
75792e86f99SJordan K. Hubbard	@cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot
7583525074dSPoul-Henning Kamp
759e841846bSPoul-Henning Kampfixit.flp:
76092e86f99SJordan K. Hubbard	@rm -f release.4 release.9
76192e86f99SJordan K. Hubbard	@cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit
762e841846bSPoul-Henning Kamp
763409f9329SJordan K. Hubbardwrite_mfs_in_kernel:	${.CURDIR}/write_mfs_in_kernel.c
764409f9329SJordan K. Hubbard	${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c
765409f9329SJordan K. Hubbard
766518a1d34SPoul-Henning KampinstallCRUNCH:
767518a1d34SPoul-Henning Kamp.if !defined(CRUNCH)
768288fe4dbSPoul-Henning Kamp	@echo "CRUNCH undefined in installCRUNCH" && exit 1
769518a1d34SPoul-Henning Kamp.endif
770518a1d34SPoul-Henning Kamp.if !defined(DIR)
771288fe4dbSPoul-Henning Kamp	@echo "DIR undefined in installCRUNCH" && exit 1
772518a1d34SPoul-Henning Kamp.endif
773518a1d34SPoul-Henning Kamp.if !defined(ZIP)
774288fe4dbSPoul-Henning Kamp	@echo "ZIP undefined in installCRUNCH" && exit 1
775518a1d34SPoul-Henning Kamp.endif
77692e86f99SJordan K. Hubbard	@if ${ZIP} ; then \
777518a1d34SPoul-Henning Kamp		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
778518a1d34SPoul-Henning Kamp	else \
779518a1d34SPoul-Henning Kamp		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
780518a1d34SPoul-Henning Kamp	fi
78192e86f99SJordan K. Hubbard	@chmod 555 ${DIR}/${CRUNCH}_crunch
7827ec62217SYoshihiro Takahashi	@if [ -f ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf ] ; then \
7837ec62217SYoshihiro Takahashi		for i in `crunchgen -l ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf` ; do \
784518a1d34SPoul-Henning Kamp			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
7857ec62217SYoshihiro Takahashi		done \
7867ec62217SYoshihiro Takahashi	else \
7877ec62217SYoshihiro Takahashi		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
7887ec62217SYoshihiro Takahashi			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
7897ec62217SYoshihiro Takahashi		done \
7907ec62217SYoshihiro Takahashi	fi
791288fe4dbSPoul-Henning Kamp
792288fe4dbSPoul-Henning Kamp#
793b98c5f70STatsumi Hosokawa# --==## BOOTMFS config file ##==--
794b98c5f70STatsumi Hosokawa#
795b98c5f70STatsumi Hosokawa
796b98c5f70STatsumi HosokawacreateBOOTMFS:
797b98c5f70STatsumi Hosokawa	@cd ${.CURDIR}/../sys/${MACHINE}/conf && \
798b98c5f70STatsumi Hosokawa	  sh ${.CURDIR}/scripts/dokern.sh ${FDSIZE} < ${KERNCONF} > BOOTMFS && \
799b98c5f70STatsumi Hosokawa	  [ -r ${KERNCONF}.hints ] && cp ${KERNCONF}.hints BOOTMFS.hints
800b98c5f70STatsumi Hosokawa.if ${MACHINE_ARCH} == "i386"
801b98c5f70STatsumi Hosokawa	@echo "options  INTRO_USERCONFIG" >> \
802b98c5f70STatsumi Hosokawa	  ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
803b98c5f70STatsumi Hosokawa.endif
804b98c5f70STatsumi Hosokawa.if defined(FDSIZE) && ${FDSIZE} == "BIG"
805b98c5f70STatsumi Hosokawa	@echo "options MD_ROOT_SIZE=`cat mfsroot.size`" >> \
806b98c5f70STatsumi Hosokawa	  ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
807b98c5f70STatsumi Hosokawa.endif
808b98c5f70STatsumi Hosokawa.if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
809b98c5f70STatsumi Hosokawa	@perl ${.CURDIR}/scripts/driver-remove.pl \
810b98c5f70STatsumi Hosokawa		${.CURDIR}/${MACHINE_ARCH}/drivers.conf \
811b98c5f70STatsumi Hosokawa		${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
812b98c5f70STatsumi Hosokawa.endif
813b98c5f70STatsumi Hosokawa
814b98c5f70STatsumi Hosokawa#
815288fe4dbSPoul-Henning Kamp# --==## Compile a kernel by name ${KERNEL} ##==--
816288fe4dbSPoul-Henning Kamp#
817288fe4dbSPoul-Henning Kamp# We don't erase the sys/compile/${KERNEL} directory, since somebody
818288fe4dbSPoul-Henning Kamp# may want to reuse it (release.8 presently)
819288fe4dbSPoul-Henning Kamp#
820288fe4dbSPoul-Henning KampdoKERNEL:
82192e86f99SJordan K. Hubbard	@rm -f ${RD}/kernels/${KERNEL}
822a40915d7SYoshihiro Takahashi	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
82392e86f99SJordan K. Hubbard	@cd ${.CURDIR}/../sys/compile/${KERNEL} && \
824c27edf93SJohn Baldwin			make kernel-depend && \
825281ec158SJohn Baldwin			make ${KERNEL_FLAGS} ${KERNEL_KO} && \
826281ec158SJohn Baldwin			make kernel-reinstall DESTDIR=${RD}/kernels && \
827fff8eb57SJohn Baldwin			[ -r ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ] && \
828fff8eb57SJohn Baldwin			cp ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ${RD}/kernels
829288fe4dbSPoul-Henning Kamp
830b98c5f70STatsumi HosokawadoMODULES:
831b98c5f70STatsumi Hosokawa	@rm -f ${RD}/kernels/*.ko
832b98c5f70STatsumi Hosokawa	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
833b98c5f70STatsumi Hosokawa	@cd ${.CURDIR}/../sys/compile/${KERNEL} && \
834b98c5f70STatsumi Hosokawa			make kernel-depend && \
835b98c5f70STatsumi Hosokawa			make ${KERNEL_FLAGS} modules && \
836b98c5f70STatsumi Hosokawa			make modules-reinstall DESTDIR=${RD}/kernels && \
837b98c5f70STatsumi Hosokawa
838a8730a56SDavid E. O'BriendoSTDKERNEL:
839a8730a56SDavid E. O'Brien	@rm -f ${RD}/kernels/${KERNEL}
840a8730a56SDavid E. O'Brien	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
841a8730a56SDavid E. O'Brien	@cd ${.CURDIR}/../sys/compile/${KERNEL} && \
842a8730a56SDavid E. O'Brien			make depend && \
843a8730a56SDavid E. O'Brien			make ${KERNEL_FLAGS} KERNEL=${kernel} && \
844a8730a56SDavid E. O'Brien			make KERNEL=${kernel} DESTDIR=${RD}/kernels install && \
845a8730a56SDavid E. O'Brien			[ -r ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ] && \
846a8730a56SDavid E. O'Brien			cp ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ${RD}/kernels
847a8730a56SDavid E. O'Brien
848288fe4dbSPoul-Henning Kamp#
849288fe4dbSPoul-Henning Kamp# --==## Put a filesystem into a BOOTMFS kernel ##==--
850288fe4dbSPoul-Henning Kamp#
851288fe4dbSPoul-Henning KampdoMFSKERN:
85292e86f99SJordan K. Hubbard	@echo "Running doMFSKERN for ${FSIMAGE}"
853d50a3007SJordan K. Hubbard	@rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE}
854b98c5f70STatsumi Hosokawa	@cd ${.CURDIR} && ${MAKE} createBOOTMFS
8552440c807SDavid E. O'Brien	@cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS KERNEL_KO=BOOTMFS KODIR=""
856643f7da0SJordan K. Hubbard	@rm -rf ${RD}/image.${FSIMAGE}
857643f7da0SJordan K. Hubbard	@mkdir  ${RD}/image.${FSIMAGE}
858fff8eb57SJohn Baldwin	@cd ${RD}/kernels && \
859937d0d51SDon Lewis	  (chflags noschg BOOTMFS || true) && \
860fff8eb57SJohn Baldwin	  strip BOOTMFS && \
861fff8eb57SJohn Baldwin	  cp BOOTMFS BOOTMFS.${FSIMAGE} && \
862fff8eb57SJohn Baldwin	  [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
86392e86f99SJordan K. Hubbard	mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
86492e86f99SJordan K. Hubbard	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
865643f7da0SJordan K. Hubbard	@mkdir -p ${RD}/image.${FSIMAGE}/boot
8669e239bc2SDavid E. O'Brien	@cp /boot/loader ${RD}/image.${FSIMAGE}/boot
867fff8eb57SJohn Baldwin	@[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
868fff8eb57SJohn Baldwin	  sed -e '/^hint/s/^/set /' -e '/^#/d' \
869fff8eb57SJohn Baldwin	    ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
870fff8eb57SJohn Baldwin	    ${RD}/image.${FSIMAGE}/boot/device.hints && \
871fff8eb57SJohn Baldwin	  echo "include /boot/device.hints" > ${RD}/image.${FSIMAGE}/boot/loader.rc
872fff8eb57SJohn Baldwin	@echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
87304063000SJohn W. De Boskey.if !defined(FDSIZE) || ${FDSIZE} != "BIG"
874f7a68483SMasafumi Max NAKANE	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
875c8fe5d2aSMike Smith	@echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
876c8fe5d2aSMike Smith	@echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
877c8fe5d2aSMike Smith	@echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
87896a3add7SMasafumi Max NAKANE.endif
87996a3add7SMasafumi Max NAKANE	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
88078e52c11SMasafumi Max NAKANE	@echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
881ce51a9fcSJordan K. Hubbard.if ${MACHINE_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
88296a3add7SMasafumi Max NAKANE	@echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
8838198d9b0SJordan K. Hubbard.endif
8847920b17fSYoshihiro Takahashi.if defined(FDSIZE) && ${FDSIZE} == "BIG"
8859694e175SJordan K. Hubbard	@echo "Writing MFS image into kernel for ${FSIMAGE} floppy"
88692e86f99SJordan K. Hubbard	@./write_mfs_in_kernel ${RD}/image.${FSIMAGE}/kernel mfsroot
887643f7da0SJordan K. Hubbard	@cp ${RD}/image.${FSIMAGE}/kernel ${RD}/kernels/MFSKERNEL.${FSIMAGE}
8889694e175SJordan K. Hubbard.endif
8897953e823SJordan K. Hubbard	@gzip -9v ${RD}/image.${FSIMAGE}/kernel
890643f7da0SJordan K. Hubbard	@rm -f ${RD}/floppies/${FSIMAGE}.flp
8917920b17fSYoshihiro Takahashi.if defined(FDSIZE) && ${FDSIZE} == "BIG"
89250895b89SJordan K. Hubbard	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
893b5d01310SJordan K. Hubbard		${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \
894b5d01310SJordan K. Hubbard		${BOOTINODE} ${BIGBOOTLABEL}
8957920b17fSYoshihiro Takahashi.elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
8967920b17fSYoshihiro Takahashi	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
8977920b17fSYoshihiro Takahashi		${RD} ${MNT} ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} \
8987920b17fSYoshihiro Takahashi		${BOOTINODE} ${SMALLBOOTLABEL}
89950895b89SJordan K. Hubbard.else
90050895b89SJordan K. Hubbard	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
90192e86f99SJordan K. Hubbard		${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \
90292e86f99SJordan K. Hubbard		${BOOTINODE} ${BOOTLABEL}
90350895b89SJordan K. Hubbard.endif
90492e86f99SJordan K. Hubbard	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
905288fe4dbSPoul-Henning Kamp
9062469b9a2SPoul-Henning Kamp.include <bsd.prog.mk>
907