| 1 | #!/bin/sh -ex |
| 2 | # Build the kernel module against the linux tree in KSRC |
| 3 | |
| 4 | DEFCONFIG="${DEFCONFIG:-x86_64_defconfig}" |
| 5 | TOPDIR="$(realpath "$(dirname "$(realpath "$0")")/..")" |
| 6 | KSRC="${KSRC:-$TOPDIR/../linux}" |
| 7 | JOBS="${JOBS:-9}" |
| 8 | |
| 9 | if ! [ -d "$KSRC" ]; then |
| 10 | set +x |
| 11 | echo "ERROR: KSRC does not exist: $KSRC" |
| 12 | echo "Let the KSRC env var point at a linux source tree and try again." |
| 13 | exit 1 |
| 14 | fi |
| 15 | |
| 16 | cd "$KSRC" |
| 17 | |
| 18 | if ! [ -e ".config" ]; then |
| 19 | make "$DEFCONFIG" |
| 20 | fi |
| 21 | |
| 22 | if [ "arch/x86/configs/$DEFCONFIG" -nt ".config" ]; then |
| 23 | set +x |
| 24 | echo "ERROR: .config inside kernel source tree is older than $DEFCONFIG" |
| 25 | echo "Move/delete/touch .config and try again." |
| 26 | exit 1 |
| 27 | fi |
| 28 | |
| 29 | git log -1 --pretty="%t - %s" |
| 30 | |
| 31 | make -j "$JOBS" modules_prepare |
| 32 | make -j "$JOBS" -C "$TOPDIR" KSRC="$KSRC" KBUILD_MODPOST_WARN=1 |