summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-09-02 04:54:22 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-09-02 04:54:22 +0300
commit0f562883509ddaf1cd66d89f36361262b3bd3f83 (patch)
treeff1513e08c99e96b66249ed793c8f706abaa2ef6
parent577e95fce5470b855c6e46540fe041b2de80aa1e (diff)
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 <laurent.pinchart@ideasonboard.com>
-rwxr-xr-xkbuild.sh16
1 files 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"