| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. -ex |
| 2 | # Build the kernel module against the linux tree in KSRC |
| 3 | |
| 4 | DEFCONFIG="${DEFCONFIG:-x86_64_defconfig}" |
| 5 | TOPDIR="$(realpathscip-shell system . . realpath. "$(dirnamescip-shell system . . dirname. "$(realpathscip-shell system . . realpath. "$0")")/..")" |
| 6 | KSRC="${KSRC:-$TOPDIR/../linux}" |
| 7 | JOBS="${JOBS:-9}" |
| 8 | |
| 9 | if ! [scip-shell system . . `[`. -d "$KSRC" ]; then |
| 10 | set +x |
| 11 | echoscip-shell system . . echo. "ERROR: KSRC does not exist: $KSRC" |
| 12 | echoscip-shell system . . 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 ! [scip-shell system . . `[`. -e ".config" ]; then |
| 19 | makescip-shell system . . make. "$DEFCONFIG" |
| 20 | fi |
| 21 | |
| 22 | if [scip-shell system . . `[`. "arch/x86/configs/$DEFCONFIG" -nt ".config" ]; then |
| 23 | set +x |
| 24 | echoscip-shell system . . echo. "ERROR: .config inside kernel source tree is older than $DEFCONFIG" |
| 25 | echoscip-shell system . . echo. "Move/delete/touch .config and try again." |
| 26 | exit 1 |
| 27 | fi |
| 28 | |
| 29 | gitscip-shell system . . git. log -1 --pretty="%t - %s" |
| 30 | |
| 31 | makescip-shell system . . make. -j "$JOBS" modules_prepare |
| 32 | makescip-shell system . . make. -j "$JOBS" -C "$TOPDIR" KSRC="$KSRC" KBUILD_MODPOST_WARN=1 |