aboutsummaryrefslogtreecommitdiff
path: root/bin/kbuild
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-08-19 08:57:59 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-08-19 08:57:59 +0200
commitc097d87de7a48f34d577fc41acdfdbcf79c8197c (patch)
treee3f0d60fba40f3727abe65f6f0e6d594ac6425fb /bin/kbuild
parent8418d908e3c3a6e7b0b455b804c5178221b57292 (diff)
downloaddotfiles-c097d87de7a48f34d577fc41acdfdbcf79c8197c.tar.gz
dotfiles-c097d87de7a48f34d577fc41acdfdbcf79c8197c.zip
kbuild: add the `-s/--skip-build` option
This allows me to skip the defconfig/menuconfig over and over again when writing a patch. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'bin/kbuild')
-rwxr-xr-xbin/kbuild93
1 files changed, 60 insertions, 33 deletions
diff --git a/bin/kbuild b/bin/kbuild
index 1c7ed11..e5ef36c 100755
--- a/bin/kbuild
+++ b/bin/kbuild
@@ -23,6 +23,10 @@
# 4. Copy into a tarball the resulting image, modules, dtbs, and headers. An
# install.sh script is also bundled in.
#
+# You can also pass the option `-s/--skip-build`, which skips the call to
+# `defconfig` and/or `menuconfig`. This is useful if you are just developing
+# over the same `.config` file again and again.
+#
# After that just send the resulting tarball to the machine where you want to
# install this kernel. In there you just need to untar the given bundle and then
# run the `install.sh` script from within the resulting directory. This will:
@@ -33,14 +37,33 @@
# *NOTE*: this script expects the `ARCH` environment variable to be set, and if
# that doesn't match the current architecture, then it will expect to have
# `CROSS_COMPILE` set as well.
-# *NOTE*: because of the funny machines I'm testing this in, only Debian was
-# tested. Hence, we assume tools such as `update-initramfs` exist instead of
-# using `dracut`.
+# *NOTE*: we assume that either `update-initramfs` or `dracut` exist. If you are
+# using something else, send me a patch.
#####
set -e
##
+# Arguments that can be passed.
+
+while [[ $# -gt 0 ]]; do
+ case $1 in
+ -s | --skip-config)
+ SKIP_CONFIG="t"
+ shift
+ ;;
+ -*)
+ echo "kbuild (error): unknown option '$1'."
+ exit 1
+ ;;
+ *)
+ echo "kbuild (warning): argument '$1' will be ignored."
+ shift # past argument
+ ;;
+ esac
+done
+
+##
# Initial checks.
# Most of the times, we are safer if we just set the `ARCH` env. variable.
@@ -72,37 +95,41 @@ fi
##
# .config
-if [ ! -f ".config" ]; then
- echo "kbuild (info): no '.config' file found"
- make defconfig
-fi
-
-config_options=("From a default configuration (defconfig)" "From an existing .config file")
-echo "kconfig (info): how do you want to configure the build?"
-PS3="> "
-select _opt in "${config_options[@]}" "Quit"; do
- case "$REPLY" in
- 1)
+if [ -z "$SKIP_CONFIG" ]; then
+ if [ ! -f ".config" ]; then
+ echo "kbuild (info): no '.config' file found"
make defconfig
- echo "kbuild (info): running 'menuconfig' to double check."
- make menuconfig
- break
- ;;
- 2)
- echo "kbuild (info): running 'menuconfig' to double check."
- make menuconfig
- break
- ;;
- 3)
- echo "kbuild (info): bye!"
- exit 0
- ;;
- *)
- echo "kbuild (info): not an option. Try again..."
- continue
- ;;
- esac
-done
+ fi
+
+ config_options=("From a default configuration (defconfig)" "From an existing .config file")
+ echo "kconfig (info): how do you want to configure the build?"
+ PS3="> "
+ select _opt in "${config_options[@]}" "Quit"; do
+ case "$REPLY" in
+ 1)
+ make defconfig
+ echo "kbuild (info): running 'menuconfig' to double check."
+ make menuconfig
+ break
+ ;;
+ 2)
+ echo "kbuild (info): running 'menuconfig' to double check."
+ make menuconfig
+ break
+ ;;
+ 3)
+ echo "kbuild (info): bye!"
+ exit 0
+ ;;
+ *)
+ echo "kbuild (info): not an option. Try again..."
+ continue
+ ;;
+ esac
+ done
+else
+ echo "kbuild (info): skipping configuration step..."
+fi
##
# Build the kernel.