ext-toolchain.sh 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. #!/usr/bin/env bash
  2. #
  3. # Script for various external toolchain tasks, refer to
  4. # the --help output for more information.
  5. #
  6. # Copyright (C) 2012 Jo-Philipp Wich <[email protected]>
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. CC=""
  22. CXX=""
  23. CPP=""
  24. CFLAGS=""
  25. TOOLCHAIN="."
  26. LIBC_TYPE=""
  27. GCC_VERSION=""
  28. # Library specs
  29. LIB_SPECS="
  30. c: ld-* lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}
  31. rt: librt-* librt
  32. pthread: libpthread-* libpthread
  33. stdcpp: libstdc++
  34. thread_db: libthread-db
  35. gcc: libgcc_s
  36. ssp: libssp
  37. gfortran: libgfortran
  38. gomp: libgomp
  39. atomic: libatomic
  40. quadmath: libquadmath
  41. asan: libasan
  42. tasan: libtsan
  43. lasan: liblsan
  44. ubasan: libubsan
  45. "
  46. # Binary specs
  47. BIN_SPECS="
  48. ldd: ldd
  49. ldconfig: ldconfig
  50. gdb: gdb
  51. gdbserver: gdbserver
  52. "
  53. OVERWRITE_CONFIG=""
  54. test_c() {
  55. cat <<-EOT | "${CC:-false}" $CFLAGS -o /dev/null -x c - 2>/dev/null
  56. #include <stdio.h>
  57. int main(int argc, char **argv)
  58. {
  59. printf("Hello, world!\n");
  60. return 0;
  61. }
  62. EOT
  63. }
  64. test_cxx() {
  65. cat <<-EOT | "${CXX:-false}" $CFLAGS -o /dev/null -x c++ - 2>/dev/null
  66. #include <iostream>
  67. using namespace std;
  68. int main()
  69. {
  70. cout << "Hello, world!" << endl;
  71. return 0;
  72. }
  73. EOT
  74. }
  75. test_softfloat() {
  76. cat <<-EOT | "$CC" $CFLAGS -msoft-float -o /dev/null -x c - 2>/dev/null
  77. int main(int argc, char **argv)
  78. {
  79. double a = 0.1;
  80. double b = 0.2;
  81. double c = (a + b) / (a * b);
  82. return 1;
  83. }
  84. EOT
  85. }
  86. test_uclibc() {
  87. local sysroot="$("$CC" $CFLAGS -print-sysroot 2>/dev/null)"
  88. if [ -d "${sysroot:-$TOOLCHAIN}" ]; then
  89. local lib
  90. for lib in "${sysroot:-$TOOLCHAIN}"/{lib,usr/lib,usr/local/lib}/ld*-uClibc*.so*; do
  91. if [ -f "$lib" ] && [ ! -h "$lib" ]; then
  92. return 0
  93. fi
  94. done
  95. fi
  96. return 1
  97. }
  98. test_feature() {
  99. local feature="$1"; shift
  100. # find compilers, libc type
  101. probe_cc
  102. probe_cxx
  103. probe_libc
  104. # common toolchain feature tests
  105. case "$feature" in
  106. c) test_c; return $? ;;
  107. c++) test_cxx; return $? ;;
  108. soft*) test_softfloat; return $? ;;
  109. esac
  110. # assume eglibc/glibc supports all libc features
  111. if [ "$LIBC_TYPE" != "uclibc" ]; then
  112. return 0
  113. fi
  114. # uclibc feature tests
  115. local inc
  116. local sysroot="$("$CC" "$@" -muclibc -print-sysroot 2>/dev/null)"
  117. for inc in "include" "usr/include" "usr/local/include"; do
  118. local conf="${sysroot:-$TOOLCHAIN}/$inc/bits/uClibc_config.h"
  119. if [ -f "$conf" ]; then
  120. case "$feature" in
  121. lfs) grep -q '__UCLIBC_HAS_LFS__ 1' "$conf"; return $?;;
  122. ipv6) grep -q '__UCLIBC_HAS_IPV6__ 1' "$conf"; return $?;;
  123. rpc) grep -q '__UCLIBC_HAS_RPC__ 1' "$conf"; return $?;;
  124. locale) grep -q '__UCLIBC_HAS_LOCALE__ 1' "$conf"; return $?;;
  125. wchar) grep -q '__UCLIBC_HAS_WCHAR__ 1' "$conf"; return $?;;
  126. threads) grep -q '__UCLIBC_HAS_THREADS__ 1' "$conf"; return $?;;
  127. esac
  128. fi
  129. done
  130. return 1
  131. }
  132. find_libs() {
  133. local spec="$(echo "$LIB_SPECS" | sed -ne "s#^[[:space:]]*$1:##ip")"
  134. # glibc doesn't have libcrypt since 2.39
  135. if [ "$LIBC_TYPE" = "glibc" ]; then
  136. spec=$(printf '%s' "${spec}" | sed 's/,crypt,//')
  137. fi
  138. if [ -n "$spec" ] && probe_cpp; then
  139. local libdir libdirs
  140. for libdir in $(
  141. "$CPP" $CFLAGS -v -x c /dev/null 2>&1 | \
  142. sed -ne 's#:# #g; s#^LIBRARY_PATH=##p'
  143. ); do
  144. if [ -d "$libdir" ]; then
  145. libdirs="$libdirs $(cd "$libdir"; pwd)/"
  146. fi
  147. done
  148. local pattern
  149. for pattern in $(eval echo $spec); do
  150. find $libdirs -name "$pattern.so*" | sort -u
  151. done
  152. return 0
  153. fi
  154. return 1
  155. }
  156. find_bins() {
  157. local spec="$(echo "$BIN_SPECS" | sed -ne "s#^[[:space:]]*$1:##ip")"
  158. if [ -n "$spec" ] && probe_cpp; then
  159. local sysroot="$("$CPP" -print-sysroot)"
  160. local bindir bindirs
  161. for bindir in $(
  162. echo "${sysroot:-$TOOLCHAIN}/bin";
  163. echo "${sysroot:-$TOOLCHAIN}/usr/bin";
  164. echo "${sysroot:-$TOOLCHAIN}/usr/local/bin";
  165. "$CPP" $CFLAGS -v -x c /dev/null 2>&1 | \
  166. sed -ne 's#:# #g; s#^COMPILER_PATH=##p'
  167. ); do
  168. if [ -d "$bindir" ]; then
  169. bindirs="$bindirs $(cd "$bindir"; pwd)/"
  170. fi
  171. done
  172. local pattern
  173. for pattern in $(eval echo $spec); do
  174. find $bindirs -name "$pattern" | sort -u
  175. done
  176. return 0
  177. fi
  178. return 1
  179. }
  180. find_gcc_version() {
  181. if [ -f $TOOLCHAIN/info.mk ]; then
  182. GCC_VERSION=$(grep GCC_VERSION $TOOLCHAIN/info.mk | sed 's/GCC_VERSION=//')
  183. return 0
  184. fi
  185. echo "Warning! Can't find info.mk, trying to detect with alternative way."
  186. # Very fragile detection
  187. GCC_VERSION=$(find $TOOLCHAIN/bin | grep -oE "gcc-[0-9]+\.[0-9]+\.[0-9]+$" | \
  188. head -1 | sed 's/gcc-//')
  189. }
  190. wrap_bin_cc() {
  191. local out="$1"
  192. local bin="$2"
  193. echo '#!/bin/sh' > "$out"
  194. echo 'for arg in "$@"; do' >> "$out"
  195. echo ' case "$arg" in -l*|-L*|-shared|-static)' >> "$out"
  196. echo -n ' exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+' >> "$out"
  197. echo -n '-idirafter "$STAGING_DIR/usr/include" ' >> "$out"
  198. echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
  199. echo '-Wl,-rpath-link,"$STAGING_DIR/usr/lib"} "$@" ;;' >> "$out"
  200. echo ' esac' >> "$out"
  201. echo 'done' >> "$out"
  202. echo -n 'exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+' >> "$out"
  203. echo '-idirafter "$STAGING_DIR/usr/include"} "$@"' >> "$out"
  204. chmod +x "$out"
  205. }
  206. wrap_bin_ld() {
  207. local out="$1"
  208. local bin="$2"
  209. echo '#!/bin/sh' > "$out"
  210. echo -n 'exec "'"$bin"'" ${STAGING_DIR:+' >> "$out"
  211. echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
  212. echo '-rpath-link "$STAGING_DIR/usr/lib"} "$@"' >> "$out"
  213. chmod +x "$out"
  214. }
  215. wrap_bin_other() {
  216. local out="$1"
  217. local bin="$2"
  218. echo '#!/bin/sh' > "$out"
  219. echo 'exec "'"$bin"'" "$@"' >> "$out"
  220. chmod +x "$out"
  221. }
  222. wrap_bins() {
  223. if probe_cc; then
  224. mkdir -p "$1" || return 1
  225. local cmd
  226. for cmd in "${CC%-*}-"*; do
  227. if [ -x "$cmd" ]; then
  228. local out="$1/${cmd##*/}"
  229. local bin="$cmd"
  230. if [ -x "$out" ] && ! grep -q STAGING_DIR "$out"; then
  231. mv "$out" "$out.bin"
  232. bin='$(dirname "$0")/'"${out##*/}"'.bin'
  233. fi
  234. case "${cmd##*/}" in
  235. *-gcc-ar|*-gcc-nm|*-gcc-ranlib)
  236. wrap_bin_other "$out" "$bin"
  237. ;;
  238. *-*cc|*-*cc-*|*-*++|*-*++-*|*-cpp)
  239. wrap_bin_cc "$out" "$bin"
  240. ;;
  241. *-ld)
  242. wrap_bin_ld "$out" "$bin"
  243. ;;
  244. *)
  245. wrap_bin_other "$out" "$bin"
  246. ;;
  247. esac
  248. fi
  249. done
  250. return 0
  251. fi
  252. return 1
  253. }
  254. print_config() {
  255. local mktarget="$1"
  256. local mksubtarget
  257. local target="$("$CC" $CFLAGS -dumpmachine)"
  258. local version="$("$CC" $CFLAGS -dumpversion)"
  259. local cpuarch="${target%%-*}"
  260. # get CC; strip version; strip gcc and add - suffix
  261. local prefix="${CC##*/}"; prefix="${prefix%-$version}"; prefix="${prefix%-*}-"
  262. local config="${0%/scripts/*}/.config"
  263. # if no target specified, print choice list and exit
  264. if [ -z "$mktarget" ]; then
  265. # prepare metadata
  266. if [ ! -f "${0%/scripts/*}/tmp/.targetinfo" ]; then
  267. "${0%/*}/scripts/config/mconf" prepare-tmpinfo
  268. fi
  269. local mktargets=$(
  270. sed -ne "
  271. /^Target: / { h };
  272. /^Target-Arch: $cpuarch\$/ { x; s#^Target: ##p }
  273. " "${0%/scripts/*}/tmp/.targetinfo" | sort -u
  274. )
  275. for mktarget in $mktargets; do
  276. case "$mktarget" in */*)
  277. mktargets=$(echo "$mktargets" | sed -e "/^${mktarget%/*}\$/d")
  278. esac
  279. done
  280. if [ -n "$mktargets" ]; then
  281. echo "Available targets:" >&2
  282. echo $mktargets >&2
  283. else
  284. echo -e "Could not find a suitable OpenWrt target for " >&2
  285. echo -e "CPU architecture '$cpuarch' - you need to " >&2
  286. echo -e "define one first!" >&2
  287. fi
  288. return 1
  289. fi
  290. # bail out if there is a .config already
  291. if [ -f "$config" ]; then
  292. if [ "$OVERWRITE_CONFIG" == "" ]; then
  293. echo "There already is a .config file, refusing to overwrite!" >&2
  294. return 1
  295. else
  296. echo "There already is a .config file, trying to overwrite!"
  297. fi
  298. fi
  299. case "$mktarget" in */*)
  300. mksubtarget="${mktarget#*/}"
  301. mktarget="${mktarget%/*}"
  302. ;; esac
  303. if [ ! -f "$config" ]; then
  304. touch "$config"
  305. fi
  306. echo "CONFIG_TARGET_${mktarget}=y" >> "$config"
  307. if [ -n "$mksubtarget" ]; then
  308. echo "CONFIG_TARGET_${mktarget}_${mksubtarget}=y" >> "$config"
  309. fi
  310. if test_feature "softfloat"; then
  311. echo "CONFIG_SOFT_FLOAT=y" >> "$config"
  312. else
  313. echo "# CONFIG_SOFT_FLOAT is not set" >> "$config"
  314. fi
  315. if test_feature "ipv6"; then
  316. echo "CONFIG_IPV6=y" >> "$config"
  317. else
  318. echo "# CONFIG_IPV6 is not set" >> "$config"
  319. fi
  320. if test_feature "locale"; then
  321. echo "CONFIG_BUILD_NLS=y" >> "$config"
  322. else
  323. echo "# CONFIG_BUILD_NLS is not set" >> "$config"
  324. fi
  325. echo "CONFIG_DEVEL=y" >> "$config"
  326. echo "CONFIG_EXTERNAL_TOOLCHAIN=y" >> "$config"
  327. echo "CONFIG_TOOLCHAIN_ROOT=\"$TOOLCHAIN\"" >> "$config"
  328. echo "CONFIG_TOOLCHAIN_PREFIX=\"$prefix\"" >> "$config"
  329. echo "CONFIG_TARGET_NAME=\"$target\"" >> "$config"
  330. if [ -f "$config" ]; then
  331. sed -i '/CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL/d' "$config"
  332. sed -i '/CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC/d' "$config"
  333. fi
  334. if [ "$LIBC_TYPE" == glibc ]; then
  335. echo "CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC=y" >> "$config"
  336. elif [ "$LIBC_TYPE" == musl ]; then
  337. echo "CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL=y" >> "$config"
  338. else
  339. echo "Can't detect LIBC type. Aborting!" >&2
  340. return 1
  341. fi
  342. if [ -n "$GCC_VERSION" ]; then
  343. echo "CONFIG_EXTERNAL_GCC_VERSION=\"$GCC_VERSION\"" >> "$config"
  344. else
  345. echo "Can't detect GCC version. Aborting!" >&2
  346. return 1
  347. fi
  348. local lib
  349. for lib in C RT PTHREAD GCC STDCPP SSP GFORTRAN GOMP ATOMIC QUADMATH ASAN TSAN LSAN UBSAN; do
  350. local file
  351. local spec=""
  352. local llib="$(echo "$lib" | sed -e 's#.*#\L&#')"
  353. for file in $(find_libs "$lib"); do
  354. spec="${spec:+$spec }$(echo "$file" | sed -e "s#^$TOOLCHAIN#.#")"
  355. done
  356. if [ -n "$spec" ]; then
  357. echo "CONFIG_PACKAGE_lib${llib}=y" >> "$config"
  358. echo "CONFIG_LIB${lib}_FILE_SPEC=\"$spec\"" >> "$config"
  359. else
  360. echo "# CONFIG_PACKAGE_lib${llib} is not set" >> "$config"
  361. fi
  362. done
  363. local bin
  364. for bin in LDD LDCONFIG; do
  365. local file
  366. local spec=""
  367. local lbin="$(echo "$bin" | sed -e 's#.*#\L&#')"
  368. for file in $(find_bins "$bin"); do
  369. spec="${spec:+$spec }$(echo "$file" | sed -e "s#^$TOOLCHAIN#.#")"
  370. done
  371. if [ -n "$spec" ]; then
  372. echo "CONFIG_PACKAGE_${lbin}=y" >> "$config"
  373. echo "CONFIG_${bin}_FILE_SPEC=\"$spec\"" >> "$config"
  374. else
  375. echo "# CONFIG_PACKAGE_${lbin} is not set" >> "$config"
  376. fi
  377. done
  378. # inflate
  379. make -C "${0%/scripts/*}" defconfig
  380. return 0
  381. }
  382. probe_cc() {
  383. if [ -z "$CC" ]; then
  384. local bin
  385. for bin in "bin" "usr/bin" "usr/local/bin"; do
  386. local cmd
  387. for cmd in "$TOOLCHAIN/$bin/"*-*cc*; do
  388. if [ -x "$cmd" ] && [ ! -h "$cmd" ]; then
  389. CC="$(cd "${cmd%/*}"; pwd)/${cmd##*/}"
  390. return 0
  391. fi
  392. done
  393. done
  394. return 1
  395. fi
  396. return 0
  397. }
  398. probe_cxx() {
  399. if [ -z "$CXX" ]; then
  400. local bin
  401. for bin in "bin" "usr/bin" "usr/local/bin"; do
  402. local cmd
  403. for cmd in "$TOOLCHAIN/$bin/"*-*++*; do
  404. if [ -x "$cmd" ] && [ ! -h "$cmd" ]; then
  405. CXX="$(cd "${cmd%/*}"; pwd)/${cmd##*/}"
  406. return 0
  407. fi
  408. done
  409. done
  410. return 1
  411. fi
  412. return 0
  413. }
  414. probe_cpp() {
  415. if [ -z "$CPP" ]; then
  416. local bin
  417. for bin in "bin" "usr/bin" "usr/local/bin"; do
  418. local cmd
  419. for cmd in "$TOOLCHAIN/$bin/"*-cpp*; do
  420. if [ -x "$cmd" ] && [ ! -h "$cmd" ]; then
  421. CPP="$(cd "${cmd%/*}"; pwd)/${cmd##*/}"
  422. return 0
  423. fi
  424. done
  425. done
  426. return 1
  427. fi
  428. return 0
  429. }
  430. probe_libc() {
  431. if [ -f $TOOLCHAIN/info.mk ]; then
  432. LIBC_TYPE=$(grep LIBC_TYPE $TOOLCHAIN/info.mk | sed 's/LIBC_TYPE=//')
  433. return 0
  434. fi
  435. echo "Warning! Can't find info.mk, trying to detect with alternative way."
  436. if [ -z "$LIBC_TYPE" ]; then
  437. if test_uclibc; then
  438. LIBC_TYPE="uclibc"
  439. else
  440. LIBC_TYPE="glibc"
  441. fi
  442. fi
  443. return 0
  444. }
  445. while [ -n "$1" ]; do
  446. arg="$1"; shift
  447. case "$arg" in
  448. --toolchain)
  449. [ -d "$1" ] || {
  450. echo "Toolchain directory '$1' does not exist." >&2
  451. exit 1
  452. }
  453. TOOLCHAIN="$(cd "$1"; pwd)"; shift
  454. ;;
  455. --cflags)
  456. CFLAGS="${CFLAGS:+$CFLAGS }$1"; shift
  457. ;;
  458. --print-libc)
  459. if probe_cc; then
  460. probe_libc
  461. echo "$LIBC_TYPE"
  462. exit 0
  463. fi
  464. echo "No C compiler found in '$TOOLCHAIN'." >&2
  465. exit 1
  466. ;;
  467. --print-target)
  468. if probe_cc; then
  469. exec "$CC" $CFLAGS -dumpmachine
  470. fi
  471. echo "No C compiler found in '$TOOLCHAIN'." >&2
  472. exit 1
  473. ;;
  474. --print-bin)
  475. if [ -z "$1" ]; then
  476. echo "Available programs:" >&2
  477. echo $(echo "$BIN_SPECS" | sed -ne 's#:.*$##p') >&2
  478. exit 1
  479. fi
  480. find_bins "$1" || exec "$0" --toolchain "$TOOLCHAIN" --print-bin
  481. exit 0
  482. ;;
  483. --print-libs)
  484. if [ -z "$1" ]; then
  485. echo "Available libraries:" >&2
  486. echo $(echo "$LIB_SPECS" | sed -ne 's#:.*$##p') >&2
  487. exit 1
  488. fi
  489. find_libs "$1" || exec "$0" --toolchain "$TOOLCHAIN" --print-libs
  490. exit 0
  491. ;;
  492. --test)
  493. test_feature "$1"
  494. exit $?
  495. ;;
  496. --wrap)
  497. [ -n "$1" ] || exec "$0" --help
  498. wrap_bins "$1"
  499. exit $?
  500. ;;
  501. --overwrite-config)
  502. OVERWRITE_CONFIG=y
  503. ;;
  504. --config)
  505. if probe_cc; then
  506. probe_libc
  507. find_gcc_version
  508. print_config "$1"
  509. exit $?
  510. fi
  511. echo "No C compiler found in '$TOOLCHAIN'." >&2
  512. exit 1
  513. ;;
  514. -h|--help)
  515. me="$(basename "$0")"
  516. echo -e "\nUsage:\n" >&2
  517. echo -e " $me --toolchain {directory} --print-libc" >&2
  518. echo -e " Print the libc implementation and exit.\n" >&2
  519. echo -e " $me --toolchain {directory} --print-target" >&2
  520. echo -e " Print the GNU target name and exit.\n" >&2
  521. echo -e " $me --toolchain {directory} --print-bin {program}" >&2
  522. echo -e " Print executables belonging to given program," >&2
  523. echo -e " omit program argument to get a list of names.\n" >&2
  524. echo -e " $me --toolchain {directory} --print-libs {library}" >&2
  525. echo -e " Print shared objects belonging to given library," >&2
  526. echo -e " omit library argument to get a list of names.\n" >&2
  527. echo -e " $me --toolchain {directory} --test {feature}" >&2
  528. echo -e " Test given feature, exit code indicates success." >&2
  529. echo -e " Possible features are 'c', 'c++', 'softfloat'," >&2
  530. echo -e " 'lfs', 'rpc', 'ipv6', 'wchar', 'locale' and " >&2
  531. echo -e " 'threads'.\n" >&2
  532. echo -e " $me --toolchain {directory} --wrap {directory}" >&2
  533. echo -e " Create wrapper scripts for C and C++ compiler, " >&2
  534. echo -e " linker, assembler and other key executables in " >&2
  535. echo -e " the directory given with --wrap.\n" >&2
  536. echo -e " $me --toolchain {directory} --config {target}" >&2
  537. echo -e " Analyze the given toolchain and print a suitable" >&2
  538. echo -e " .config for the given target. Omit target " >&2
  539. echo -e " argument to get a list of names.\n" >&2
  540. echo -e " $me --help" >&2
  541. echo -e " Display this help text and exit.\n\n" >&2
  542. echo -e " Most commands also take a --cflags parameter which " >&2
  543. echo -e " is used to specify C flags to be passed to the " >&2
  544. echo -e " cross compiler when performing tests." >&2
  545. echo -e " This parameter may be repeated multiple times." >&2
  546. echo -e " Use --overwrite-config before --config to overwrite" >&2
  547. echo -e " an already present config with the required changes.">&2
  548. exit 1
  549. ;;
  550. *)
  551. echo "Unknown argument '$arg'" >&2
  552. exec $0 --help
  553. ;;
  554. esac
  555. done
  556. exec $0 --help