From 0f562883509ddaf1cd66d89f36361262b3bd3f83 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 2 Sep 2020 04:54:22 +0300 Subject: kbuild: Support custom make arguments on the command line Add support for passing additional arguments to make. The arguments can be specified after the platform name, or, if no platform name is specified, after an empty option (--). Signed-off-by: Laurent Pinchart --- kbuild.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/kbuild.sh b/kbuild.sh index 697648c..7a87ad9 100755 --- a/kbuild.sh +++ b/kbuild.sh @@ -36,6 +36,7 @@ do_package_deb=0 opt_bootloader= opt_cmdline_file= opt_defconfig= +opt_make_opts= while [[ $# != 0 ]] ; do option=$1 @@ -75,12 +76,19 @@ while [[ $# != 0 ]] ; do --doc) do_compile_doc=1 ;; + --) + platform=auto + ;; --*) echo "Unrecognized option $option" exit 1 ;; *) - platform=$option + if [[ -z "$platform" ]] ; then + platform=$option + else + opt_make_opts="$option $opt_make_opts" + fi ;; esac done @@ -91,7 +99,7 @@ done kcflags="-Werror -Wno-error=cpp" -if [[ -z "$platform" ]] ; then +if [[ -z "$platform" || "$platform" == "auto" ]] ; then for f in $kbuild_root/platforms/*.sh ; do pattern=$(cat $f | grep "dir_pattern=" | head -1) pattern=${pattern/#dir_pattern=/} @@ -146,8 +154,8 @@ esac # num_cpus=$(cat /proc/cpuinfo | grep '^processor\b' | wc -l) -make="make ARCH=$arch O=$output_dir CROSS_COMPILE=${cross_compile[$arch]}" -pmake="$make -j$((num_cpus*2))" +make="make ARCH=$arch O=$output_dir CROSS_COMPILE=${cross_compile[$arch]} ${extra_make_args}" +pmake="$make -j$((num_cpus*2)) $opt_make_opts" echo "Compiling for platform $platform with $num_cpus CPUs" -- cgit v1.2.3