summaryrefslogtreecommitdiff
path: root/distrib/pc532/floppies/inst-common/Makefile.inc
blob: cac1045fafdf13aa30a90727436e98195353de4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#	$Id: Makefile.inc,v 1.1 1995/10/18 08:37:42 deraadt Exp $ 

# TOP is assumed to be defined by Makefile including this one.

CBIN=		instbin
COMMONDIR=	${TOP}/inst-common

MOUNT_POINT?=	/mnt
VND?=		vnd0
VND_DEV=	/dev/${VND}a
VND_RDEV=	/dev/r${VND}a
IMAGE?=		xxx-${REV}.fs
MDEC=		${DESTDIR}/usr/mdec

LISTS=		${COMMONDIR}/list ${.CURDIR}/list
CRUNCHCONF=	${COMMONDIR}/${CBIN}.conf
MTREE=		${COMMONDIR}/mtree.conf
ADIR=		${TOP}/../../../sys/arch/pc532
PWDSRC=		${TOP}/../../../usr.sbin/pwd_mkdb
.if exists(${PWDSRC}/obj)
PWDOBJ=		${PWDSRC}/obj
.else
PWDOBJ=		${PWDSRC}
.endif

all: netbsd
	dd if=/dev/zero of=${IMAGE} bs=18k count=80
	disklabel -r -w ${.OBJDIR}/${IMAGE} boot3 2>/dev/null
	-yes|bim -c init -c "add ${MDEC}/boot boot" -c "default 0" \
	    -c "exit" ${.OBJDIR}/${IMAGE} 2>/dev/null >/dev/null
	vnconfig -v -c ${VND_DEV} ${IMAGE}
	newfs -b 8192 -f 1024 -O -m 0 -o space -i 204800 -c 80 ${VND_RDEV} boot3
	mount ${VND_DEV} ${MOUNT_POINT}
	cp netbsd ${MOUNT_POINT}/netbsd
	@df -i ${MOUNT_POINT}
	@echo ""
	umount ${MOUNT_POINT}
	vnconfig -u ${VND_DEV}

inject.fs: ${CBIN} ${LISTS} netbsd.gz 
	(cd ${PWDSRC}; ${MAKE})
	${CC} -static -o pwd_mkdb ${PWDOBJ}/*.o
	dd if=/dev/zero of=${.TARGET} bs=128k count=16
	vnconfig -v -c ${VND_DEV} ${.TARGET}
	newfs -b 8192 -f 1024 -O -m 0 -o space -i 7168 ${VND_RDEV} rd
	mount ${VND_DEV} ${MOUNT_POINT}
	mtree -def ${MTREE} -p ${MOUNT_POINT}/ -u
	TOPDIR=${TOP} CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} \
	    TARGDIR=${MOUNT_POINT} sh ${TOP}/runlist.sh ${LISTS}
	@echo ""
	@df -i ${MOUNT_POINT}
	@echo ""
	umount ${MOUNT_POINT}
	vnconfig -u ${VND_DEV}

unconfig:
	-umount -f ${MOUNT_POINT}
	-vnconfig -u ${VND_DEV}
	-/bin/rm -f ${IMAGE}

${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CRUNCHCONF}
	crunchgen -D ${TOP}/../../.. -L ${DESTDIR}/usr/lib ${CRUNCHCONF}

${CBIN}: ${CBIN}.mk ${CBIN}.cache ${CBIN}.c
	make -f ${CBIN}.mk all

cloak: ${COMMONDIR}/cloak.c

inject: ${COMMONDIR}/inject.c

netbsd.gz:
	gzip -9 <${ADIR}/compile/DEFAULT/netbsd >netbsd.gz
#	cp ${ADIR}/compile/DEFAULT/netbsd /var/tmp/$$$$; \
#		strip /var/tmp/$$$$; \
#		gzip -9 </var/tmp/$$$$ >netbsd.gz; \
#		rm /var/tmp/$$$$


netbsd.o: inject cloak inject.fs
	cp ${ADIR}/compile/INSTALL/netbsd /var/tmp/$$$$; \
		strip /var/tmp/$$$$; \
		./inject /var/tmp/$$$$ inject.fs; \
		gzip -9 </var/tmp/$$$$ | ./cloak >netbsd.o; \
		rm /var/tmp/$$$$

go.o: ${COMMONDIR}/go.c

netbsd: netbsd.o go.o
	ld -s -z -T 240000 -e _go go.o netbsd.o ${MDEC}/zboot.o -o netbsd

clean cleandir:
	/bin/rm -f core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache *.o *.lo *.c
	/bin/rm -f netbsd* inject* cloak pwd_mkdb

.include <bsd.obj.mk>
.include <bsd.subdir.mk>