| 1 |
#!/bin/sh -eu |
| 2 |
|
| 3 |
KERNEL_RELEASE="$1" |
| 4 |
|
| 5 |
mkdir "$AUTOPKGTEST_TMP"/foo |
| 6 |
cat >"$AUTOPKGTEST_TMP"/foo/foo.c <<EOF |
| 7 |
#include <linux/kernel.h> |
| 8 |
#include <linux/module.h> |
| 9 |
|
| 10 |
static int __init foo_init(void) |
| 11 |
{ |
| 12 |
pr_info("foo initialised\n"); |
| 13 |
return 0; |
| 14 |
} |
| 15 |
module_init(foo_init); |
| 16 |
|
| 17 |
static void __exit foo_exit(void) |
| 18 |
{ |
| 19 |
} |
| 20 |
module_exit(foo_exit); |
| 21 |
|
| 22 |
MODULE_LICENSE("GPL"); |
| 23 |
MODULE_DESCRIPTION(""); |
| 24 |
EOF |
| 25 |
cat >"$AUTOPKGTEST_TMP"/foo/Kbuild <<EOF |
| 26 |
obj-m += foo.o |
| 27 |
EOF |
| 28 |
|
| 29 |
echo "I: Build for $KERNEL_RELEASE" |
| 30 |
# Next, run the build with stdout sent to the original stdout and |
| 31 |
# stderr sent through tee to both the original stdout and a file |
| 32 |
make -C /lib/modules/"$KERNEL_RELEASE"/build M="$AUTOPKGTEST_TMP"/foo V=1 |
| 33 |
|
| 34 |
echo "I: Clean" |
| 35 |
make -C /lib/modules/"$KERNEL_RELEASE"/build M="$AUTOPKGTEST_TMP"/foo V=1 clean |