Makefile.bootimage revision 1.50
11.50Stsutsui#	$NetBSD: Makefile.bootimage,v 1.50 2026/01/18 00:07:36 tsutsui Exp $
21.1Stsutsui#
31.1Stsutsui# Copyright (c) 2009, 2010, 2011 Izumi Tsutsui.  All rights reserved.
41.1Stsutsui#
51.1Stsutsui# Redistribution and use in source and binary forms, with or without
61.1Stsutsui# modification, are permitted provided that the following conditions
71.1Stsutsui# are met:
81.1Stsutsui# 1. Redistributions of source code must retain the above copyright
91.1Stsutsui#    notice, this list of conditions and the following disclaimer.
101.1Stsutsui# 2. Redistributions in binary form must reproduce the above copyright
111.1Stsutsui#    notice, this list of conditions and the following disclaimer in the
121.1Stsutsui#    documentation and/or other materials provided with the distribution.
131.1Stsutsui#
141.1Stsutsui# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
151.1Stsutsui# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
161.1Stsutsui# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
171.1Stsutsui# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
181.1Stsutsui# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
191.1Stsutsui# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
201.1Stsutsui# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
211.1Stsutsui# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
221.1Stsutsui# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
231.1Stsutsui# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
241.1Stsutsui
251.1Stsutsui#
261.1Stsutsui# Makefile to create a bootable FS image for USB flash or emulators
271.1Stsutsui#
281.1Stsutsui
291.1Stsutsui#
301.1Stsutsui# Required variables:
311.1Stsutsui#	RELEASEDIR
321.1Stsutsui#		Should be defined in nbmake-${MACHINE}
331.1Stsutsui#	IMGBASE
341.1Stsutsui#		Basename of the image
351.1Stsutsui#
361.1Stsutsui# Optional variables:
371.1Stsutsui#	USE_MBR
381.1Stsutsui#		set yes if target disk image requires MBR partition
391.6Stsutsui#		(default: no)
401.23Sjoerg#	USE_GPT
411.23Sjoerg#		set yes if target disk image requires GPT partition
421.23Sjoerg#		(default: no)
431.31Stsutsui#	USE_GPTMBR
441.31Stsutsui#		set yes if target disk image requires GPT partition
451.31Stsutsui#		with hybrid MBR boot code
461.31Stsutsui#		(default: no; valid only if USE_GPT=yes)
471.50Stsutsui#	USE_MDBOOTPART
481.50Stsutsui#		set yes if target disk image requires port specific
491.50Stsutsui#		boot partition
501.50Stsutsui#		(default: no; if yes target rules of WORKMDBOOTPART should
511.50Stsutsui#		 be defined in MD liveimage/Makefiles)
521.5Stsutsui#	MBR_BOOTCODE
531.5Stsutsui#		optional MBR bootcode which should be installed by fdisk(8)
541.5Stsutsui#		(default: empty)
551.5Stsutsui#		- specified MBR_BOOTCODE must exist in ${DESTDIR}/usr/mdec
561.5Stsutsui#		- if MBR_BOOTCODE is not specified,
571.5Stsutsui#		  MBR_DEFAULT_BOOTCODE (default: mbr) will be used
581.5Stsutsui#		  if the target ${MACHINE} has the one in /usr/mdec
591.1Stsutsui#	USE_SUNLABEL
601.1Stsutsui#		set yes if target disk image requires Sun's label
611.1Stsutsui#		(default: no)
621.43Stsutsui#	INSTALLBOOT_AFTER_DISKLABEL
631.1Stsutsui#		set yes if the target ${MACHINE} requires disklabel
641.43Stsutsui#		to run installboot(8), like hp300 and vax
651.1Stsutsui#		(default: empty)
661.1Stsutsui#	IMAGEMB
671.1Stsutsui#		target image size in MB
681.1Stsutsui#		(default: 2048)
691.1Stsutsui#	SWAPMB
701.1Stsutsui#		swap size in target image in MB
711.1Stsutsui#		(default: 128)
721.23Sjoerg#	EFIMB
731.23Sjoerg#		EFI partition size in target image in MB
741.23Sjoerg#		(default: 128)
751.24Stsutsui#	FATMB
761.24Stsutsui#		FAT partition size in target image in MB
771.24Stsutsui#		(default: 0)
781.50Stsutsui#	MDBOOTPARTMB
791.50Stsutsui#		port specific boot partition size in target image in MB
801.50Stsutsui#		(default: 0)
811.31Stsutsui#	GPTSECTORS
821.31Stsutsui#		Size of a region reserved for the secondary GPT table/entry
831.31Stsutsui#		at the end of the target image in sectors
841.31Stsutsui#		(default: 2048 if USE_GPT=yes, otherwise 0)
851.1Stsutsui#	KERN_SET
861.1Stsutsui#		kernel set name which should be extracted into image
871.1Stsutsui#		(default: kern-GENERIC)
881.1Stsutsui#	SETS
891.1Stsutsui#		binary sets that should be extracted into image
901.34Snia#		(default: modules base etc comp games gpufw man manhtml misc
911.29Smaya#		          rescue tests text xbase xcomp xetc xfont xserver)
921.1Stsutsui#	SETS_DIR
931.1Stsutsui#		directory path where binary sets are stored
941.1Stsutsui#		(default: ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets)
951.1Stsutsui#	IMGFILE_EXTRA
961.1Stsutsui#		list of additional files to be copied into images,
971.1Stsutsui#		containing one or more tuples of the form:
981.1Stsutsui#			FILE	TARGETPATH
991.1Stsutsui#		for installation image etc.
1001.1Stsutsui#		(default: empty)
1011.1Stsutsui#	IMGDIR_EXTRA
1021.1Stsutsui#		list of additional directories to be copied into images,
1031.1Stsutsui#		containing one or more tuples of the form:
1041.1Stsutsui#			DIR	TARGETPATH
1051.1Stsutsui#		for installation image etc.
1061.1Stsutsui#		(default: empty)
1071.6Stsutsui#		XXX: currently permissions in IMGDIR_EXTRA are not handled
1081.1Stsutsui#	IMGDIR_EXCLUDE
1091.1Stsutsui#		pax(1) options to exclude files which should not copied
1101.1Stsutsui#		into TARGETPATH in IMGDIR_EXTRA
1111.1Stsutsui#		(default: empty)
1121.1Stsutsui#	FSTAB_IN
1131.1Stsutsui#		template file of /etc/fstab
1141.1Stsutsui#		(default: ${DISTRIBDIR}/common/bootimage/fstab.in)
1151.1Stsutsui#	SPEC_IN
1161.1Stsutsui#		default files of spec file for makefs(8)
1171.1Stsutsui#		(default: ${DISTRIBDIR}/common/bootimage/spec.in)
1181.1Stsutsui#	SPEC_EXTRA
1191.1Stsutsui#		additional files of spec file for makefs(8)
1201.1Stsutsui#		(default: empty)
1211.1Stsutsui#	IMGMAKEFSOPTIONS
1221.1Stsutsui#		options passed to makefs(8) to create root file system
1231.1Stsutsui#		(default: -o bsize=16384,fsize=2048,density=8192)
1241.45Stsutsui#	IMGFFSVERSION
1251.45Stsutsui#		version of FFS created by makefs(8)
1261.45Stsutsui#		(default: 1)
1271.5Stsutsui#	INSTALLBOOTOPTIONS
1281.5Stsutsui#		options passed to installboot(8), e.g., -o console=com0
1291.5Stsutsui#		(default: empty)
1301.1Stsutsui#	PRIMARY_BOOT
1311.1Stsutsui#		primary boot loader that should be installed into
1321.1Stsutsui#		the target image via installboot(8)
1331.1Stsutsui#		(default: empty)
1341.1Stsutsui#	SECONDARY_BOOT
1351.1Stsutsui#		secondary bootloader that should be put into the target image
1361.1Stsutsui#		(default: empty)
1371.1Stsutsui#	SECONDARY_BOOT_ARG
1381.1Stsutsui#		extra arguments that should be passed to installboot(8)
1391.1Stsutsui#		to specify the secondary bootloader
1401.1Stsutsui#		(default: empty)
1411.1Stsutsui#	DISKPROTO_IN
1421.1Stsutsui#		template file of disklabel -R
1431.1Stsutsui#		(default: ${DISTRIBDIR}/common/bootimage/diskproto.in
1441.1Stsutsui#		       or ${DISTRIBDIR}/common/bootimage/diskproto.mbr.in)
1451.23Sjoerg#	EFIBOOT
1461.23Sjoerg#		EFI bootloader
1471.23Sjoerg#		(default: empty)
1481.24Stsutsui#	MBRFAT
1491.24Stsutsui#		MBR partition type value for FAT
1501.24Stsutsui#		(default: 6 ("16-bit FAT, more than 32M"))
1511.24Stsutsui#	FATMAKEFSOPTIONS
1521.24Stsutsui#		options passed to makefs(8) to create a FAT partition
1531.24Stsutsui#		(default: -o fat_type=16)
1541.24Stsutsui#	FATFILES
1551.24Stsutsui#		list of additional files to be copied into FAT partition
1561.24Stsutsui#		(default: empty)
1571.26Sjmcneill#	IMAGEHOSTNAME
1581.26Sjmcneill#		if set, sets the default hostname in rc.conf (default: empty)
1591.1Stsutsui#
1601.1Stsutsui
1611.1Stsutsui.include <bsd.own.mk> 		#
1621.1Stsutsui.include <bsd.endian.mk>	# for TARGET_ENDIANNESS
1631.1Stsutsui
1641.1Stsutsui.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
1651.1Stsutsui
1661.13Schristos.if ${MKREPRO_TIMESTAMP:Uno} != "no"
1671.13SchristosMAKEFS_TIMESTAMP=-T "${MKREPRO_TIMESTAMP}"
1681.23SjoergGPT_TIMESTAMP=-T "${MKREPRO_TIMESTAMP}"
1691.15SchristosPAX_TIMESTAMP=--timestamp "${MKREPRO_TIMESTAMP}"
1701.15Schristos.endif
1711.12Schristos
1721.1Stsutsui.if empty(IMGBASE)
1731.1Stsutsui.BEGIN:
1741.1Stsutsui	@echo "Error: IMGBASE is not set"
1751.1Stsutsui	@false
1761.1Stsutsui.endif
1771.1Stsutsui
1781.1Stsutsui# should be defined elsewhere? 
1791.1StsutsuiCAT?=		cat
1801.1StsutsuiCHMOD?=		chmod
1811.1StsutsuiDD?=		dd
1821.1StsutsuiMKDIR?=		mkdir -p
1831.1StsutsuiRM?=		rm
1841.1Stsutsui
1851.36SchristosMAKESPEC=	${HOST_SH} ${NETBSDSRCDIR}/etc/makespec
1861.36Schristos
1871.1Stsutsui#
1881.1Stsutsui# common definitions for image
1891.1Stsutsui#
1901.1StsutsuiUSE_MBR?=	no
1911.23SjoergUSE_GPT?=	no
1921.25SjmcneillUSE_GPTMBR?=	no
1931.50StsutsuiUSE_MDBOOTPART?= no
1941.1StsutsuiUSE_SUNLABEL?=	no
1951.1StsutsuiINSTALLBOOT_AFTER_DISKLABEL?=	no
1961.1Stsutsui
1971.1Stsutsui#
1981.1Stsutsui# size parameters for image
1991.1Stsutsui#
2001.1StsutsuiIMAGEMB?=	2048		# 2048MB
2011.1StsutsuiSWAPMB?=	128		# 128MB
2021.23Sjoerg.if ${USE_GPT} == "no"
2031.23SjoergEFIMB?=		0
2041.23SjoergGPTSECTORS=	0
2051.23Sjoerg.else
2061.23SjoergEFIMB?=		128		# 128MB
2071.23SjoergGPTSECTORS=	2048
2081.23Sjoerg.endif
2091.24StsutsuiFATMB?=		0
2101.50StsutsuiMDBOOTPARTMB?=	0
2111.1Stsutsui
2121.3Stsutsui# XXX: SWAPMB could be zero and expr(1) returns exit status 1 in that case
2131.1StsutsuiIMAGESECTORS!=	expr ${IMAGEMB} \* 1024 \* 1024 / 512
2141.3StsutsuiSWAPSECTORS!=	expr ${SWAPMB} \* 1024 \* 1024 / 512 || true
2151.23SjoergEFISECTORS!=	expr ${EFIMB} \* 1024 \* 1024 / 512 || true
2161.24StsutsuiFATSECTORS!=	expr ${FATMB} \* 1024 \* 1024 / 512 || true
2171.1Stsutsui
2181.50Stsutsui.if ${USE_MDBOOTPART} != "no"
2191.50StsutsuiMDBOOTPARTSECTORS!=	expr ${MDBOOTPARTMB} \* 1024 \* 1024 / 512 || true
2201.50Stsutsui.else
2211.50StsutsuiMDBOOTPARTSECTORS=	0
2221.50Stsutsui.endif
2231.50Stsutsui
2241.23Sjoerg.if ${USE_MBR} == "no" && ${USE_GPT} == "no"
2251.1StsutsuiLABELSECTORS?=	0
2261.1Stsutsui.else
2271.1Stsutsui#LABELSECTORS?=	63	# historical
2281.1Stsutsui#LABELSECTORS?=	32	# 16KB aligned
2291.1StsutsuiLABELSECTORS?=	2048	# 1MB aligned for modern flash devices
2301.1Stsutsui.endif
2311.1Stsutsui
2321.50Stsutsui.if ${USE_MDBOOTPART} != "no"
2331.50StsutsuiMDBOOTPARTOFFSET!=	expr ${LABELSECTORS} + ${EFISECTORS} + ${FATSECTORS} \
2341.50Stsutsui			    || test $$? -eq 1 || exit 1
2351.50Stsutsui.else
2361.50StsutsuiMDBOOTPARTOFFSET=	0
2371.50Stsutsui.endif
2381.50Stsutsui
2391.23SjoergFSSECTORS!=	expr ${IMAGESECTORS} - ${SWAPSECTORS} - ${LABELSECTORS} \
2401.50Stsutsui		    - ${EFISECTORS} - ${GPTSECTORS} - ${FATSECTORS} \
2411.50Stsutsui		    - ${MDBOOTPARTSECTORS} || test $$? -eq 1 || exit 1
2421.30SmrgFSSIZE!=	expr ${FSSECTORS} \* 512 || test $$? -eq 1 || exit 1
2431.1Stsutsui
2441.1Stsutsui# parameters for disklabel and MBR
2451.1StsutsuiHEADS=		64
2461.1StsutsuiSECTORS=	32
2471.1StsutsuiCYLINDERS!=	expr ${IMAGESECTORS} / \( ${HEADS} \* ${SECTORS} \)
2481.1StsutsuiSECPERCYLINDERS!= expr ${HEADS} \* ${SECTORS}
2491.1StsutsuiMBRHEADS=	255
2501.1StsutsuiMBRSECTORS=	63
2511.1StsutsuiMBRCYLINDERS!=	expr ${IMAGESECTORS} / \( ${MBRHEADS} \* ${MBRSECTORS} \)
2521.1StsutsuiMBRNETBSD=	169
2531.24StsutsuiMBRFAT?=	6	# 16-bit FAT, more than 32M
2541.1Stsutsui
2551.24StsutsuiBSDPARTSECTORS!= expr ${IMAGESECTORS} - ${LABELSECTORS} \
2561.50Stsutsui		    - ${EFISECTORS} - ${GPTSECTORS} - ${FATSECTORS} \
2571.50Stsutsui		    - ${MDBOOTPARTSECTORS}
2581.50StsutsuiFSOFFSET!=	expr ${LABELSECTORS} + ${EFISECTORS} + ${FATSECTORS} \
2591.50Stsutsui		    + ${MDBOOTPARTSECTORS} || test $$? -eq 1 || exit 1
2601.24StsutsuiSWAPOFFSET!=	expr ${LABELSECTORS} + ${FSSECTORS} \
2611.50Stsutsui		    + ${EFISECTORS} + ${FATSECTORS} \
2621.50Stsutsui		    + ${MDBOOTPARTSECTORS} || test $$? -eq 1 || exit 1
2631.24StsutsuiFATOFFSET=	${LABELSECTORS}
2641.1Stsutsui
2651.47Stsutsui# helper script for sunlabel
2661.47StsutsuiDISKPROTO2SUNLABEL?=	${DISTRIBDIR}/common/bootimage/diskproto2sunlabel.awk
2671.1Stsutsui
2681.23Sjoerg.if ${USE_GPT} != "no"
2691.33SchristosBOOTDISK_UUID=`${TOOL_GPT} ${GPT_TIMESTAMP} ${WORKMBR} show -i 2 | ${TOOL_AWK} '/^GUID/ {print $$2}'`
2701.33SchristosSWAPDISK_UUID=`${TOOL_GPT} ${GPT_TIMESTAMP} ${WORKMBR} show -i 3 | ${TOOL_AWK} '/^GUID/ {print $$2}'`
2711.23Sjoerg.endif
2721.1Stsutsui
2731.1Stsutsui#
2741.1Stsutsui# definitions to create root fs
2751.1Stsutsui#
2761.42SjmmvSETS_DEFAULT=	modules base etc comp games gpufw man misc rescue text
2771.42Sjmmv.if ${MKATF} != "no"
2781.42SjmmvSETS_DEFAULT+=	tests
2791.42Sjmmv.endif
2801.34Snia.if ${MKCOMPAT} != "no"
2811.34SniaSETS_DEFAULT+=	base32
2821.34Snia.endif
2831.35Snia.if ${MKCOMPAT} != "no" && \
2841.35Snia    (${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el")
2851.35SniaSETS_DEFAULT+=	base64
2861.35Snia.endif
2871.34Snia.if ${MKHTML} != "no"
2881.34SniaSETS_DEFAULT+=	manhtml
2891.34Snia.endif
2901.1Stsutsui.if ${MKX11} != "no"
2911.1StsutsuiSETS_DEFAULT+=	xbase xcomp xetc xfont xserver
2921.1Stsutsui.endif
2931.1Stsutsui
2941.1StsutsuiKERN_SET?=	kern-GENERIC
2951.1StsutsuiSETS?=		${SETS_DEFAULT}
2961.1StsutsuiIMG_SETS=	${KERN_SET} ${SETS}
2971.1StsutsuiSETS_DIR?=	${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
2981.1Stsutsui
2991.1StsutsuiFSTAB_IN?=	${DISTRIBDIR}/common/bootimage/fstab.in
3001.46Spgoyette.if ${KERNEL_DIR:Uno} == "yes"
3011.46SpgoyetteSPEC_IN?=	${DISTRIBDIR}/common/bootimage/spec-dir.in
3021.46Spgoyette.else
3031.1StsutsuiSPEC_IN?=	${DISTRIBDIR}/common/bootimage/spec.in
3041.46Spgoyette.endif
3051.1Stsutsui
3061.1StsutsuiIMGMAKEFSOPTIONS?=	-o bsize=16384,fsize=2048,density=8192
3071.45StsutsuiIMGFFSVERSION?=		1
3081.24StsutsuiFATMAKEFSOPTIONS?=	-o fat_type=16
3091.1Stsutsui
3101.1StsutsuiWORKDIR?=       work
3111.1StsutsuiWORKSPEC?=      work.spec
3121.1StsutsuiWORKFSTAB?=	work.fstab
3131.1StsutsuiWORKRCCONF?=	work.rc.conf
3141.1StsutsuiWORKFS?=        work.rootfs
3151.1StsutsuiTARGETFS?=      imgroot.fs
3161.19SaymericCOMPRESS_PROGRAM=${"${USE_XZ_SETS:Uno}"!="no":?${TOOL_XZ}:${TOOL_GZIP}}
3171.18SmartinTAR_SUFF=	${"${USE_XZ_SETS:Uno}"!="no":?tar.xz:tgz}
3181.1Stsutsui
3191.1StsutsuiCLEANFILES+=	${WORKSPEC} ${WORKFSTAB} ${WORKRCCONF} ${WORKFS}
3201.1StsutsuiCLEANFILES+=	${TARGETFS}
3211.1Stsutsui
3221.1Stsutsui#
3231.23Sjoerg# definitions to create image
3241.23Sjoerg#
3251.23Sjoerg.if ${SWAPSECTORS} == 0
3261.23Sjoerg.  if ${USE_MBR} != "no"
3271.23SjoergDISKPROTO_IN?=	${DISTRIBDIR}/common/bootimage/diskproto.noswap.mbr.in
3281.23Sjoerg.  else
3291.23SjoergDISKPROTO_IN?=	${DISTRIBDIR}/common/bootimage/diskproto.noswap.in
3301.23Sjoerg.  endif
3311.23Sjoerg.else
3321.23Sjoerg.  if ${USE_MBR} != "no"
3331.23SjoergDISKPROTO_IN?=	${DISTRIBDIR}/common/bootimage/diskproto.mbr.in
3341.23Sjoerg.  else
3351.23SjoergDISKPROTO_IN?=	${DISTRIBDIR}/common/bootimage/diskproto.in
3361.23Sjoerg.  endif
3371.23Sjoerg.endif
3381.23Sjoerg
3391.23SjoergMBR_DEFAULT_BOOTCODE?=	mbr
3401.23Sjoerg
3411.23SjoergWORKMBR?=	work.mbr
3421.23SjoergWORKMBRTRUNC?=	work.mbr.truncated
3431.23SjoergWORKSWAP?=	work.swap
3441.23SjoergWORKEFI?=	work.efi
3451.23SjoergWORKGPT?=	work.gpt
3461.23SjoergWORKLABEL?=	work.diskproto
3471.23SjoergWORKIMG?=	work.img
3481.23SjoergEFIWORKDIR?=	work.efidir
3491.24StsutsuiWORKFAT?=	work.fat
3501.24StsutsuiWORKFATDIR?=	work.fatdir
3511.50StsutsuiWORKMDBOOTPART?= work.mdbootpart
3521.50StsutsuiWORKMDBOOTPARTDIR?= work.mdbootpartdir
3531.23Sjoerg
3541.23Sjoerg.if ${USE_GPT} != "no"
3551.23Sjoerg${WORKFSTAB}: ${WORKMBR}
3561.27Stsutsui
3571.27Stsutsui.BEGIN:
3581.27Stsutsui	@if [ -f ${WORKMBR} ]; then			 		\
3591.27Stsutsui		st_size=`${TOOL_STAT} -f %z ${WORKMBR}`;		\
3601.27Stsutsui		if [ "$$st_size" -ne "$$((${IMAGESECTORS} * 512))" ]; then \
3611.27Stsutsui			echo Removing stale ${WORKMBR} ...;		\
3621.27Stsutsui			rm -f ${WORKMBR};				\
3631.27Stsutsui		fi							\
3641.27Stsutsui	fi
3651.23Sjoerg.endif
3661.23Sjoerg
3671.23Sjoerg${WORKFSTAB}:
3681.23Sjoerg	@echo Preparing /etc/fstab ...
3691.23Sjoerg.if ${USE_GPT} != "no"
3701.23Sjoerg.  if ${SWAPSECTORS} != 0
3711.23Sjoerg	${TOOL_SED}							\
3721.41Smartin	    -e "s/ROOT.a/NAME=NBImgRoot/"				\
3731.41Smartin	    -e "s/ROOT.b/NAME=NBImgSwap/"				\
3741.23Sjoerg	    < ${FSTAB_IN} > ${WORKFSTAB}
3751.23Sjoerg.  else
3761.23Sjoerg	${TOOL_SED}							\
3771.41Smartin	    -e "s/ROOT.a/NAME=NBImgRoot/"				\
3781.23Sjoerg	    -e "/ROOT.b/d"						\
3791.23Sjoerg	    < ${FSTAB_IN} > ${WORKFSTAB}
3801.23Sjoerg.  endif
3811.23Sjoerg.else
3821.23Sjoerg.  if ${SWAPSECTORS} != 0
3831.23Sjoerg	${TOOL_SED} < ${FSTAB_IN} > ${WORKFSTAB}
3841.23Sjoerg.  else
3851.23Sjoerg	${TOOL_SED}							\
3861.23Sjoerg	    -e "/ROOT.b/d"						\
3871.23Sjoerg	    < ${FSTAB_IN} > ${WORKFSTAB}
3881.23Sjoerg.  endif
3891.23Sjoerg.endif
3901.23Sjoerg
3911.23Sjoerg#
3921.1Stsutsui# create root file system for the image
3931.1Stsutsui#
3941.23Sjoerg${TARGETFS}: prepare_md_post ${WORKFSTAB}
3951.36Schristos	@${RM} -f ${WORKSPEC}
3961.1Stsutsui	@if [ ! -d ${RELEASEDIR}/${RELEASEMACHINEDIR} ]; then 		\
3971.1Stsutsui		echo "Missing ${RELEASEDIR}/${RELEASEMACHINEDIR}, aborting"; \
3981.1Stsutsui		false; 							\
3991.1Stsutsui	fi;
4001.14Schristos	@${MKDIR} ${MKDIRPERM} ${WORKDIR}
4011.1Stsutsui.for set in ${IMG_SETS}
4021.18Smartin	@if [ ! -f ${SETS_DIR}/${set}.${TAR_SUFF} ]; then 		\
4031.18Smartin		echo "Missing ${SETS_DIR}/${set}.${TAR_SUFF}, aborting";\
4041.1Stsutsui		false; 							\
4051.1Stsutsui	fi
4061.18Smartin	@echo Extracting ${set}.${TAR_SUFF} ...
4071.19Saymeric	@(cd ${WORKDIR}; ${TOOL_PAX} ${PAX_TIMESTAMP} -rn \
4081.19Saymeric		--use-compress-program=${COMPRESS_PROGRAM:Q} \
4091.19Saymeric		-f ${SETS_DIR}/${set}.${TAR_SUFF} .)
4101.1Stsutsui.endfor
4111.1Stsutsui.if defined(SECONDARY_BOOT)
4121.1Stsutsui	@echo Copying secondary boot...
4131.21Stsutsui	${INSTALL} ${COPY} -m 0444 ${WORKDIR}/usr/mdec/${SECONDARY_BOOT} ${WORKDIR}
4141.1Stsutsui.endif
4151.14Schristos	${INSTALL} ${COPY} -m 0644 ${WORKFSTAB} ${WORKDIR}/etc/fstab
4161.1Stsutsui	@echo Setting rc_configured=YES in /etc/rc.conf ...
4171.1Stsutsui	${TOOL_SED} "s/rc_configured=NO/rc_configured=YES/"		\
4181.1Stsutsui	    < ${WORKDIR}/etc/rc.conf > ${WORKRCCONF}
4191.26Sjmcneill.if defined(IMAGEHOSTNAME)
4201.26Sjmcneill	@echo Setting hostname=${IMAGEHOSTNAME} in /etc/rc.conf ...
4211.26Sjmcneill	echo "hostname=${IMAGEHOSTNAME}" >> ${WORKRCCONF}
4221.26Sjmcneill.endif
4231.26Sjmcneill.if ${SWAPSECTORS} == 0
4241.26Sjmcneill	@echo Setting no_swap=YES in /etc/rc.conf ...
4251.26Sjmcneill	echo "no_swap=YES" >> ${WORKRCCONF}
4261.26Sjmcneill	@echo Setting savecore=NO in /etc/rc.conf ...
4271.26Sjmcneill	echo "savecore=NO" >> ${WORKRCCONF}
4281.26Sjmcneill.endif
4291.28Sjmcneill.if defined(RC_CONF_EXTRA)
4301.28Sjmcneill	@echo Adding contents of ${RC_CONF_EXTRA} to /etc/rc.conf ...
4311.28Sjmcneill	cat ${RC_CONF_EXTRA} >> ${WORKRCCONF}
4321.28Sjmcneill.endif
4331.14Schristos	${INSTALL} ${COPY} -m 0644 ${WORKRCCONF} ${WORKDIR}/etc/rc.conf
4341.1Stsutsui.if defined(IMGDIR_EXTRA)
4351.1Stsutsui	@echo Copying extra dirs...
4361.1Stsutsui.for _SRCDIR _TARGET in ${IMGDIR_EXTRA}
4371.1Stsutsui	@if [ ! -d ${_SRCDIR} ]; then 					\
4381.1Stsutsui		echo "${_SRCDIR} is not directory, aborting";		\
4391.1Stsutsui		false; 							\
4401.1Stsutsui	fi
4411.14Schristos	${MKDIR} ${MKDIRPERM} ${WORKDIR}/${_TARGET}
4421.1Stsutsui	(cd ${_SRCDIR} ;						\
4431.21Stsutsui	    ${TOOL_PAX} ${PAX_TIMESTAMP} -rw -pe -v			\
4441.1Stsutsui	    ${IMGDIR_EXCLUDE}						\
4451.1Stsutsui	    . ${.OBJDIR}/${WORKDIR}/${_TARGET} )
4461.1Stsutsui.endfor
4471.1Stsutsui.endif
4481.1Stsutsui.if defined(IMGFILE_EXTRA)
4491.1Stsutsui	@echo Copying extra files...
4501.1Stsutsui.for _SRC _TARGET in ${IMGFILE_EXTRA}
4511.1Stsutsui	@if [ ! -f ${_SRC} ]; then 					\
4521.1Stsutsui		echo "${_SRC} in IMGFILE_EXTRA not found, aborting";	\
4531.1Stsutsui		false; 							\
4541.1Stsutsui	fi
4551.1Stsutsui	@if [ -f ${_SRC} ]; then 					\
4561.21Stsutsui		echo ${INSTALL} ${COPY} -m 0644 ${_SRC} ${WORKDIR}/${_TARGET}; \
4571.21Stsutsui		${INSTALL} ${COPY} -m 0644 ${_SRC} ${WORKDIR}/${_TARGET}; \
4581.36Schristos		echo "./${_TARGET} type=file uname=root gname=wheel mode=0555" >> ${WORKSPEC}; \
4591.1Stsutsui	fi
4601.1Stsutsui.endfor
4611.1Stsutsui.endif
4621.1Stsutsui	@echo Preparing spec files for makefs...
4631.1Stsutsui	cat ${WORKDIR}/etc/mtree/* |					\
4641.1Stsutsui	    ${TOOL_SED} -e 's/ size=[0-9]*//' > ${WORKSPEC}
4651.10Ssnj	${HOST_SH} ${WORKDIR}/dev/MAKEDEV -s all ipty |			\
4661.1Stsutsui	    ${TOOL_SED} -e '/^\. type=dir/d' -e 's,^\.,./dev,' >> ${WORKSPEC}
4671.1Stsutsui	cat ${SPEC_IN} >> ${WORKSPEC}
4681.1Stsutsui.if defined(SECONDARY_BOOT)
4691.1Stsutsui	echo "./${SECONDARY_BOOT} type=file uname=root gname=wheel mode=0444" \
4701.1Stsutsui	    >> ${WORKSPEC}
4711.1Stsutsui.endif
4721.1Stsutsui.if defined(SPEC_EXTRA)
4731.1Stsutsui	cat ${SPEC_EXTRA} >> ${WORKSPEC}
4741.1Stsutsui.endif
4751.37Schristos	for i in ${WORKDIR}/netbsd.*; do \
4761.37Schristos	    if [ -e $$i ]; then \
4771.37Schristos		echo "./$$(basename $$i) type=file uname=root gname=wheel mode=0444" >> ${WORKSPEC}; \
4781.37Schristos	    fi; \
4791.37Schristos	done
4801.37Schristos	if [ -d ${WORKDIR}/${RELEASEMACHINEDIR} ]; then \
4811.37Schristos	    ${MAKESPEC} -d ${WORKDIR} ${RELEASEMACHINEDIR} >> ${WORKSPEC}; \
4821.36Schristos	fi
4831.4Sriz	@echo Creating rootfs...
4841.1Stsutsui	# XXX /var/spool/ftp/hidden is unreadable
4851.1Stsutsui	${CHMOD} +r ${WORKDIR}/var/spool/ftp/hidden
4861.1Stsutsui	${TOOL_MAKEFS} -M ${FSSIZE} -m ${FSSIZE}			\
4871.1Stsutsui	    -B ${TARGET_ENDIANNESS}					\
4881.36Schristos	    -xx -F ${WORKSPEC} -N ${WORKDIR}/etc			\
4891.13Schristos	    ${MAKEFS_TIMESTAMP}						\
4901.45Stsutsui	    -t ffs							\
4911.1Stsutsui	    ${IMGMAKEFSOPTIONS}						\
4921.45Stsutsui	    -o version=${IMGFFSVERSION}					\
4931.1Stsutsui	    ${WORKFS} ${WORKDIR}
4941.1Stsutsui.if !empty(PRIMARY_BOOT) && ${INSTALLBOOT_AFTER_DISKLABEL} == "no"
4951.5Stsutsui	${TOOL_INSTALLBOOT} -v -m ${MACHINE} ${INSTALLBOOTOPTIONS} ${WORKFS} \
4961.1Stsutsui	    ${WORKDIR}/usr/mdec/${PRIMARY_BOOT} ${SECONDARY_BOOT_ARG}
4971.1Stsutsui.endif
4981.1Stsutsui	@echo done.
4991.1Stsutsui	mv ${WORKFS} ${.TARGET}
5001.1Stsutsui
5011.23SjoergTARGET_BLOCKS=
5021.23Sjoerg.if ${USE_MBR} != "no" || ${USE_GPT} != "no"
5031.23SjoergTARGET_BLOCKS+=	${WORKMBRTRUNC}
5041.23Sjoerg.endif
5051.23Sjoerg.if ${USE_GPT} != "no"
5061.23SjoergTARGET_BLOCKS+=	${WORKEFI}
5071.23Sjoerg.endif
5081.24Stsutsui.if ${FATSECTORS} != 0
5091.24StsutsuiTARGET_BLOCKS+=	${WORKFAT}
5101.24Stsutsui.endif
5111.50Stsutsui.if ${USE_MDBOOTPART} != "no"
5121.50StsutsuiTARGET_BLOCKS+=	${WORKMDBOOTPART}
5131.50Stsutsui.endif
5141.23SjoergTARGET_BLOCKS+=	 ${TARGETFS}
5151.23Sjoerg.if ${SWAPSECTORS} != 0
5161.23SjoergTARGET_BLOCKS+=	${WORKSWAP}
5171.23Sjoerg.endif
5181.23Sjoerg.if ${USE_GPT} != "no"
5191.23SjoergTARGET_BLOCKS+=	${WORKGPT}
5201.1Stsutsui.endif
5211.1Stsutsui
5221.23SjoergCLEANFILES+=	${WORKMBR} ${WORKMBRTRUNC} ${WORKSWAP}
5231.23SjoergCLEANFILES+=	${WORKEFI} ${WORKGPT}
5241.24StsutsuiCLEANFILES+=	${WORKFAT}
5251.50StsutsuiCLEANFILES+=	${WORKMDBOOTPART}
5261.23SjoergCLEANFILES+=	${WORKLABEL}.tmp ${WORKLABEL}
5271.23SjoergCLEANFILES+=	${WORKIMG} ${IMGBASE}.img
5281.5Stsutsui
5291.23Sjoerg${WORKSWAP}:
5301.23Sjoerg.if ${SWAPSECTORS} == 0
5311.23Sjoerg	printf "" > ${WORKSWAP}
5321.23Sjoerg.else
5331.23Sjoerg	${DD} if=/dev/zero of=${WORKSWAP} seek=$$((${SWAPSECTORS} - 1)) count=1
5341.23Sjoerg.endif
5351.1Stsutsui
5361.23Sjoerg${WORKMBRTRUNC}: ${WORKMBR}
5371.23Sjoerg	${DD} if=${WORKMBR} count=${LABELSECTORS} of=${WORKMBRTRUNC}
5381.1Stsutsui
5391.1Stsutsui${WORKLABEL}:
5401.1Stsutsui	${TOOL_SED}							\
5411.1Stsutsui	    -e "s/@@SECTORS@@/${SECTORS}/"				\
5421.1Stsutsui	    -e "s/@@HEADS@@/${HEADS}/"					\
5431.1Stsutsui	    -e "s/@@SECPERCYLINDERS@@/${SECPERCYLINDERS}/"		\
5441.1Stsutsui	    -e "s/@@CYLINDERS@@/${CYLINDERS}/"				\
5451.1Stsutsui	    -e "s/@@IMAGESECTORS@@/${IMAGESECTORS}/"			\
5461.1Stsutsui	    -e "s/@@FSSECTORS@@/${FSSECTORS}/"				\
5471.1Stsutsui	    -e "s/@@FSOFFSET@@/${FSOFFSET}/"				\
5481.1Stsutsui	    -e "s/@@SWAPSECTORS@@/${SWAPSECTORS}/"			\
5491.1Stsutsui	    -e "s/@@SWAPOFFSET@@/${SWAPOFFSET}/"			\
5501.1Stsutsui	    -e "s/@@BSDPARTSECTORS@@/${BSDPARTSECTORS}/"		\
5511.24Stsutsui	    -e "s/@@FATSECTORS@@/${FATSECTORS}/"			\
5521.24Stsutsui	    -e "s/@@FATOFFSET@@/${FATOFFSET}/"				\
5531.50Stsutsui	    -e "s/@@MDBOOTPARTSECTORS@@/${MDBOOTPARTSECTORS}/"		\
5541.50Stsutsui	    -e "s/@@MDBOOTPARTOFFSET@@/${MDBOOTPARTOFFSET}/"		\
5551.1Stsutsui	    < ${DISKPROTO_IN} > ${WORKLABEL}.tmp
5561.1Stsutsui	mv ${WORKLABEL}.tmp ${WORKLABEL}
5571.1Stsutsui
5581.23Sjoerg${WORKEFI}: ${TARGETFS}
5591.23Sjoerg	@echo create EFI system partition...
5601.23Sjoerg	@${MKDIR} ${MKDIRPERM} ${EFIWORKDIR}/EFI/boot
5611.23Sjoerg.for f in ${EFIBOOT}
5621.23Sjoerg	${INSTALL} ${COPY} -m 0644 ${f} ${EFIWORKDIR}/EFI/boot/`basename ${f}`
5631.23Sjoerg.endfor
5641.23Sjoerg	${RM} -f ${WORKEFI}
5651.23Sjoerg	${TOOL_MAKEFS} -M ${EFIMB}m -m ${EFIMB}m			\
5661.23Sjoerg	    ${MAKEFS_TIMESTAMP}						\
5671.23Sjoerg	    -t msdos -o F=32,c=1					\
5681.23Sjoerg	    ${WORKEFI} ${EFIWORKDIR}
5691.23Sjoerg
5701.49Stsutsui.if defined(FATFILES)
5711.48Stsutsui${FATFILES}: ${TARGETFS}
5721.48Stsutsui	# Some MD ${FATFILES} (bootloaders etc.) are assumed extracted
5731.48Stsutsui	# to ${WORKDIR} from binary sets during ${TARGETFS} image build
5741.49Stsutsui.endif
5751.48Stsutsui
5761.48Stsutsui${WORKFAT}: ${FATFILES}
5771.24Stsutsui	@echo create FAT partition for bootstrap files...
5781.24Stsutsui	@${MKDIR} ${MKDIRPERM} ${WORKFATDIR}
5791.24Stsutsui.if defined(FATFILES)
5801.24Stsutsui	@echo Copying files for FAT partition...
5811.24Stsutsui.for f in ${FATFILES}
5821.24Stsutsui	@if [ ! -f ${f} ]; then 					\
5831.24Stsutsui		echo "${f} in FATFILES not found, aborting";		\
5841.24Stsutsui		false; 							\
5851.24Stsutsui	fi
5861.24Stsutsui	${INSTALL} ${COPY} -m 0644 ${f} ${WORKFATDIR}
5871.24Stsutsui.endfor
5881.24Stsutsui.endif
5891.24Stsutsui	${RM} -f ${WORKFAT}
5901.24Stsutsui	${TOOL_MAKEFS} -M ${FATMB}m -m ${FATMB}m			\
5911.24Stsutsui	    ${MAKEFS_TIMESTAMP}						\
5921.24Stsutsui	    -t msdos							\
5931.24Stsutsui	    ${FATMAKEFSOPTIONS}						\
5941.24Stsutsui	    ${WORKFAT} ${WORKFATDIR}
5951.24Stsutsui
5961.23Sjoerg${WORKMBR}:
5971.23Sjoerg.if ${USE_GPT} != "no"
5981.23Sjoerg	@echo creating GPT header and partition entries...
5991.23Sjoerg	${RM} -f ${WORKMBR}
6001.23Sjoerg	${DD} if=/dev/zero of=${WORKMBR} seek=$$((${IMAGESECTORS} - 1)) count=1
6011.33Schristos	${TOOL_GPT} ${GPT_TIMESTAMP} ${WORKMBR} create
6021.33Schristos	${TOOL_GPT} ${GPT_TIMESTAMP} ${WORKMBR} add -a 1m -s ${EFISECTORS} -t efi -l "EFI system"
6031.40Smartin	${TOOL_GPT} ${GPT_TIMESTAMP} ${WORKMBR} add -a 1m -s ${FSSECTORS} -t ffs -l "NBImgRoot"
6041.23Sjoerg.  if ${SWAPSECTORS} != 0
6051.41Smartin	${TOOL_GPT} ${GPT_TIMESTAMP} ${WORKMBR} add -a 1m -s ${SWAPSECTORS} -t swap -l "NBImgSwap"
6061.23Sjoerg.  endif
6071.23Sjoerg.elif ${USE_MBR} != "no"
6081.1Stsutsui	@echo creating MBR labels...
6091.1Stsutsui	${DD} if=/dev/zero of=${WORKMBR} seek=$$((${IMAGESECTORS} - 1)) count=1
6101.24Stsutsui.  if ${FATSECTORS} != 0
6111.24Stsutsui	# create BSD partition
6121.24Stsutsui	${TOOL_FDISK} -f -i -u \
6131.24Stsutsui	    -b ${MBRCYLINDERS}/${MBRHEADS}/${MBRSECTORS}		\
6141.24Stsutsui	    -1 -a -s ${MBRNETBSD}/${FSOFFSET}/${BSDPARTSECTORS}		\
6151.24Stsutsui	    -F ${WORKMBR}
6161.24Stsutsui	# create FAT partition
6171.24Stsutsui	${TOOL_FDISK} -f -u \
6181.24Stsutsui	    -b ${MBRCYLINDERS}/${MBRHEADS}/${MBRSECTORS}		\
6191.24Stsutsui	    -0 -s ${MBRFAT}/${FATOFFSET}/${FATSECTORS}			\
6201.24Stsutsui	    -F ${WORKMBR}
6211.24Stsutsui.  else
6221.24Stsutsui	# create BSD partition
6231.5Stsutsui	${TOOL_FDISK} -f -i -u \
6241.1Stsutsui	    -b ${MBRCYLINDERS}/${MBRHEADS}/${MBRSECTORS}		\
6251.1Stsutsui	    -0 -a -s ${MBRNETBSD}/${FSOFFSET}/${BSDPARTSECTORS}		\
6261.1Stsutsui	    -F ${WORKMBR}
6271.24Stsutsui.  endif
6281.23Sjoerg.  if empty(MBR_BOOTCODE)
6291.5Stsutsui	@if [ -f ${WORKDIR}/usr/mdec/${MBR_DEFAULT_BOOTCODE} ]; then 	\
6301.5Stsutsui		echo ${TOOL_FDISK} -f					\
6311.5Stsutsui		    -i -c ${WORKDIR}/usr/mdec/${MBR_DEFAULT_BOOTCODE}	\
6321.5Stsutsui		    -F ${WORKMBR};					\
6331.5Stsutsui		${TOOL_FDISK} -f					\
6341.5Stsutsui		    -i -c ${WORKDIR}/usr/mdec/${MBR_DEFAULT_BOOTCODE}	\
6351.5Stsutsui		    -F ${WORKMBR};					\
6361.5Stsutsui	fi
6371.23Sjoerg.  else
6381.5Stsutsui	@if [ ! -f ${WORKDIR}/usr/mdec/${MBR_BOOTCODE} ]; then 		\
6391.5Stsutsui		echo "${MBR_BOOTCODE} is not found in DESTDIR/usr/mdec, aborting"; \
6401.5Stsutsui		false; 							\
6411.5Stsutsui	fi
6421.5Stsutsui	${TOOL_FDISK} -f -i -c ${WORKDIR}/usr/mdec/${MBR_BOOTCODE}	\
6431.5Stsutsui	    -F ${WORKMBR}
6441.23Sjoerg.  endif
6451.5Stsutsui.endif
6461.23Sjoerg
6471.23Sjoerg${WORKGPT}: ${WORKMBR}
6481.23Sjoerg	@echo create GPT image...
6491.32Stsutsui	${DD} if=${WORKMBR} of=${WORKGPT} \
6501.32Stsutsui	    skip=$$((${IMAGESECTORS} - ${GPTSECTORS})) count=${GPTSECTORS}
6511.23Sjoerg
6521.23Sjoerg.if ${USE_GPT} == "no"
6531.23Sjoerg${IMGBASE}.img:	${WORKLABEL}
6541.1Stsutsui.endif
6551.23Sjoerg
6561.23Sjoerg${IMGBASE}.img:	${TARGET_BLOCKS}
6571.23Sjoerg	${CAT} ${TARGET_BLOCKS} > ${WORKIMG}
6581.23Sjoerg.if ${USE_GPT} != "no"
6591.25Sjmcneill.if ${USE_GPTMBR} != "no"
6601.33Schristos	${TOOL_GPT} ${GPT_TIMESTAMP} ${WORKIMG} biosboot -i 2		\
6611.23Sjoerg	    -c ${.OBJDIR}/${WORKDIR}/usr/mdec/gptmbr.bin
6621.25Sjmcneill.endif
6631.33Schristos	${TOOL_GPT} ${GPT_TIMESTAMP} ${WORKIMG} set -a bootme -i 2
6641.23Sjoerg.endif	# USE_GPT != "no"
6651.1Stsutsui.if ${USE_SUNLABEL} != "no"
6661.1Stsutsui	@echo Creating sun disklabel...
6671.47Stsutsui	${TOOL_AWK} -f ${DISKPROTO2SUNLABEL} < ${WORKLABEL} | \
6681.1Stsutsui	    ${TOOL_SUNLABEL} -nq ${WORKIMG}
6691.1Stsutsui.endif
6701.23Sjoerg.if ${USE_GPT} == "no"
6711.1Stsutsui	${TOOL_DISKLABEL} -R -F ${WORKIMG} ${WORKLABEL}
6721.1Stsutsui.if !empty(PRIMARY_BOOT) && ${INSTALLBOOT_AFTER_DISKLABEL} != "no"
6731.11Sriastrad	${TOOL_INSTALLBOOT} -v -m ${MACHINE} ${INSTALLBOOTOPTIONS} ${WORKIMG} \
6741.1Stsutsui	    ${WORKDIR}/usr/mdec/${PRIMARY_BOOT}
6751.1Stsutsui.endif
6761.23Sjoerg.endif
6771.1Stsutsui	mv ${WORKIMG} ${.TARGET}
6781.1Stsutsui
6791.1StsutsuiCLEANFILES+=	${IMGBASE}.img.gz ${IMGBASE}.img.gz.tmp
6801.1Stsutsui
6811.1Stsutsui${IMGBASE}.img.gz:	${IMGBASE}.img
6821.9Sapb	${TOOL_GZIP_N} -9c ${IMGBASE}.img > ${.TARGET}.tmp
6831.1Stsutsui	mv ${.TARGET}.tmp ${.TARGET}
6841.1Stsutsui
6851.1Stsutsuiclean:
6861.1Stsutsui	@if [ -d ${WORKDIR}/var/spool/ftp/hidden ]; then 		\
6871.1Stsutsui		${CHMOD} +r ${WORKDIR}/var/spool/ftp/hidden;		\
6881.1Stsutsui	fi	# XXX
6891.1Stsutsui	${RM} -fr ${WORKDIR}
6901.23Sjoerg	${RM} -fr ${EFIWORKDIR}
6911.24Stsutsui	${RM} -fr ${WORKFATDIR}
6921.50Stsutsui	${RM} -fr ${WORKMDBOOTPARTDIR}
6931.1Stsutsui
6941.1Stsutsuiprepare_md_post: .PHONY
6951.1Stsutsuiimage_md_post: .PHONY
6961.1Stsutsuiimage_md_pre: .PHONY
6971.1Stsutsui
6981.1Stsutsui.include <bsd.prog.mk>
699