xref: /openbsd/distrib/sparc64/miniroot/Makefile (revision 47fa51d5)
1#	$OpenBSD: Makefile,v 1.13 2019/04/30 17:46:06 deraadt Exp $
2
3FS=		miniroot${OSrev}.fs
4FSSIZE=		5760
5FSDISKTYPE=	fakeramdisk
6MTREE=		${UTILS}/mtree.conf
7MOUNT_POINT=	/mnt
8
9LISTS=		${.CURDIR}/list
10UTILS=		${.CURDIR}/../../miniroot
11
12STRIPOPTS=	-R .SUNW_ctf
13
14MRDISKTYPE=	rdroot
15MRMAKEFSARGS=	-o disklabel=${MRDISKTYPE},minfree=0,density=4096
16
17all: ${FS}
18
19${FS}: bsd.gz
20	dd if=/dev/zero of=${FS} bs=512 count=${FSSIZE}
21	vnconfig -v ${FS} > vnd
22	disklabel -w `cat vnd` ${FSDISKTYPE}
23	newfs -m 0 /dev/r`cat vnd`a
24	mount /dev/`cat vnd`a ${MOUNT_POINT}
25	install -c -m 555 -o root -g wheel bsd.gz ${MOUNT_POINT}/bsd
26	install -c -m 555 -o root -g wheel \
27	    ${DESTDIR}/usr/mdec/ofwbootfd ${MOUNT_POINT}/ofwboot
28	installboot -v -r ${MOUNT_POINT} `cat vnd` \
29	    ${DESTDIR}/usr/mdec/bootblk ${MOUNT_POINT}/ofwboot
30	df -i ${MOUNT_POINT}
31	umount ${MOUNT_POINT}
32	vnconfig -u `cat vnd`
33	rm -f vnd
34
35bsd.gz: bsd.rd
36	gzip -c -9nv < bsd.rd > bsd.gz
37
38bsd.rd: bsd mr.fs
39	cp bsd bsd.rd_unz
40	rdsetroot bsd.rd_unz mr.fs
41	objcopy -Sg -R .comment bsd.rd_unz bsd.rd
42	strip ${STRIPOPTS} bsd.rd
43
44bsd:
45	cd ${.CURDIR}/../../../sys/arch/sparc64/compile/RAMDISK && \
46	    su ${BUILDUSER} -c '${MAKE} config && ${MAKE} clean && exec ${MAKE}'
47	cp -p ${.CURDIR}/../../../sys/arch/sparc64/compile/RAMDISK/obj/bsd bsd
48
49mr.fs: instbin
50	rm -rf $@.d
51	install -d -o root -g wheel $@.d
52	mtree -def ${MTREE} -p $@.d -u
53	CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} OSrev=${OSrev} \
54	    TARGDIR=$@.d UTILS=${UTILS} RELEASEDIR=${RELEASEDIR} \
55	    sh ${UTILS}/runlist.sh ${LISTS}
56	rm $@.d/instbin
57	makefs ${MRMAKEFSARGS} $@ $@.d
58
59instbin.conf: ${LISTS}
60	awk -f ${UTILS}/makeconf.awk  ${LISTS} > instbin.conf
61
62instbin.mk instbin.cache instbin.c: instbin.conf
63	crunchgen -E -D ${.CURDIR}/../../.. -L ${DESTDIR}/usr/lib \
64	    -c instbin.c -e instbin -m instbin.mk instbin.conf
65
66instbin: instbin.mk instbin.cache instbin.c
67	${MAKE} -f instbin.mk SRCLIBDIR=${.CURDIR}/../../../lib all
68
69unconfig:
70	-umount -f ${MOUNT_POINT}
71	-[ -f vnd ] && vnconfig -u `cat vnd` && rm -f vnd
72
73.ifdef RELEASEDIR
74install:
75	cp bsd.rd ${FS} ${RELEASEDIR}
76	chmod a+r ${RELEASEDIR}/bsd.rd
77.endif
78
79clean cleandir:
80	/bin/rm -f *.core mr.fs instbin instbin.mk instbin*.cache \
81	    lib*.a lib*.olist instbin.map \
82	    *.o *.lo *.c bsd bsd.rd{,_unz} bsd.gz bsd.strip ${FS}
83	/bin/rm -rf mr.fs.d
84
85.include <bsd.obj.mk>
86