diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2018-07-26 11:21:01 +0100 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-07-28 10:53:44 +0900 |
commit | 08d3892cdcea7e918106bd78be5471d05b000b30 (patch) | |
tree | 9a11a878262ed5fccb3fa47a90a3dce15d90f0ce /scripts/package | |
parent | 4260ecd0ad8c10cef8ff6551267bb351e10f70c9 (diff) | |
download | linux-08d3892cdcea7e918106bd78be5471d05b000b30.tar.gz linux-08d3892cdcea7e918106bd78be5471d05b000b30.tar.bz2 linux-08d3892cdcea7e918106bd78be5471d05b000b30.zip |
builddeb: Introduce functions to simplify kconfig tests in set_debarch
We now have many repetitive greps over the kernel config. Refactor
them into functions.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/package')
-rwxr-xr-x | scripts/package/mkdebian | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index f4449b575379..ada3c73d1493 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -6,6 +6,18 @@ set -e +is_enabled() { + grep -q "^CONFIG_$1=y" $KCONFIG_CONFIG +} + +if_enabled_echo() { + if is_enabled "$1"; then + echo -n "$2" + elif [ $# -ge 3 ]; then + echo -n "$3" + fi +} + set_debarch() { if [ -n "$KBUILD_DEBARCH" ] ; then debarch="$KBUILD_DEBARCH" @@ -23,22 +35,18 @@ set_debarch() { s390*) debarch=s390x ;; ppc*) - debarch=$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo ppc64el || echo powerpc) ;; + debarch=$(if_enabled_echo CPU_LITTLE_ENDIAN ppc64el powerpc) ;; parisc*) debarch=hppa ;; mips*) - debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el || true) ;; + debarch=mips$(if_enabled_echo CPU_LITTLE_ENDIAN el) ;; aarch64|arm64) debarch=arm64 ;; arm*) - if grep -q CONFIG_AEABI=y $KCONFIG_CONFIG; then - if grep -q CONFIG_VFP=y $KCONFIG_CONFIG; then - debarch=armhf - else - debarch=armel - fi + if is_enabled AEABI; then + debarch=arm$(if_enabled_echo VFP hf el) else - debarch=arm + debarch=arm fi ;; *) |