Module Name: src
Committed By: apb
Date: Tue Oct 16 08:19:37 UTC 2012
Modified Files:
src/distrib/amd64/kmod: Makefile
src/distrib/i386/kmod: Makefile
Added Files:
src/distrib/common: Makefile.minirootkmod
Log Message:
Add distrib/common/Makefile.minirootkmod. Apart from comments and the
conversion of some constants to variables, this is identical to the code
that was previously present in both distrib/amd64/kmod/Makefile and
distrib/i386/kmod/Makefile.
Change distrib/amd64/kmod/Makefile and distrib/i386/kmod/Makefile to just
set some variables and .include "../../common/Makefile.minirootkmod".
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/amd64/kmod/Makefile
cvs rdiff -u -r0 -r1.1 src/distrib/common/Makefile.minirootkmod
cvs rdiff -u -r1.11 -r1.12 src/distrib/i386/kmod/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/amd64/kmod/Makefile
diff -u src/distrib/amd64/kmod/Makefile:1.2 src/distrib/amd64/kmod/Makefile:1.3
--- src/distrib/amd64/kmod/Makefile:1.2 Fri Feb 17 00:33:24 2012
+++ src/distrib/amd64/kmod/Makefile Tue Oct 16 08:19:37 2012
@@ -1,27 +1,6 @@
-# $NetBSD: Makefile,v 1.2 2012/02/17 00:33:24 riz Exp $
+# $NetBSD: Makefile,v 1.3 2012/10/16 08:19:37 apb Exp $
-.include <bsd.own.mk>
-.include "../../common/Makefile.distrib"
-
-MKMAN= no
-PROG= miniroot.kmod
-
-SRCMOD= ${DESTDIR}/stand/${MACHINE}/${MODULEVER}/modules/miniroot/miniroot.kmod
-DSTMOD= ${.OBJDIR}/miniroot.kmod
+MINIROOT= miniroot
RAMDISK= ramdisk
-RAMDISKDIR!= cd ${.CURDIR}/../ramdisks/${RAMDISK} && ${PRINTOBJDIR}
-RAMDISKFS= ${RAMDISKDIR}/${RAMDISK}.fs
-
-miniroot.kmod: ${RAMDISKFS} ${SRCMOD}
- ${OBJCOPY} --add-section miniroot=${RAMDISKFS} \
- --set-section-flags miniroot=alloc,contents,load,data \
- ${SRCMOD} ${DSTMOD}.tmp
- gzip -9nc < ${DSTMOD}.tmp > ${DSTMOD}
- rm -f ${DSTMOD}.tmp
-
-.include <bsd.prog.mk>
-
-release: miniroot.kmod
- ${HOST_INSTALL_FILE} -m ${BINMODE} ${PROG} \
- ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot/
+.include "../../common/Makefile.minirootkmod"
Index: src/distrib/i386/kmod/Makefile
diff -u src/distrib/i386/kmod/Makefile:1.11 src/distrib/i386/kmod/Makefile:1.12
--- src/distrib/i386/kmod/Makefile:1.11 Fri Feb 17 00:33:25 2012
+++ src/distrib/i386/kmod/Makefile Tue Oct 16 08:19:37 2012
@@ -1,27 +1,6 @@
-# $NetBSD: Makefile,v 1.11 2012/02/17 00:33:25 riz Exp $
+# $NetBSD: Makefile,v 1.12 2012/10/16 08:19:37 apb Exp $
-.include <bsd.own.mk>
-.include "../../common/Makefile.distrib"
-
-MKMAN= no
-PROG= miniroot.kmod
-
-SRCMOD= ${DESTDIR}/stand/${MACHINE}/${MODULEVER}/modules/miniroot/miniroot.kmod
-DSTMOD= ${.OBJDIR}/miniroot.kmod
+MINIROOT= miniroot
RAMDISK= ramdisk-big
-RAMDISKDIR!= cd ${.CURDIR}/../ramdisks/${RAMDISK} && ${PRINTOBJDIR}
-RAMDISKFS= ${RAMDISKDIR}/${RAMDISK}.fs
-
-miniroot.kmod: ${RAMDISKFS} ${SRCMOD}
- ${OBJCOPY} --add-section miniroot=${RAMDISKFS} \
- --set-section-flags miniroot=alloc,contents,load,data \
- ${SRCMOD} ${DSTMOD}.tmp
- gzip -9nc < ${DSTMOD}.tmp > ${DSTMOD}
- rm -f ${DSTMOD}.tmp
-
-.include <bsd.prog.mk>
-
-release: miniroot.kmod
- ${HOST_INSTALL_FILE} -m ${BINMODE} ${PROG} \
- ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot/
+.include "../../common/Makefile.minirootkmod"
Added files:
Index: src/distrib/common/Makefile.minirootkmod
diff -u /dev/null src/distrib/common/Makefile.minirootkmod:1.1
--- /dev/null Tue Oct 16 08:19:37 2012
+++ src/distrib/common/Makefile.minirootkmod Tue Oct 16 08:19:36 2012
@@ -0,0 +1,56 @@
+# $NetBSD: Makefile.minirootkmod,v 1.1 2012/10/16 08:19:36 apb Exp $
+#
+# Makefile snippet to build a miniroot kernel module (e.g. miniroot.kmod)
+#
+# Required variables:
+# NETBSDSRCDIR top level of src tree (set by <bsd.own.mk>)
+#
+# Optional variables:
+# MINIROOT Basename of the kernel module to be created.
+# ".kmod" will be appended to get the file name.
+# [default: miniroot]
+# RAMDISK Basename of the ramdisk to be embedded in the
+# kernel module. This is used as both a directory
+# name (${.CURDIR}/../ramdisks/${RAMDISK}) and
+# as a file name within the .OBJDIR of that
+# directory (${RAMDISK}.fs). [default: ramdisk]
+#
+
+MINIROOT?= miniroot
+RAMDISK?= ramdisk
+
+.include <bsd.own.mk>
+.include "${.PARSEDIR}/Makefile.distrib"
+
+MKMAN= no
+PROG= ${MINIROOT}.kmod
+
+# SRCMOD is a skeleton version of miniroot.kmod, without an embedded ramdisk.
+# It should already have been created by "make install" in
+# .../sys/modules/miniroot, and its name includes literal "miniroot",
+# not variable ${MINIROOT}.
+#
+# DSTMOD is a copy of SRCMOD that is modified to include an embedded ramdisk.
+# It will be created by rules in this Makefile.
+#
+# RAMDISKFS is the ramdisk image to be included inside DSTMOD. It should
+# already have been created by the Makefile in RAMDISKSRCDIR.
+#
+SRCMOD= ${DESTDIR}/stand/${MACHINE}/${MODULEVER}/modules/miniroot/miniroot.kmod
+DSTMOD= ${.OBJDIR}/${MINIROOT}.kmod
+RAMDISKSRCDIR= ${.CURDIR}/../ramdisks/${RAMDISK}
+RAMDISKOBJDIR!= cd ${RAMDISKSRCDIR} && ${PRINTOBJDIR}
+RAMDISKFS= ${RAMDISKOBJDIR}/${RAMDISK}.fs
+
+${MINIROOT}.kmod: ${RAMDISKFS} ${SRCMOD}
+ ${OBJCOPY} --add-section miniroot=${RAMDISKFS} \
+ --set-section-flags miniroot=alloc,contents,load,data \
+ ${SRCMOD} ${DSTMOD}.tmp
+ gzip -9nc < ${DSTMOD}.tmp > ${DSTMOD}
+ rm -f ${DSTMOD}.tmp
+
+.include <bsd.prog.mk>
+
+release: ${PROG}
+ ${HOST_INSTALL_FILE} -m ${BINMODE} ${PROG} \
+ ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot/