From 314ba5c8986fac39f5c291faf393cc805b1a6583 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 1 Jul 2026 10:07:25 +0200 Subject: kbuild: add the '--list-profiles' option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- bin/kbuild | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'bin/kbuild') diff --git a/bin/kbuild b/bin/kbuild index 7253d5f..481abad 100755 --- a/bin/kbuild +++ b/bin/kbuild @@ -24,14 +24,8 @@ # 4. Copy into a tarball the resulting image, modules, dtbs, and headers. Two # scripts are bundled in: install.sh and uninstall.sh. # -# You can also pass some options: -# 1. `--skip-config`: 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. `--skip-install`: don't generate the install/uninstall files. -# 3. `-p/--profile`: the kind of machine you are building the kernel for. -# 4. `-l/--local`: this is a local build, just generate install/uninstall scripts. -# 5. `-h/--help`: show the help message. +# You can also pass some additional options, check the -h/--help message to read +# more about them. # # 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 @@ -47,6 +41,14 @@ set -e +KBUILD_CONFIG_PATH="$HOME/.config/kbuild" + +# Helper function to list the available profiles in the system. +list_available_profiles() { + dirs="$(find $KBUILD_CONFIG_PATH/ -mindepth 1 -maxdepth 1 -type d -printf '%P\n' | sort | awk '{printf "%s%s", (NR==1?"":", "), $0} END {print ""}')" + echo "kbuild (info): available profiles: $dirs." +} + ## # Arguments that can be passed. @@ -73,6 +75,10 @@ while [[ $# -gt 0 ]]; do IS_LOCAL=1 shift ;; + --list-profiles) + list_available_profiles + exit 0 + ;; -h | --help) SHOW_HELP=1 shift @@ -99,6 +105,7 @@ following options: -h, --help Show this message. -p, --profile The profile to be picked up. -l, --local This is a local build, just generate install/uninstall files. + --list-profiles List the profiles that are available on the system. --skip-install Don't generate the install/uninstall files. --skip-config Skip the configuration step. HERE @@ -108,19 +115,12 @@ fi ## # Profile select. -KBUILD_CONFIG_PATH="$HOME/.config/kbuild" - # If the configuration directory doesn't exist, create it now. if [ ! -d "$KBUILD_CONFIG_PATH" ]; then echo "kbuild (info): creating the '$KBUILD_CONFIG_PATH' directory." mkdir -p $KBUILD_CONFIG_PATH fi -list_available_profiles() { - dirs="$(find $KBUILD_CONFIG_PATH/ -mindepth 1 -maxdepth 1 -type d -printf '%P\n' | sort | awk '{printf "%s%s", (NR==1?"":", "), $0} END {print ""}')" - echo "kbuild (info): available profiles: $dirs." -} - if [ -z "$PROFILE" ]; then echo "kbuild (error): you have to provide a profile." list_available_profiles -- cgit v1.2.3