summaryrefslogtreecommitdiff
path: root/distrib/powerpc/miniroot/Makefile
blob: a9c1a88b186d0bc2219766e5318492315e4bb9e9 (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
#	$NetBSD: Makefile,v 1.1 1995/07/18 04:13:06 briggs Exp $

TOP=		${.CURDIR}/..

.include "${TOP}/Makefile.inc"
IMAGE=		miniroot-${REV}.fs
CRUNCHCONF?=    ${TOP}/miniroot/${CBIN}.conf
BASE=miniroot
KERNEL=		${SRCSYSDIR}/arch/powerpc/compile/MINI/bsd

MOUNT_POINT=	/mnt1
BDEV=		/dev/rd0a
CDEV=		/dev/rrd0a
RDEV=		/dev/rd0c

.include "${TOP}/inst-common/Makefile.inc"

all: ${CBIN} ${IMAGE}
	@echo "all done"

DISKTYPE=       rdroot
NBLKS=          4096
# old format, minfree, opt, b/i  trks, sects, cpg
NEWFSARGS= -t ffs -m 0 -o space -c 16

${IMAGE}:	do_prep do_mount do_files do_umount_copy do_unconfig
	mv -f ${IMAGE}.tmp ${IMAGE}
	if [ -e rd.pid ] ; then \
	kill `< rd.pid`; \
	rm rd.pid;\
	fi

elfrdsetroot:	${TOP}//elfrdsetroot.c
	${HOSTCC} -o elfrdsetroot ${TOP}/elfrdsetroot.c

setroot: ${IMAGE} bsd elfrdsetroot
	elfrdsetroot bsd < ${IMAGE}

bsd:	${KERNEL}
	cp ${KERNEL} bsd

do_prep: ${CBIN} do_unconfig
	sh ${.CURDIR}/start_rdconfig.sh ${RDEV} ${NBLKS}
	dd if=/usr/mdec/sdboot of=${CDEV}
	disklabel -w ${CDEV} ${DISKTYPE}
	
do_mount:
	-newfs ${NEWFSARGS} -s ${NBLKS} ${CDEV} ${DISKTYPE}
	mount ${BDEV} ${MOUNT_POINT}
 
do_umount_copy:
	@echo ""
	@df -i ${MOUNT_POINT}
	@echo ""
	-umount ${MOUNT_POINT}
	dd if=${CDEV} of=${IMAGE}.tmp bs=4b count=`expr ${NBLKS} / 4 `

do_unconfig:
	-umount ${MOUNT_POINT}
	if [ -e rd.pid ] ; then \
	kill `< rd.pid`; \
	rm rd.pid;\
	fi


.PRECIOUS:	${IMAGE}