aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-08-20 23:37:31 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-08-20 23:37:31 +0200
commit0f24279675846c760c3ad450a1cb8c7d0d79c600 (patch)
treea196ceb2962232cbf8b50879f4f7fc587cb19532
parent1f07e5206899fc9a6586e76e9ef920e31d5b5e9b (diff)
downloaddotfiles-0f24279675846c760c3ad450a1cb8c7d0d79c600.tar.gz
dotfiles-0f24279675846c760c3ad450a1cb8c7d0d79c600.zip
kbuild: add --no-install
This way the heavy process of creating a tarball can be skipped on silly builds. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
-rwxr-xr-xbin/kbuild76
1 files changed, 43 insertions, 33 deletions
diff --git a/bin/kbuild b/bin/kbuild
index e5ef36c..f90f93d 100755
--- a/bin/kbuild
+++ b/bin/kbuild
@@ -23,9 +23,11 @@
# 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.
+# You can also pass two options:
+# 1. `-s/--skip-build`: tell to skip the call to `defconfig` and/or
+# `menuconfig`. This is useful if you are just developing over the same
+# `.config` file again and again.
+# 2. `-n/--no-install`: do not prepare the install/uninstall bundle.
#
# 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
@@ -52,6 +54,10 @@ while [[ $# -gt 0 ]]; do
SKIP_CONFIG="t"
shift
;;
+ -n | --no-install)
+ NO_INSTALL="t"
+ shift
+ ;;
-*)
echo "kbuild (error): unknown option '$1'."
exit 1
@@ -140,36 +146,39 @@ make -j "$(nproc)"
##
# Installing into a local bundle.
-name=$(cat include/config/kernel.release)
+if [ -n "$NO_INSTALL" ]; then
+ echo "kbuild (info): done!"
+else
+ name=$(cat include/config/kernel.release)
-if [ -z "$INSTALL_PATH" ]; then
- INSTALL_PATH="buildroot-$name"
-fi
-mkdir -p "$INSTALL_PATH/usr/lib/modules/$name"
-pushd "$INSTALL_PATH" >/dev/null
-ln -s usr/lib lib
-popd >/dev/null
+ if [ -z "$INSTALL_PATH" ]; then
+ INSTALL_PATH="buildroot-$name"
+ fi
+ mkdir -p "$INSTALL_PATH/usr/lib/modules/$name"
+ pushd "$INSTALL_PATH" >/dev/null
+ ln -s usr/lib lib
+ popd >/dev/null
-make modules_install INSTALL_MOD_PATH="$INSTALL_PATH"
-make dtbs_install INSTALL_DTBS_PATH="$INSTALL_PATH/boot/dtbs/$name"
-make headers_install INSTALL_HDR_PATH="$INSTALL_PATH/usr"
+ make modules_install INSTALL_MOD_PATH="$INSTALL_PATH"
+ make dtbs_install INSTALL_DTBS_PATH="$INSTALL_PATH/boot/dtbs/$name"
+ make headers_install INSTALL_HDR_PATH="$INSTALL_PATH/usr"
-unlink "$INSTALL_PATH/lib"
+ unlink "$INSTALL_PATH/lib"
-cp "arch/$ARCH/boot/Image.gz" "$INSTALL_PATH/boot/vmlinuz-$name"
-cp .config "$INSTALL_PATH/boot/config-$name"
+ cp "arch/$ARCH/boot/Image.gz" "$INSTALL_PATH/boot/vmlinuz-$name"
+ cp .config "$INSTALL_PATH/boot/config-$name"
-##
-# Setup install.sh script.
+ ##
+ # Setup install.sh script.
-# Files that are going to be installed. Funnily enough, the pipeline will create
-# the "files.txt" first, so it will show on the `find` output. Hence the stupid
-# workaround you see of moving it in later.
-find "$INSTALL_PATH" -type f -printf "/%P\n" >files.txt
-mv files.txt "$INSTALL_PATH/files.txt"
+ # Files that are going to be installed. Funnily enough, the pipeline will create
+ # the "files.txt" first, so it will show on the `find` output. Hence the stupid
+ # workaround you see of moving it in later.
+ find "$INSTALL_PATH" -type f -printf "/%P\n" >files.txt
+ mv files.txt "$INSTALL_PATH/files.txt"
-# Now write the actual install script.
-cat <<SCRIPT >"$INSTALL_PATH/install.sh"
+ # Now write the actual install script.
+ cat <<SCRIPT >"$INSTALL_PATH/install.sh"
#!/usr/bin/env bash
set -ex
@@ -232,8 +241,8 @@ fi
\$EDITOR /boot/extlinux/extlinux.conf
SCRIPT
-# And the uninstall script.
-cat <<SCRIPT >"$INSTALL_PATH/uninstall.sh"
+ # And the uninstall script.
+ cat <<SCRIPT >"$INSTALL_PATH/uninstall.sh"
#!/usr/bin/env bash
set -ex
@@ -258,10 +267,11 @@ fi
\$EDITOR /boot/extlinux/extlinux.conf
SCRIPT
-##
-# Create tarball.
+ ##
+ # Create tarball.
-tar czf "$INSTALL_PATH.tar.gz" "$INSTALL_PATH"
-rm -r "$INSTALL_PATH"
+ tar czf "$INSTALL_PATH.tar.gz" "$INSTALL_PATH"
+ rm -r "$INSTALL_PATH"
-echo "kbuild (info): your build is now ready at '$INSTALL_PATH.tar.gz'."
+ echo "kbuild (info): your build is now ready at '$INSTALL_PATH.tar.gz'."
+fi