Add a new kernel-pkgs target to create pkg(8) packages from the kernel

The version scheme used is the following:
For stable/current branches:
${REVISION}.sYYYYMMDDhhmmss

s standing for snapshot

For releases branches:
${REVISION}_${PATCHLEVEL}

When packaging the kernel 2 different package are created per kernel
release (only contains the regular kernel and modules)
debug (contains the .symbols files)

Note that package the kernel (packaging world will follow the same rule) can
only by passing -DNO_ROOT to the build (hence can be done as a regular user)

To package the kernel:
make buildkernel
make distributekernel DESTDIR=/somewhere -DNO_ROOT
make kernel-pkgs DESTDIR=/somewhere -DNO_ROOT

The packages will be created inside the DESTDIR
This commit is contained in:
Baptiste Daroussin 2015-02-08 18:12:34 +00:00
parent 12501e63f2
commit 183a8eade3

View File

@ -153,6 +153,21 @@ SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE}
.endif
.if !defined(PKG_VERSION)
REVISION!= ${MAKE} -C ${SRCDIR}/release -V REVISION
BRANCH!= ${MAKE} -C ${SRCDIR}/release -V BRANCH
SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
${SRCDIR}/sys/sys/param.h
.if ${BRANCH:MSTABLE*} || ${BRANCH:MCURRENT*}
TIMENOW!= TZ=UTC date +%Y%m%d%H%M%S
EXTRA_REVISION= .s${TIMENOW}
.endif
.if ${BRANCH:M*-p*}
EXTRA_REVISION= _${BRANCH:C/.*-p([0-9]+$)/\1/}
.endif
PKG_VERSION= ${REVISION}${EXTRA_REVISION}
.endif
KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6hf/arm i386 i386/pc98 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
.if ${TARGET} == ${TARGET_ARCH}
_t= ${TARGET}
@ -1165,6 +1180,54 @@ packagekernel:
.endfor
.endif
kernel-pkgs:
.if !defined(NO_ROOT)
@echo "ERROR: kernel-pkgs can only be done with -DNO_ROOT"; \
false
.endif
@cd ${DESTDIR}/${DISTDIR} ; \
awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \
${DESTDIR}/${DISTDIR}/kernel.meta
.for flavor in release debug
.if exists(${DESTDIR}/${DISTDIR}/${flavor}.plist)
@rm -rf ${DESTDIR}/${DISTDIR}/${flavor}-manifestdir
@cp -r ${SRCDIR}/release/packages/kernel \
${DESTDIR}/${DISTDIR}/${flavor}-manifestdir
@cd ${DESTDIR}/${DISTDIR} ; \
sed -i '' -e "s/%VERSION%/${PKG_VERSION}/" \
-e "s/%PKGNAME%/kernel-${flavor}/" \
-e "s/%COMMENT%/FreeBSD ${KERNCONF} kernel ${flavor}/" \
-e "s/%DESC%/FreeBSD ${KERNCONF} kernel ${flavor}/" \
${DESTDIR}/${DISTDIR}/${flavor}-manifestdir/+MANIFEST
@pkg create -v -m ${DESTDIR}/${DISTDIR}/${flavor}-manifestdir \
-p ${DESTDIR}/${DISTDIR}/${flavor}.plist \
-r ${DESTDIR}/${DISTDIR}/kernel \
-o ${DESTDIR}
.endif
.endfor
.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
@cd ${DESTDIR}/${DISTDIR} ; \
awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \
${DESTDIR}/${DISTDIR}/kernel${_kernel}.meta
.for flavor in release debug
.if exists(${DESTDIR}/${DISTDIR}/${flavor}.plist)
@rm -rf ${DESTDIR}/${DISTDIR}/${flavor}-manifestdir
@cp -r ${SRCDIR}/release/packages/kernel \
${DESTDIR}/${DISTDIR}/${flavor}-manifestdir
@cd ${DESTDIR}/${DISTDIR} ; \
sed -i '' -e "s/%VERSION%/${PKG_VERSION}/" \
-e "s/%PKGNAME%/kernel-${flavor}/" \
-e "s/%COMMENT%/FreeBSD ${KERNCONF} kernel ${flavor}/" \
-e "s/%DESC%/FreeBSD ${KERNCONF} kernel ${flavor}/" \
${DESTDIR}/${DISTDIR}/${flavor}-manifestdir/+MANIFEST
@pkg create -v -m ${DESTDIR}/${DISTDIR}/${flavor}-manifestdir \
-p ${DESTDIR}/${DISTDIR}/${flavor}.plist \
-r ${DESTDIR}/${DISTDIR}/kernel.${_kernel} \
-o ${DESTDIR}
.endif
.endfor
.endfor
#
# doxygen
#