aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xkern8
1 files changed, 8 insertions, 0 deletions
diff --git a/kern b/kern
index cdd2d8d..0f19772 100755
--- a/kern
+++ b/kern
@@ -13,6 +13,10 @@ errx() {
exit 1
}
+need_kernel_source() {
+ test -r Kbuild -a -r Kconfig || errx "current directory does not contain a kernel source tree, refusing"
+}
+
has_boot_mount() {
awk '{print $2}' /etc/fstab | grep -q ^/boot$
}
@@ -65,6 +69,7 @@ set_kernel() {
}
config_kernel() {
+ need_kernel_source
host=${1:-$(hostname)}
test -d "$KERNFRAG" || errx "No such file or directory: $KERNFRAG"
@@ -76,6 +81,7 @@ config_kernel() {
}
diff_kernel() {
+ need_kernel_source
diff=${1:-$(get_running_config)}
if command -v git >/dev/null; then
@@ -86,10 +92,12 @@ diff_kernel() {
}
build_kernel() {
+ need_kernel_source
make -j"$(nproc)"
}
install_kernel() {
+ need_kernel_source
mount_boot_on_demand
sudo make install modules_install
}