mirror of
https://github.com/vyos/vyos-build.git
synced 2025-10-01 20:28:40 +02:00
The shim review board (which is the secure boot base loader) recommends using ephemeral keys when signing the Linux Kernel. This commit enables the Kernel build system to generate a one-time ephemeral key that is used to: * sign all build-in Kernel modules * sign all other out-of-tree Kernel modules The key lives in /tmp and is destroyed after the build container exits and is named: "VyOS build time autogenerated kernel key". In addition the Kernel now uses CONFIG_MODULE_SIG_FORCE. This now makes it unable to load any Kernel Module to the image that is NOT signed by the ephemeral key.
51 lines
1.2 KiB
Bash
Executable File
51 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
CWD=$(pwd)
|
|
KERNEL_VAR_FILE=${CWD}/kernel-vars
|
|
|
|
ACCEL_SRC=${CWD}/accel-ppp
|
|
if [ ! -d ${ACCEL_SRC} ]; then
|
|
echo "Accel-PPP source not found"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f ${KERNEL_VAR_FILE} ]; then
|
|
echo "Kernel variable file '${KERNEL_VAR_FILE}' does not exist, run ./build_kernel.sh first"
|
|
exit 1
|
|
fi
|
|
|
|
cd ${ACCEL_SRC}
|
|
git reset --hard HEAD
|
|
git clean --force -d -x
|
|
|
|
PATCH_DIR=${CWD}/patches/accel-ppp
|
|
if [ -d $PATCH_DIR ]; then
|
|
cd ${ACCEL_SRC}
|
|
for patch in $(ls ${PATCH_DIR})
|
|
do
|
|
echo "I: Apply patch: ${PATCH_DIR}/${patch}"
|
|
patch -p1 < ${PATCH_DIR}/${patch}
|
|
done
|
|
fi
|
|
|
|
. ${KERNEL_VAR_FILE}
|
|
mkdir -p ${ACCEL_SRC}/build
|
|
cd ${ACCEL_SRC}/build
|
|
|
|
echo "I: Build Accel-PPP Debian package"
|
|
cmake -DBUILD_IPOE_DRIVER=TRUE \
|
|
-DBUILD_VLAN_MON_DRIVER=TRUE \
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
-DKDIR=${KERNEL_DIR} \
|
|
-DLUA=5.3 \
|
|
-DMODULES_KDIR=${KERNEL_VERSION}${KERNEL_SUFFIX} \
|
|
-DCPACK_TYPE=Debian12 ..
|
|
make
|
|
|
|
# Sign generated Kernel modules
|
|
${CWD}/sign-modules.sh .
|
|
|
|
cpack -G DEB
|
|
|
|
# rename resulting Debian package according git description
|
|
mv accel-ppp*.deb ${CWD}/accel-ppp_$(git describe --always --tags)_$(dpkg --print-architecture).deb
|