1 1.1 apb # $NetBSD: Makefile.minirootkmod,v 1.1 2012/10/16 08:19:36 apb Exp $ 2 1.1 apb # 3 1.1 apb # Makefile snippet to build a miniroot kernel module (e.g. miniroot.kmod) 4 1.1 apb # 5 1.1 apb # Required variables: 6 1.1 apb # NETBSDSRCDIR top level of src tree (set by <bsd.own.mk>) 7 1.1 apb # 8 1.1 apb # Optional variables: 9 1.1 apb # MINIROOT Basename of the kernel module to be created. 10 1.1 apb # ".kmod" will be appended to get the file name. 11 1.1 apb # [default: miniroot] 12 1.1 apb # RAMDISK Basename of the ramdisk to be embedded in the 13 1.1 apb # kernel module. This is used as both a directory 14 1.1 apb # name (${.CURDIR}/../ramdisks/${RAMDISK}) and 15 1.1 apb # as a file name within the .OBJDIR of that 16 1.1 apb # directory (${RAMDISK}.fs). [default: ramdisk] 17 1.1 apb # 18 1.1 apb 19 1.1 apb MINIROOT?= miniroot 20 1.1 apb RAMDISK?= ramdisk 21 1.1 apb 22 1.1 apb .include <bsd.own.mk> 23 1.1 apb .include "${.PARSEDIR}/Makefile.distrib" 24 1.1 apb 25 1.1 apb MKMAN= no 26 1.1 apb PROG= ${MINIROOT}.kmod 27 1.1 apb 28 1.1 apb # SRCMOD is a skeleton version of miniroot.kmod, without an embedded ramdisk. 29 1.1 apb # It should already have been created by "make install" in 30 1.1 apb # .../sys/modules/miniroot, and its name includes literal "miniroot", 31 1.1 apb # not variable ${MINIROOT}. 32 1.1 apb # 33 1.1 apb # DSTMOD is a copy of SRCMOD that is modified to include an embedded ramdisk. 34 1.1 apb # It will be created by rules in this Makefile. 35 1.1 apb # 36 1.1 apb # RAMDISKFS is the ramdisk image to be included inside DSTMOD. It should 37 1.1 apb # already have been created by the Makefile in RAMDISKSRCDIR. 38 1.1 apb # 39 1.1 apb SRCMOD= ${DESTDIR}/stand/${MACHINE}/${MODULEVER}/modules/miniroot/miniroot.kmod 40 1.1 apb DSTMOD= ${.OBJDIR}/${MINIROOT}.kmod 41 1.1 apb RAMDISKSRCDIR= ${.CURDIR}/../ramdisks/${RAMDISK} 42 1.1 apb RAMDISKOBJDIR!= cd ${RAMDISKSRCDIR} && ${PRINTOBJDIR} 43 1.1 apb RAMDISKFS= ${RAMDISKOBJDIR}/${RAMDISK}.fs 44 1.1 apb 45 1.1 apb ${MINIROOT}.kmod: ${RAMDISKFS} ${SRCMOD} 46 1.1 apb ${OBJCOPY} --add-section miniroot=${RAMDISKFS} \ 47 1.1 apb --set-section-flags miniroot=alloc,contents,load,data \ 48 1.1 apb ${SRCMOD} ${DSTMOD}.tmp 49 1.1 apb gzip -9nc < ${DSTMOD}.tmp > ${DSTMOD} 50 1.1 apb rm -f ${DSTMOD}.tmp 51 1.1 apb 52 1.1 apb .include <bsd.prog.mk> 53 1.1 apb 54 1.1 apb release: ${PROG} 55 1.1 apb ${HOST_INSTALL_FILE} -m ${BINMODE} ${PROG} \ 56 1.1 apb ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot/ 57