mirror of
https://github.com/lgcosta/pf-linux-port.git
synced 2026-11-12 23:38:03 -03:00
kernel-config.sh looked for the tree two levels up and build-kernel.sh did not pass on the tree it had resolved, so a plain ./scripts/build-kernel.sh could configure one tree and build another. Both resolve <repo>/../linux-7.3.4.
23 lines
1.0 KiB
Bash
Executable File
23 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build Linux 7.3.4 (VM-lab config) + collect boot artifacts into out/.
|
|
set -euo pipefail
|
|
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
|
K="${KERNELDIR:-$(cd "$REPO/../linux-7.3.4" && pwd)}"
|
|
cd "$K"
|
|
# kernel-config.sh must configure the *same* tree we are about to build.
|
|
KERNELDIR="$K" "$REPO/scripts/kernel-config.sh" "${1:-}"
|
|
JOBS="${JOBS:-$(($(nproc)-2))}"
|
|
make -j"$JOBS" -s bzImage modules_prepare
|
|
# External module builds need Module.symvers (kbuild only writes
|
|
# vmlinux.symvers) and scripts/module.lds (from modules_prepare above).
|
|
[ -f Module.symvers ] || cp vmlinux.symvers Module.symvers
|
|
[ -f scripts/module.lds ] || { echo "FATAL: scripts/module.lds missing" >&2; exit 1; }
|
|
mkdir -p "$REPO/out"
|
|
KVER="$(make -s kernelversion)"
|
|
cp -f arch/x86/boot/bzImage "$REPO/out/linux-${KVER}-bzImage"
|
|
cp -f System.map "$REPO/out/System.map"
|
|
cp -f .config "$REPO/out/.config"
|
|
make -s kernelrelease > "$REPO/out/kernelversion"
|
|
sha256sum "$REPO/out/linux-${KVER}-bzImage" > "$REPO/out/bzImage.sha256"
|
|
echo "KERNEL_BUILD_OK $(cat "$REPO/out/kernelversion")"
|