Home | History | Annotate | Line # | Download | only in bootfs
Makefile revision 1.28
      1 #	$NetBSD: Makefile,v 1.28 2001/10/21 23:21:53 jmc Exp $
      2 #
      3 # boot.fs is the image for disk 1 of the two-set floppy based installation
      4 # method.
      5 #
      6 # It is constructed by injecting the microroot filesystem `ramdisk.fs'
      7 # into the md based kernel built from the INSTALL kernel configuration file.
      8 #
      9 
     10 TOP=		${.CURDIR}/..
     11 MINIROOT=	${.CURDIR}/../../miniroot
     12 
     13 .include "${TOP}/Makefile.inc"
     14 
     15 .include <bsd.own.mk>	# So we use /etc/mk.conf.
     16 .include <bsd.kernobj.mk>
     17 
     18 KERN?=		${KERNOBJDIR}/INSTALL/netbsd
     19 
     20 MOUNT_POINT?=	/mnt
     21 VND?=		vnd0
     22 VND_DEV=	/dev/${VND}a
     23 VND_RDEV=	/dev/r${VND}a
     24 VND_CDEV=	/dev/${VND}c
     25 VND_CRDEV=	/dev/r${VND}c
     26 FD?=		fd0
     27 FD_RDEV=	/dev/r${FD}a
     28 IMAGE?=		boot.fs
     29 MDEC=		${DESTDIR}/usr/mdec
     30 OBJCOPY?=	objcopy
     31 
     32 LISTS=		${.CURDIR}/list
     33 RAMDISK!=	cd ${TOP}/ramdisk/; \
     34 		printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}/ramdisk.fs\n" |\
     35 		${MAKE} -s -f-
     36 
     37 # Some reasonable values for the -i parameter to newfs are:
     38 #
     39 #   6144	1147k, 189 inodes free
     40 #  16384	1159k,  93 inodes free
     41 # 204800	1167k,  29 inodes free
     42 INO_BYTES=	204800
     43 
     44 BLOCKSIZE=512
     45 FSSIZE!= expr ${BLOCKSIZE} \* 18 \* 2 \* 80
     46 
     47 GEOM=${BLOCKSIZE}/18/2/80
     48 
     49 CLEANFILES+=	netbsd.ram netbsd.ram.aout netbsd.tmp
     50 
     51 .MAIN: all
     52 
     53 all:	netbsd.ram netbsd.ram.aout
     54 	dd if=/dev/zero of=${IMAGE} bs=${FSSIZE} count=1
     55 	vnconfig -v -c ${VND_CDEV} ${IMAGE} ${GEOM}
     56 	newfs -B be -m 0 -o space -i ${INO_BYTES} -c 80 ${VND_RDEV}
     57 	mount ${VND_DEV} ${MOUNT_POINT}
     58 	gzip -9 < netbsd.ram > ${MOUNT_POINT}/netbsd
     59 	@echo ""
     60 	@df -i ${MOUNT_POINT}
     61 	@echo ""
     62 	@echo "installing new bootblocks"
     63 	-rm -f ${MOUNT_POINT}/boot
     64 	${MDEC}/binstall -m ${MDEC} -f ${IMAGE} -v ffs ${MOUNT_POINT}
     65 	umount ${MOUNT_POINT}
     66 	vnconfig -u ${VND_CDEV}
     67 
     68 unconfig:
     69 	-umount -f ${MOUNT_POINT}
     70 	-vnconfig -u ${VND_DEV}
     71 
     72 netbsd.ram: ${KERN} ${RAMDISK}
     73 	cp ${KERN} netbsd.tmp
     74 	mdsetimage -v netbsd.tmp ${RAMDISK}
     75 	strip netbsd.tmp
     76 	mv netbsd.tmp ${.TARGET}
     77 
     78 
     79 # conjure up a magic header that is accepted by all Sun PROMS;
     80 # see sys/arch/sparc/stand/installboot/installboot.c for details.
     81 SUN_MAGIC_HEADER='\01\03\01\07\060\200\0\07\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'
     82 
     83 netbsd.ram.aout: netbsd.ram
     84 	${OBJCOPY} -O binary ${.ALLSRC} netbsd.ram.raw
     85 	(printf ${SUN_MAGIC_HEADER}; cat netbsd.ram.raw)  > ${.TARGET}
     86 	rm -f netbsd.ram.raw
     87 
     88 clean cleandir distclean:
     89 	/bin/rm -f *.core ${IMAGE} ${CLEANFILES}
     90 
     91 depend install:
     92 
     93 real-floppy:
     94 	dd if=${IMAGE} of=${FD_RDEV} bs=32k
     95 
     96 .ifndef RELEASEDIR
     97 release:
     98 	@echo setenv RELEASEDIR first
     99 	@false
    100 .else
    101 release: $(IMAGE)
    102 	gzip -c -9 < $(.OBJDIR)/boot.fs \
    103 		> $(RELEASEDIR)/installation/bootfs/boot.fs.gz
    104 	gzip -c -9 < $(.OBJDIR)/netbsd.ram.aout \
    105 		> $(RELEASEDIR)/installation/bootfs/netbsd.ram.aout.gz
    106 .endif	# RELEASEDIR check
    107 
    108 .include <bsd.obj.mk>
    109