summaryrefslogtreecommitdiff
path: root/distrib/alpha/ramdisk/Makefile
blob: d038ad1722bd43e0cbe2d8c91933cb54803506bf (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.2 1997/05/07 16:23:05 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
	mv -f ${REALIMAGE} ${IMAGE}

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

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

do_prep: ${CBIN}
	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}
	vnconfig -u ${VND} && cat /*bin/* > /dev/null

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

.PRECIOUS:	${IMAGE}