From 0f24279675846c760c3ad450a1cb8c7d0d79c600 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 20 Aug 2024 23:37:31 +0200 Subject: kbuild: add --no-install MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way the heavy process of creating a tarball can be skipped on silly builds. Signed-off-by: Miquel Sabaté Solà --- bin/kbuild | 76 +++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 33 deletions(-) (limited to 'bin/kbuild') 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 <