3 # helper script to quick build testing with cross-compilers
8 : ${BUILD_NCPUS:=$(getconf _NPROCESSORS_ONLN)}
9 if [ "$BUILD_NCPUS" -gt 1 ] ; then
10 JOBS=-j$((BUILD_NCPUS + 1))
14 MAKE="${MAKE} ${JOBS}"
16 : ${CROSS_COMPILE:=${CROSS_COMPILER_PREFIX}}
28 -e "/${opt}=/s:=.*:=$*:" \
30 echo " ## setconfig ${opt} $*"
36 sh) echo sh4 sh2 sh3 sh1 sh;;
44 for a in $(get_arches $1) ; do
45 for l in uclibc gnu gnueabi "" ; do
46 for v in unknown pc gentoo "" ; do
47 for o in linux uclinux "" ; do
48 t="${a}${v:+-${v}}${o:+-${o}}${l:+-${l}}"
49 if ${t}-gcc --help > /dev/null 2>&1 ; then
61 echo " ## ${MAKE} -s $*"
73 '$0 ~ /^config TARGET_/ { sub("TARGET_",""); print $NF }' \
74 extra/Configs/Config.in | grep -v SUBARCH)
80 if [ -z "${CROSS_COMPILE}" ] ; then
81 CROSS_COMPILE=$(find_compiler ${a})
84 if [ -z "${CROSS_COMPILE}" ] ; then
86 echo " ### SKIP: ${a}: could not find compiler"
90 rm -f ${a}.log ${a}.fail
94 echo " ### Building target ${a} (${CROSS_COMPILE})"
97 do_make ARCH=$a defconfig
100 setconfig CROSS_COMPILER_PREFIX ${CROSS_COMPILE}
102 header_path=${KERNEL_HEADERS:-$(echo '#include <linux/version.h>' | ${CROSS_COMPILE}cpp 2>/dev/null | grep -o '[^"]*linux/version.h')} || :
103 if [ -z "${header_path}" ] ; then
104 for p in /usr/${CROSS_COMPILE%-}/usr/include ; do
105 if [ -e ${p}/linux/version.h ] ; then
110 if [ -z "${header_path}" ] ; then
111 echo " ## unable to locate KERNEL_HEADERS"
114 setconfig KERNEL_HEADERS ${header_path%/linux/version.h}
122 ) 2>&1 | tee ${a}.log
124 if [ -e ${a}.fail ] ; then
134 if [ -n "${skip}" ] ; then
135 printf '\nSKIPPED: %s\n' "${skip}"
137 if [ -n "${fail}" ] ; then
138 printf '\nPASSED: %s\nFAILED: %s\n\n' "${pass}" "${fail}"
141 printf '\nAll arches passed!\n\n'