summaryrefslogtreecommitdiff
path: root/distrib/alpha/ramdisk/Makefile
blob: 5804a3df944300ad148d15542b124fd8f608c3a8 (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
#	$OpenBSD: Makefile,v 1.1 1997/05/07 12:46:54 niklas Exp $

TOP=		${.CURDIR}/..

.include "${TOP}/Makefile.inc"
IMAGE=		ramdisk${REV}.fs
CRUNCHCONF?=    ${TOP}/ramdisk/${CBIN}.conf
BASE=		ramdisk
KERNEL=		${TOP}/../../sys/arch/${MACHINE}/compile/RAMDISK/bsd

MOUNT_POINT=	/mnt

VND?=		vnd0
VND_DEV=	/dev/${VND}a
VND_RDEV=	/dev/r${VND}a
VND_CRDEV=	/dev/r${VND}c
PID!=		echo $$$$
REALIMAGE!=	echo /tmp/image.${PID}

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

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

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

setroot: ${IMAGE} bsd ecoffrdsetroot
	${.OBJDIR}/ecoffrdsetroot bsd < ${IMAGE}

${IMAGE}:	do_prep do_mount do_files do_umount unconfig
	mv -f ${REALIMAGE} ${IMAGE}

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

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

do_prep: ${CBIN} unconfig
	dd if=/dev/zero of=${REALIMAGE} count=${NBLKS}
	vnconfig -v -c ${VND} ${REALIMAGE}
	disklabel -w -r ${VND} ${DISKTYPE}
	
do_mount:
	-newfs ${NEWFSARGS} -s ${NBLKS} ${VND_RDEV} ${DISKTYPE}
	mount ${VND_DEV} ${MOUNT_POINT}
 
do_umount:
	@echo ""
	@df -i ${MOUNT_POINT}
	@echo ""
	-umount ${MOUNT_POINT}

unconfig:
	-umount ${MOUNT_POINT}
	-vnconfig -u ${VND} && cat /*bin/* > /dev/null
	-rm -f ${REALIMAGE}

.PRECIOUS:	${IMAGE}