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