提交 08d3892c 编写于 作者: B Ben Hutchings 提交者: Masahiro Yamada

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: NBen Hutchings <ben@decadent.org.uk>
Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
上级 4260ecd0
...@@ -6,6 +6,18 @@ ...@@ -6,6 +6,18 @@
set -e 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() { set_debarch() {
if [ -n "$KBUILD_DEBARCH" ] ; then if [ -n "$KBUILD_DEBARCH" ] ; then
debarch="$KBUILD_DEBARCH" debarch="$KBUILD_DEBARCH"
...@@ -23,22 +35,18 @@ set_debarch() { ...@@ -23,22 +35,18 @@ set_debarch() {
s390*) s390*)
debarch=s390x ;; debarch=s390x ;;
ppc*) ppc*)
debarch=$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo ppc64el || echo powerpc) ;; debarch=$(if_enabled_echo CPU_LITTLE_ENDIAN ppc64el powerpc) ;;
parisc*) parisc*)
debarch=hppa ;; debarch=hppa ;;
mips*) 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) aarch64|arm64)
debarch=arm64 ;; debarch=arm64 ;;
arm*) arm*)
if grep -q CONFIG_AEABI=y $KCONFIG_CONFIG; then if is_enabled AEABI; then
if grep -q CONFIG_VFP=y $KCONFIG_CONFIG; then debarch=arm$(if_enabled_echo VFP hf el)
debarch=armhf
else
debarch=armel
fi
else else
debarch=arm debarch=arm
fi fi
;; ;;
*) *)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册