1133855Sssouhlal#	$OpenBSD: Makefile,v 1.54 2024/01/19 20:06:00 miod Exp $
2133855Sssouhlal
3133855SssouhlalFS=		floppyB${OSrev}.img
4133855SssouhlalFSSIZE=		2880
5133855SssouhlalFSDISKTYPE=	floppy
6133855SssouhlalMOUNT_POINT=	/mnt
7133855SssouhlalMTREE=		${UTILS}/mtree.conf
8133855SssouhlalRAMDISK=	RAMDISKU5
9133855Sssouhlal
10133855SssouhlalLISTS=		${.CURDIR}/list
11133855SssouhlalUTILS=		${.CURDIR}/../../miniroot
12133855Sssouhlal
13133855SssouhlalMRDISKTYPE=	rdroot
14133855SssouhlalMRMAKEFSARGS=	-o disklabel=${MRDISKTYPE},minfree=0,density=8192
15133855Sssouhlal
16133855Sssouhlalall: ${FS}
17133855Sssouhlal
18133855Sssouhlal${FS}: bsd.gz
19133855Sssouhlal	dd if=/dev/zero of=${FS} bs=512 count=${FSSIZE}
20133855Sssouhlal	vnconfig -v -t ${FSDISKTYPE} ${FS} > vnd
21133855Sssouhlal	echo '/ *' | disklabel -wAT- `cat vnd`
22133855Sssouhlal	newfs -O 1 -m 0 -o space -i 524288 -c ${FSSIZE} -b 4096 -f 512 /dev/r`cat vnd`a
23133855Sssouhlal	mount /dev/`cat vnd`a ${MOUNT_POINT}
24133855Sssouhlal	install -c -m 555 -o root -g wheel \
25133855Sssouhlal	    ${DESTDIR}/usr/mdec/ofwboot ${MOUNT_POINT}/ofwboot
26133855Sssouhlal	installboot -v -r ${MOUNT_POINT} `cat vnd` \
27133855Sssouhlal	    ${DESTDIR}/usr/mdec/bootblk ${MOUNT_POINT}/ofwboot
28133855Sssouhlal	install -c -m 555 -o root -g wheel bsd.gz ${MOUNT_POINT}/bsd
29133855Sssouhlal	df -i ${MOUNT_POINT}
30133855Sssouhlal	umount ${MOUNT_POINT}
31133855Sssouhlal	vnconfig -u `cat vnd`
32133855Sssouhlal	rm -f vnd
33133855Sssouhlal
34133855Sssouhlalbsd.gz: bsd.rd
35133855Sssouhlal	objcopy -S -R .SUNW_ctf -R .comment \
36133855Sssouhlal	    -K rd_root_size -K rd_root_image \
37133855Sssouhlal	    bsd.rd bsd.strip
38133855Sssouhlal	gzip -9cn bsd.strip > bsd.gz
39133855Sssouhlal
40133855Sssouhlalbsd.rd: mr.fs
41133855Sssouhlal	cp bsd bsd.rd
42133855Sssouhlal	rdsetroot bsd.rd mr.fs
43133855Sssouhlal
44133855Sssouhlalbsd:
45133855Sssouhlal	cd ${.CURDIR}/../../../sys/arch/${MACHINE}/compile/${RAMDISK} && \
46133855Sssouhlal	    su ${BUILDUSER} -c '${MAKE} config && ${MAKE} clean && exec ${MAKE} ${MFLAGS}'
47133855Sssouhlal	cp -p ${.CURDIR}/../../../sys/arch/${MACHINE}/compile/${RAMDISK}/obj/bsd bsd
48133855Sssouhlal
49133855Sssouhlalmr.fs: instbin bsd
50133855Sssouhlal	rm -rf $@.d
51213383Snwhitehorn	install -d -o root -g wheel $@.d
52133855Sssouhlal	mtree -def ${MTREE} -p $@.d -u
53133855Sssouhlal	CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} OSrev=${OSrev} \
54133855Sssouhlal	    TARGDIR=$@.d UTILS=${UTILS} RELEASEDIR=${RELEASEDIR} \
55133855Sssouhlal	    sh ${UTILS}/runlist.sh ${LISTS}
56133855Sssouhlal	rm $@.d/instbin
57133855Sssouhlal	makefs ${MRMAKEFSARGS} $@ $@.d
58133855Sssouhlal
59133855Sssouhlalinstbin.mk instbin.cache instbin.c: instbin.conf
60133855Sssouhlal	crunchgen -E -D ${.CURDIR}/../../.. -L ${DESTDIR}/usr/lib \
61133855Sssouhlal	    -c instbin.c -e instbin -m instbin.mk instbin.conf
62133855Sssouhlal
63133855Sssouhlalinstbin: instbin.mk instbin.cache instbin.c
64133855Sssouhlal	${MAKE} ${MFLAGS} -f instbin.mk SRCLIBDIR=${.CURDIR}/../../../lib all
65133855Sssouhlal
66133855Sssouhlalinstbin.conf: ${LISTS}
67133855Sssouhlal	awk -f ${UTILS}/makeconf.awk  ${LISTS} > instbin.conf
68190681Snwhitehorn
69133855Sssouhlalunconfig:
70133855Sssouhlal	-umount -f ${MOUNT_POINT}
71133855Sssouhlal	-[ -f vnd ] && vnconfig -u `cat vnd` && rm -f vnd
72213383Snwhitehorn
73213383Snwhitehorn.ifdef RELEASEDIR
74133855Sssouhlalinstall:
75213383Snwhitehorn	cp ${FS} ${RELEASEDIR}
76213383Snwhitehorn.endif
77213383Snwhitehorn
78213383Snwhitehornclean cleandir:
79213383Snwhitehorn	rm -f *.core mr.fs instbin instbin.mk instbin.cache \
80213383Snwhitehorn	    lib*.a lib*.olist instbin.map instbin.conf \
81213383Snwhitehorn	    *.o *.lo *.c bsd bsd.rd bsd.gz bsd.strip ${FS}
82213383Snwhitehorn	rm -rf mr.fs.d
83213383Snwhitehorn
84213383Snwhitehorn.include <bsd.obj.mk>
85217515Sjkim