* [PATCH v2] MAKEALL: make it generic
@ 2010-09-27 6:12 Jean-Christophe PLAGNIOL-VILLARD
2010-09-27 14:35 ` Sascha Hauer
2010-10-01 3:19 ` [PATCH v3] " Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 2 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-09-27 6:12 UTC (permalink / raw)
To: barebox
add MAKEALL.cfg example
it's allow you to compile specific defconfig or ARCH or all
as
CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL at91sam9263ek_defconfig
CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL
or via config
CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL at91sam9263ek_defconfig
CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL
and for all
CONFIG=./MAKEALL.cfg ./MAKEALL
you can specify
JOBS jobs
BUILDDIR build dir
LOGDIR log dir
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
v2:
remove example
but not use ${LOGDIR:=log} as it not sh
add total compile time
Best Regards,
J.
MAKEALL | 214 +++++++++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 154 insertions(+), 60 deletions(-)
diff --git a/MAKEALL b/MAKEALL
index dd0f66b..739163a 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -1,89 +1,183 @@
-#!/bin/bash
+#!/bin/sh
-check_pipe_status() {
- for i in "${PIPESTATUS[@]}"; do
- [ $i -gt 0 ] && return 1
- done
- return 0
-}
+# Print statistics when we exit
+trap exit 1 2 3 15
+trap print_stats 0
+# Keep track of the number of builds and errors
+nb_errors=0
+errors_list=""
+nb_defconfigs=0
+ret=0
-HERE=$(pwd)
-AUTOBUILD_DIR=${HERE}/autobuild
-REPORT=${AUTOBUILD_DIR}/REPORT
+here=$(pwd)
-if [ -d "${AUTOBUILD_DIR}" ]; then
- echo "warning: ${AUTOBUILD_DIR} exists, press <ctrl-c> to exit or wait for 3 seconds"
- sleep 3
- rm -fr ${AUTOBUILD_DIR}
-fi
+time_start=$(date +%s)
-mkdir -p ${AUTOBUILD_DIR}
+#-----------------------------------------------------------------------
-BOARDS="${BOARDS} sandbox"
-sandbox_ARCH=sandbox
-sandbox_CROSS_COMPILE=
+print_stats() {
+ echo ""
+ echo "--------------------- SUMMARY ----------------------------"
+ echo "defconfigs compiled: ${nb_defconfigs}"
+ time_stop=$(date +%s)
+ time_diff=$((${time_stop} - ${time_start}))
+ printf "compiled in %4is\n" ${time_diff}
+ if [ ${nb_errors} -gt 0 ] ; then
+ echo "defcongids with warnings or errors: ${nb_errors} (${errors_list} )"
+ fi
+ echo "----------------------------------------------------------"
+
+ exit ${ret}
+}
-BOARDS="${BOARDS} ipe337"
-ipe337_ARCH=blackfin
-ipe337_CROSS_COMPILE=bfin-elf-
+if [ ! "${JOBS}" ] ; then
+ #linux, BSD, MacOS
+ nb_cpu=`getconf _NPROCESSORS_ONLN`
+
+ if [ $? -gt 0 ]
+ then
+ nb_cpu=1
+ fi
-BOARDS="${BOARDS} netx_nxdb500"
-netx_nxdb500_ARCH=arm
-netx_nxdb500_CROSS_COMPILE=arm-v4t-linux-gnueabi-
+ JOBS=$((${nb_cpu} * 2))
+fi
-BOARDS="${BOARDS} pcm030"
-pcm030_ARCH=ppc
-pcm030_CROSS_COMPILE=powerpc-603e-linux-gnu-
+if [ ! "${LOGDIR}" ]
+then
+ LOGDIR="log"
+fi
-BOARDS="${BOARDS} pcm037"
-pcm037_ARCH=arm
-pcm037_CROSS_COMPILE=arm-1136jfs-linux-gnueabi-
+if [ ! "${BUILDDIR}" ]
+then
+ BUILDDIR="makeall_builddir"
+fi
-BOARDS="${BOARDS} pcm038"
-pcm038_ARCH=arm
-pcm038_CROSS_COMPILE=arm-v4t-linux-gnueabi-
+[ -d "${LOGDIR}" ] || mkdir ${LOGDIR} || exit 1
-for board in ${BOARDS}; do
+if [ ! "${CONFIG}" ] && [ ! "${CROSS_COMPILE}" ]
+then
+ echo "You need to specify a CONFIG or a CROSS_COMPILE"
+ exit 1
+fi
- time_start=$(date +%s)
- arch=${board}_ARCH
- cross_compile=${board}_CROSS_COMPILE
- mkdir -p ${AUTOBUILD_DIR}/${board}
- printf "%-20s defconfig: " ${board} | tee -a ${REPORT}
+if [ "${CONFIG}" ]
+then
+ source "${CONFIG}"
+fi
- make -C ${HERE} \
- O=${AUTOBUILD_DIR}/${board} \
- ARCH=${!arch} \
- ${board}_defconfig \
- > ${AUTOBUILD_DIR}/${board}.log 2>&1
+check_pipe_status() {
+ for i in "${PIPESTATUS[@]}"
+ do
+ [ $i -gt 0 ] && return 1
+ done
+ return 0
+}
+do_build_target() {
+ local arch=$1
+ local target=$2
+ local target_time_start=$(date +%s)
+ local log_report="${LOGDIR}/${target}/report.log"
+ local log_err="${LOGDIR}/${target}/errors.log"
+
+ rm -rf "${BUILDDIR}"
+ mkdir -p "${BUILDDIR}"
+ mkdir -p "${LOGDIR}/${target}"
+ printf "Building ${arch} ${target} \n" >&2 | tee -a "${log_report}"
+
+ cross_compile=`eval echo '$CROSS_COMPILE_'${target}`
+ if [ ! "${cross_compile}" ]
+ then
+ cross_compile=`eval echo '$CROSS_COMPILE_'${arch}`
+ if [ ! "${cross_compile}" ]
+ then
+ cross_compile=${CROSS_COMPILE}
+ fi
+ fi
+
+ MAKE="make -C ${here} CROSS_COMPILE=${cross_compile} ARCH=${arch} O=${BUILDDIR}"
+ ${MAKE} -j${JOBS} ${target} 2>&1 > "${log_report}" | tee "${log_err}"
+
+ printf "Configure: " | tee -a "${log_report}"
check_pipe_status
if [ "$?" = "0" ]; then
+ printf "OK \n" | tee -a "${log_report}"
- printf "OK " | tee -a ${REPORT}
- printf "compile: " ${board} | tee -a ${REPORT}
+ ${MAKE} -j${JOBS} -s 2>&1 >> "${log_report}" | tee -a "${log_err}"
- make -C ${HERE} \
- O=${AUTOBUILD_DIR}/${board} \
- ARCH=${!arch} \
- CROSS_COMPILE=${!cross_compile} \
- > ${AUTOBUILD_DIR}/${board}.log 2>&1
+ printf "Compile: " ${target} | tee -a "${log_report}"
check_pipe_status
if [ "$?" = "0" ]; then
- printf "OK " | tee -a ${REPORT}
+ printf "OK \n" | tee -a "${log_report}"
+ ${cross_compile}size ${BUILDDIR}/barebox | tee -a "${log_report}"
else
- printf "FAILED " | tee -a ${REPORT}
+ printf "FAILED \n" | tee -a "${log_report}"
+ ret=1
fi
+ else
+ printf "FAILED \n" | tee -a "${log_report}"
+ printf "Compile: ------ \n" | tee -a "${log_report}"
+ ret=1
+ fi
+ if [ -s "${log_err}" ] ; then
+ nb_errors=$((nb_errors + 1))
+ errors_list="${errors_list} ${target}"
else
- printf "FAILED " | tee -a ${REPORT}
- printf "compile: ------ " | tee -a ${REPORT}
+ rm "${log_err}"
fi
- time_stop=$(date +%s)
- time_diff=$(($time_stop - $time_start))
- printf "%4is\n" $time_diff | tee -a ${REPORT}
-done
+ nb_defconfigs=$((nb_defconfigs + 1))
+
+ target_time_stop=$(date +%s)
+ target_time_diff=$((${target_time_stop} - ${target_time_start}))
+ printf "Compiled in %4is\n" ${target_time_diff} | tee -a "${log_report}"
+}
+
+do_build() {
+ local arch=$1
+
+ for i in arch/${arch}/configs/*_defconfig
+ do
+ local target=$(basename $i)
+
+ do_build_target ${arch} ${target}
+ done
+}
+do_build_all() {
+ local build_target=0
+
+ for i in arch/*
+ do
+ local arch=$(basename $i)
+
+ if [ -d $i ]
+ then
+ do_build ${arch}
+ build_target=$((build_target + 1))
+ fi
+ done
+
+ return $build_target
+}
+
+if [ ! "${ARCH}" ] || [ ! -d arch/${ARCH} ]
+then
+ do_build_all
+ if [ $? -eq 0 ]
+ then
+ echo "You need to specify the ARCH or CROSS_COMPILE_<arch> or CROSS_COMPILE_<target> in your config file"
+ exit 1
+ fi
+ exit 0
+fi
+
+if [ $# -eq 0 ]
+then
+ do_build ${ARCH}
+else
+ do_build_target ${ARCH} $1
+fi
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] MAKEALL: make it generic
2010-09-27 6:12 [PATCH v2] MAKEALL: make it generic Jean-Christophe PLAGNIOL-VILLARD
@ 2010-09-27 14:35 ` Sascha Hauer
2010-09-27 16:02 ` Jean-Christophe PLAGNIOL-VILLARD
2010-10-01 3:19 ` [PATCH v3] " Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2010-09-27 14:35 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Mon, Sep 27, 2010 at 08:12:34AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> add MAKEALL.cfg example
>
> it's allow you to compile specific defconfig or ARCH or all
> as
> CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL
>
> or via config
>
> CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL
>
> and for all
>
> CONFIG=./MAKEALL.cfg ./MAKEALL
>
> you can specify
> JOBS jobs
> BUILDDIR build dir
> LOGDIR log dir
Would be good to have this example somewhere in the code, maybe as help
text in MAKEALL
Sascha
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> v2:
>
> remove example
>
> but not use ${LOGDIR:=log} as it not sh
>
> add total compile time
>
> Best Regards,
> J.
> MAKEALL | 214 +++++++++++++++++++++++++++++++++++++++++++++------------------
> 1 files changed, 154 insertions(+), 60 deletions(-)
>
> diff --git a/MAKEALL b/MAKEALL
> index dd0f66b..739163a 100755
> --- a/MAKEALL
> +++ b/MAKEALL
> @@ -1,89 +1,183 @@
> -#!/bin/bash
> +#!/bin/sh
>
> -check_pipe_status() {
> - for i in "${PIPESTATUS[@]}"; do
> - [ $i -gt 0 ] && return 1
> - done
> - return 0
> -}
> +# Print statistics when we exit
> +trap exit 1 2 3 15
> +trap print_stats 0
>
> +# Keep track of the number of builds and errors
> +nb_errors=0
> +errors_list=""
> +nb_defconfigs=0
> +ret=0
>
> -HERE=$(pwd)
> -AUTOBUILD_DIR=${HERE}/autobuild
> -REPORT=${AUTOBUILD_DIR}/REPORT
> +here=$(pwd)
>
> -if [ -d "${AUTOBUILD_DIR}" ]; then
> - echo "warning: ${AUTOBUILD_DIR} exists, press <ctrl-c> to exit or wait for 3 seconds"
> - sleep 3
> - rm -fr ${AUTOBUILD_DIR}
> -fi
> +time_start=$(date +%s)
>
> -mkdir -p ${AUTOBUILD_DIR}
> +#-----------------------------------------------------------------------
>
> -BOARDS="${BOARDS} sandbox"
> -sandbox_ARCH=sandbox
> -sandbox_CROSS_COMPILE=
> +print_stats() {
> + echo ""
> + echo "--------------------- SUMMARY ----------------------------"
> + echo "defconfigs compiled: ${nb_defconfigs}"
> + time_stop=$(date +%s)
> + time_diff=$((${time_stop} - ${time_start}))
> + printf "compiled in %4is\n" ${time_diff}
> + if [ ${nb_errors} -gt 0 ] ; then
> + echo "defcongids with warnings or errors: ${nb_errors} (${errors_list} )"
> + fi
> + echo "----------------------------------------------------------"
> +
> + exit ${ret}
> +}
>
> -BOARDS="${BOARDS} ipe337"
> -ipe337_ARCH=blackfin
> -ipe337_CROSS_COMPILE=bfin-elf-
> +if [ ! "${JOBS}" ] ; then
> + #linux, BSD, MacOS
> + nb_cpu=`getconf _NPROCESSORS_ONLN`
> +
> + if [ $? -gt 0 ]
> + then
> + nb_cpu=1
> + fi
>
> -BOARDS="${BOARDS} netx_nxdb500"
> -netx_nxdb500_ARCH=arm
> -netx_nxdb500_CROSS_COMPILE=arm-v4t-linux-gnueabi-
> + JOBS=$((${nb_cpu} * 2))
> +fi
>
> -BOARDS="${BOARDS} pcm030"
> -pcm030_ARCH=ppc
> -pcm030_CROSS_COMPILE=powerpc-603e-linux-gnu-
> +if [ ! "${LOGDIR}" ]
> +then
> + LOGDIR="log"
> +fi
>
> -BOARDS="${BOARDS} pcm037"
> -pcm037_ARCH=arm
> -pcm037_CROSS_COMPILE=arm-1136jfs-linux-gnueabi-
> +if [ ! "${BUILDDIR}" ]
> +then
> + BUILDDIR="makeall_builddir"
> +fi
>
> -BOARDS="${BOARDS} pcm038"
> -pcm038_ARCH=arm
> -pcm038_CROSS_COMPILE=arm-v4t-linux-gnueabi-
> +[ -d "${LOGDIR}" ] || mkdir ${LOGDIR} || exit 1
>
> -for board in ${BOARDS}; do
> +if [ ! "${CONFIG}" ] && [ ! "${CROSS_COMPILE}" ]
> +then
> + echo "You need to specify a CONFIG or a CROSS_COMPILE"
> + exit 1
> +fi
>
> - time_start=$(date +%s)
> - arch=${board}_ARCH
> - cross_compile=${board}_CROSS_COMPILE
> - mkdir -p ${AUTOBUILD_DIR}/${board}
> - printf "%-20s defconfig: " ${board} | tee -a ${REPORT}
> +if [ "${CONFIG}" ]
> +then
> + source "${CONFIG}"
> +fi
>
> - make -C ${HERE} \
> - O=${AUTOBUILD_DIR}/${board} \
> - ARCH=${!arch} \
> - ${board}_defconfig \
> - > ${AUTOBUILD_DIR}/${board}.log 2>&1
> +check_pipe_status() {
> + for i in "${PIPESTATUS[@]}"
> + do
> + [ $i -gt 0 ] && return 1
> + done
> + return 0
> +}
>
> +do_build_target() {
> + local arch=$1
> + local target=$2
> + local target_time_start=$(date +%s)
> + local log_report="${LOGDIR}/${target}/report.log"
> + local log_err="${LOGDIR}/${target}/errors.log"
> +
> + rm -rf "${BUILDDIR}"
> + mkdir -p "${BUILDDIR}"
> + mkdir -p "${LOGDIR}/${target}"
> + printf "Building ${arch} ${target} \n" >&2 | tee -a "${log_report}"
> +
> + cross_compile=`eval echo '$CROSS_COMPILE_'${target}`
> + if [ ! "${cross_compile}" ]
> + then
> + cross_compile=`eval echo '$CROSS_COMPILE_'${arch}`
> + if [ ! "${cross_compile}" ]
> + then
> + cross_compile=${CROSS_COMPILE}
> + fi
> + fi
> +
> + MAKE="make -C ${here} CROSS_COMPILE=${cross_compile} ARCH=${arch} O=${BUILDDIR}"
> + ${MAKE} -j${JOBS} ${target} 2>&1 > "${log_report}" | tee "${log_err}"
> +
> + printf "Configure: " | tee -a "${log_report}"
> check_pipe_status
> if [ "$?" = "0" ]; then
> + printf "OK \n" | tee -a "${log_report}"
>
> - printf "OK " | tee -a ${REPORT}
> - printf "compile: " ${board} | tee -a ${REPORT}
> + ${MAKE} -j${JOBS} -s 2>&1 >> "${log_report}" | tee -a "${log_err}"
>
> - make -C ${HERE} \
> - O=${AUTOBUILD_DIR}/${board} \
> - ARCH=${!arch} \
> - CROSS_COMPILE=${!cross_compile} \
> - > ${AUTOBUILD_DIR}/${board}.log 2>&1
> + printf "Compile: " ${target} | tee -a "${log_report}"
>
> check_pipe_status
> if [ "$?" = "0" ]; then
> - printf "OK " | tee -a ${REPORT}
> + printf "OK \n" | tee -a "${log_report}"
> + ${cross_compile}size ${BUILDDIR}/barebox | tee -a "${log_report}"
> else
> - printf "FAILED " | tee -a ${REPORT}
> + printf "FAILED \n" | tee -a "${log_report}"
> + ret=1
> fi
> + else
> + printf "FAILED \n" | tee -a "${log_report}"
> + printf "Compile: ------ \n" | tee -a "${log_report}"
> + ret=1
> + fi
>
> + if [ -s "${log_err}" ] ; then
> + nb_errors=$((nb_errors + 1))
> + errors_list="${errors_list} ${target}"
> else
> - printf "FAILED " | tee -a ${REPORT}
> - printf "compile: ------ " | tee -a ${REPORT}
> + rm "${log_err}"
> fi
>
> - time_stop=$(date +%s)
> - time_diff=$(($time_stop - $time_start))
> - printf "%4is\n" $time_diff | tee -a ${REPORT}
> -done
> + nb_defconfigs=$((nb_defconfigs + 1))
> +
> + target_time_stop=$(date +%s)
> + target_time_diff=$((${target_time_stop} - ${target_time_start}))
> + printf "Compiled in %4is\n" ${target_time_diff} | tee -a "${log_report}"
> +}
> +
> +do_build() {
> + local arch=$1
> +
> + for i in arch/${arch}/configs/*_defconfig
> + do
> + local target=$(basename $i)
> +
> + do_build_target ${arch} ${target}
> + done
> +}
>
> +do_build_all() {
> + local build_target=0
> +
> + for i in arch/*
> + do
> + local arch=$(basename $i)
> +
> + if [ -d $i ]
> + then
> + do_build ${arch}
> + build_target=$((build_target + 1))
> + fi
> + done
> +
> + return $build_target
> +}
> +
> +if [ ! "${ARCH}" ] || [ ! -d arch/${ARCH} ]
> +then
> + do_build_all
> + if [ $? -eq 0 ]
> + then
> + echo "You need to specify the ARCH or CROSS_COMPILE_<arch> or CROSS_COMPILE_<target> in your config file"
> + exit 1
> + fi
> + exit 0
> +fi
> +
> +if [ $# -eq 0 ]
> +then
> + do_build ${ARCH}
> +else
> + do_build_target ${ARCH} $1
> +fi
> --
> 1.7.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] MAKEALL: make it generic
2010-09-27 14:35 ` Sascha Hauer
@ 2010-09-27 16:02 ` Jean-Christophe PLAGNIOL-VILLARD
2010-09-29 7:29 ` Sascha Hauer
0 siblings, 1 reply; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-09-27 16:02 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 16:35 Mon 27 Sep , Sascha Hauer wrote:
> On Mon, Sep 27, 2010 at 08:12:34AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > add MAKEALL.cfg example
> >
> > it's allow you to compile specific defconfig or ARCH or all
> > as
> > CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> > CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL
> >
> > or via config
> >
> > CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> > CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL
> >
> > and for all
> >
> > CONFIG=./MAKEALL.cfg ./MAKEALL
> >
> > you can specify
> > JOBS jobs
> > BUILDDIR build dir
> > LOGDIR log dir
>
> Would be good to have this example somewhere in the code, maybe as help
> text in MAKEALL
MAKEALL -h is ok?
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] MAKEALL: make it generic
2010-09-27 16:02 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2010-09-29 7:29 ` Sascha Hauer
2010-09-29 10:31 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2010-09-29 7:29 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
Hi J,
On Mon, Sep 27, 2010 at 06:02:29PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 16:35 Mon 27 Sep , Sascha Hauer wrote:
> > On Mon, Sep 27, 2010 at 08:12:34AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > add MAKEALL.cfg example
> > >
> > > it's allow you to compile specific defconfig or ARCH or all
> > > as
> > > CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> > > CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL
> > >
> > > or via config
> > >
> > > CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> > > CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL
> > >
> > > and for all
> > >
> > > CONFIG=./MAKEALL.cfg ./MAKEALL
> > >
> > > you can specify
> > > JOBS jobs
> > > BUILDDIR build dir
> > > LOGDIR log dir
> >
> > Would be good to have this example somewhere in the code, maybe as help
> > text in MAKEALL
> MAKEALL -h is ok?
Yes, -h and if called without arguments.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] MAKEALL: make it generic
2010-09-29 7:29 ` Sascha Hauer
@ 2010-09-29 10:31 ` Jean-Christophe PLAGNIOL-VILLARD
2010-09-29 13:33 ` Sascha Hauer
0 siblings, 1 reply; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-09-29 10:31 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 09:29 Wed 29 Sep , Sascha Hauer wrote:
> Hi J,
>
> On Mon, Sep 27, 2010 at 06:02:29PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 16:35 Mon 27 Sep , Sascha Hauer wrote:
> > > On Mon, Sep 27, 2010 at 08:12:34AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > add MAKEALL.cfg example
> > > >
> > > > it's allow you to compile specific defconfig or ARCH or all
> > > > as
> > > > CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> > > > CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL
> > > >
> > > > or via config
> > > >
> > > > CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> > > > CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL
> > > >
> > > > and for all
> > > >
> > > > CONFIG=./MAKEALL.cfg ./MAKEALL
> > > >
> > > > you can specify
> > > > JOBS jobs
> > > > BUILDDIR build dir
> > > > LOGDIR log dir
> > >
> > > Would be good to have this example somewhere in the code, maybe as help
> > > text in MAKEALL
> > MAKEALL -h is ok?
>
> Yes, -h and if called without arguments.
no agument means all arch
I prefer to printf it just if -h or missing info
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] MAKEALL: make it generic
2010-09-29 10:31 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2010-09-29 13:33 ` Sascha Hauer
0 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2010-09-29 13:33 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Wed, Sep 29, 2010 at 12:31:55PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:29 Wed 29 Sep , Sascha Hauer wrote:
> > Hi J,
> >
> > On Mon, Sep 27, 2010 at 06:02:29PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 16:35 Mon 27 Sep , Sascha Hauer wrote:
> > > > On Mon, Sep 27, 2010 at 08:12:34AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > > add MAKEALL.cfg example
> > > > >
> > > > > it's allow you to compile specific defconfig or ARCH or all
> > > > > as
> > > > > CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> > > > > CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL
> > > > >
> > > > > or via config
> > > > >
> > > > > CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> > > > > CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL
> > > > >
> > > > > and for all
> > > > >
> > > > > CONFIG=./MAKEALL.cfg ./MAKEALL
> > > > >
> > > > > you can specify
> > > > > JOBS jobs
> > > > > BUILDDIR build dir
> > > > > LOGDIR log dir
> > > >
> > > > Would be good to have this example somewhere in the code, maybe as help
> > > > text in MAKEALL
> > > MAKEALL -h is ok?
> >
> > Yes, -h and if called without arguments.
> no agument means all arch
Ah, yes.
>
> I prefer to printf it just if -h or missing info
Missing info is what I meant, I remember seeing an error message the
first time I called the script.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3] MAKEALL: make it generic
2010-09-27 6:12 [PATCH v2] MAKEALL: make it generic Jean-Christophe PLAGNIOL-VILLARD
2010-09-27 14:35 ` Sascha Hauer
@ 2010-10-01 3:19 ` Jean-Christophe PLAGNIOL-VILLARD
2010-10-01 7:16 ` Sascha Hauer
2010-10-01 16:48 ` [PATCH v4] " Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 2 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-01 3:19 UTC (permalink / raw)
To: barebox
it's allow you to compile specific defconfig or ARCH or all
as
CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL at91sam9263ek_defconfig
CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL
The cross-compiler can be specify via
CROSS_COMPILE default
CROSS_COMPILE_<arch> arch default
CROSS_COMPILE_<target> deconfig specifc
it will be evaluated in the invert order
or via config
you can specify it via env CONFIG or option -c (overwrite env)
CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL at91sam9263ek_defconfig
CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL
and for all
CONFIG=./MAKEALL.cfg ./MAKEALL
you can specify via env or option
env option
ARCH -a arch
CONFIG -c config
JOBS -j jobs
BUILDDIR -O build dir
LOGDIR -l log dir
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
v3:
add getopts supports
add usage support
Best Rebards,
J.
MAKEALL | 286 ++++++++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 227 insertions(+), 59 deletions(-)
diff --git a/MAKEALL b/MAKEALL
index dd0f66b..d42be6e 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -1,89 +1,257 @@
-#!/bin/bash
+#!/bin/sh
-check_pipe_status() {
- for i in "${PIPESTATUS[@]}"; do
- [ $i -gt 0 ] && return 1
- done
- return 0
-}
+# Print statistics when we exit
+trap exit 1 2 3 15
+trap stats 0
+# Keep track of the number of builds and errors
+nb_errors=0
+errors_list=""
+nb_defconfigs=0
+ret=0
-HERE=$(pwd)
-AUTOBUILD_DIR=${HERE}/autobuild
-REPORT=${AUTOBUILD_DIR}/REPORT
+here=$(pwd)
-if [ -d "${AUTOBUILD_DIR}" ]; then
- echo "warning: ${AUTOBUILD_DIR} exists, press <ctrl-c> to exit or wait for 3 seconds"
- sleep 3
- rm -fr ${AUTOBUILD_DIR}
-fi
+time_start=$(date +%s)
-mkdir -p ${AUTOBUILD_DIR}
+filename=`basename $0`
-BOARDS="${BOARDS} sandbox"
-sandbox_ARCH=sandbox
-sandbox_CROSS_COMPILE=
+is_print_stats=1
-BOARDS="${BOARDS} ipe337"
-ipe337_ARCH=blackfin
-ipe337_CROSS_COMPILE=bfin-elf-
+#-----------------------------------------------------------------------
-BOARDS="${BOARDS} netx_nxdb500"
-netx_nxdb500_ARCH=arm
-netx_nxdb500_CROSS_COMPILE=arm-v4t-linux-gnueabi-
+usage() {
+ is_print_stats=0
+ echo "Usage: ${filename} [OPTION]..."
+ echo "Barebox MAKEALL tools."
+ echo ""
+ echo "it's allow you to compile specific defconfig or ARCH or all"
+ echo "as"
+ echo ""
+ echo "CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL at91sam9263ek_defconfig"
+ echo "CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL"
+ echo ""
+ echo "The cross-compiler can be specify via"
+ echo " CROSS_COMPILE default"
+ echo " CROSS_COMPILE_<arch> arch default"
+ echo " CROSS_COMPILE_<target> deconfig specifc"
+ echo ""
+ echo "it will be evaluated in the invert order"
+ echo ""
+ echo "or via config"
+ echo ""
+ echo "you can specify it via env CONFIG or option -c (overwrite env)"
+ echo ""
+ echo "CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL at91sam9263ek_defconfig"
+ echo "CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL"
+ echo ""
+ echo "and for all"
+ echo ""
+ echo "CONFIG=./MAKEALL.cfg ./MAKEALL"
+ echo ""
+ echo "you can specify via env or option"
+ echo "env option"
+ echo "ARCH -a arch"
+ echo "CONFIG -c config"
+ echo "JOBS -j jobs"
+ echo "BUILDDIR -O build dir"
+ echo "LOGDIR -l log dir"
+ echo ""
+}
-BOARDS="${BOARDS} pcm030"
-pcm030_ARCH=ppc
-pcm030_CROSS_COMPILE=powerpc-603e-linux-gnu-
+stats() {
+ [ ${is_print_stats} -lt 1 ] && return
-BOARDS="${BOARDS} pcm037"
-pcm037_ARCH=arm
-pcm037_CROSS_COMPILE=arm-1136jfs-linux-gnueabi-
+ echo ""
+ echo "--------------------- SUMMARY ----------------------------"
+ echo "defconfigs compiled: ${nb_defconfigs}"
+ time_stop=$(date +%s)
+ time_diff=$((${time_stop} - ${time_start}))
+ printf "compiled in %4is\n" ${time_diff}
+ if [ ${nb_errors} -gt 0 ] ; then
+ echo "defcongids with warnings or errors: ${nb_errors} (${errors_list} )"
+ fi
+ echo "----------------------------------------------------------"
+
+ exit ${ret}
+}
+
+check_pipe_status() {
+ for i in "${PIPESTATUS[@]}"
+ do
+ [ $i -gt 0 ] && return 1
+ done
+ return 0
+}
-BOARDS="${BOARDS} pcm038"
-pcm038_ARCH=arm
-pcm038_CROSS_COMPILE=arm-v4t-linux-gnueabi-
+do_build_target() {
+ local arch=$1
+ local target=$2
+ local target_time_start=$(date +%s)
+ local log_report="${LOGDIR}/${target}/report.log"
+ local log_err="${LOGDIR}/${target}/errors.log"
-for board in ${BOARDS}; do
+ rm -rf "${BUILDDIR}"
+ mkdir -p "${BUILDDIR}"
+ mkdir -p "${LOGDIR}/${target}"
+ printf "Building ${arch} ${target} \n" >&2 | tee -a "${log_report}"
- time_start=$(date +%s)
- arch=${board}_ARCH
- cross_compile=${board}_CROSS_COMPILE
- mkdir -p ${AUTOBUILD_DIR}/${board}
- printf "%-20s defconfig: " ${board} | tee -a ${REPORT}
+ cross_compile=`eval echo '$CROSS_COMPILE_'${target}`
+ if [ ! "${cross_compile}" ]
+ then
+ cross_compile=`eval echo '$CROSS_COMPILE_'${arch}`
+ if [ ! "${cross_compile}" ]
+ then
+ cross_compile=${CROSS_COMPILE}
+ fi
+ fi
- make -C ${HERE} \
- O=${AUTOBUILD_DIR}/${board} \
- ARCH=${!arch} \
- ${board}_defconfig \
- > ${AUTOBUILD_DIR}/${board}.log 2>&1
+ MAKE="make -C ${here} CROSS_COMPILE=${cross_compile} ARCH=${arch} O=${BUILDDIR}"
+ ${MAKE} -j${JOBS} ${target} 2>&1 > "${log_report}" | tee "${log_err}"
+ printf "Configure: " | tee -a "${log_report}"
check_pipe_status
if [ "$?" = "0" ]; then
+ printf "OK \n" | tee -a "${log_report}"
- printf "OK " | tee -a ${REPORT}
- printf "compile: " ${board} | tee -a ${REPORT}
+ ${MAKE} -j${JOBS} -s 2>&1 >> "${log_report}" | tee -a "${log_err}"
- make -C ${HERE} \
- O=${AUTOBUILD_DIR}/${board} \
- ARCH=${!arch} \
- CROSS_COMPILE=${!cross_compile} \
- > ${AUTOBUILD_DIR}/${board}.log 2>&1
+ printf "Compile: " ${target} | tee -a "${log_report}"
check_pipe_status
if [ "$?" = "0" ]; then
- printf "OK " | tee -a ${REPORT}
+ printf "OK \n" | tee -a "${log_report}"
+ ${cross_compile}size ${BUILDDIR}/barebox | tee -a "${log_report}"
else
- printf "FAILED " | tee -a ${REPORT}
+ printf "FAILED \n" | tee -a "${log_report}"
+ ret=1
fi
+ else
+ printf "FAILED \n" | tee -a "${log_report}"
+ printf "Compile: ------ \n" | tee -a "${log_report}"
+ ret=1
+ fi
+ if [ -s "${log_err}" ] ; then
+ nb_errors=$((nb_errors + 1))
+ errors_list="${errors_list} ${target}"
else
- printf "FAILED " | tee -a ${REPORT}
- printf "compile: ------ " | tee -a ${REPORT}
+ rm "${log_err}"
fi
- time_stop=$(date +%s)
- time_diff=$(($time_stop - $time_start))
- printf "%4is\n" $time_diff | tee -a ${REPORT}
+ nb_defconfigs=$((nb_defconfigs + 1))
+
+ target_time_stop=$(date +%s)
+ target_time_diff=$((${target_time_stop} - ${target_time_start}))
+ printf "Compiled in %4is\n" ${target_time_diff} | tee -a "${log_report}"
+}
+
+do_build() {
+ local arch=$1
+
+ for i in arch/${arch}/configs/*_defconfig
+ do
+ local target=$(basename $i)
+
+ do_build_target ${arch} ${target}
+ done
+}
+
+do_build_all() {
+ local build_target=0
+
+ for i in arch/*
+ do
+ local arch=$(basename $i)
+
+ if [ -d $i ]
+ then
+ do_build ${arch}
+ build_target=$((build_target + 1))
+ fi
+ done
+
+ return $build_target
+}
+
+while getopts "hc:j:O:l:a:" Option
+do
+case $Option in
+ a )
+ ARCH=${OPTARG}
+ ;;
+ c )
+ CONFIG=${OPTARG}
+ ;;
+ j )
+ JOBS=${OPTARG}
+ ;;
+ l )
+ LOGDIR=${OPTARG}
+ ;;
+ O )
+ BUILDDIR=${OPTARG}
+ ;;
+ h )
+ usage
+ exit 0
+ ;;
+esac
done
+shift $((OPTIND - 1))
+
+if [ ! "${JOBS}" ] ; then
+ #linux, BSD, MacOS
+ nb_cpu=`getconf _NPROCESSORS_ONLN`
+
+ if [ $? -gt 0 ]
+ then
+ nb_cpu=1
+ fi
+
+ JOBS=$((${nb_cpu} * 2))
+fi
+
+if [ ! "${LOGDIR}" ]
+then
+ LOGDIR="log"
+fi
+
+if [ ! "${BUILDDIR}" ]
+then
+ BUILDDIR="makeall_builddir"
+fi
+
+if [ "${CONFIG}" ]
+then
+ source "${CONFIG}"
+fi
+
+[ -d "${LOGDIR}" ] || mkdir ${LOGDIR} || exit 1
+
+if [ ! "${CONFIG}" ] && [ ! "${CROSS_COMPILE}" ]
+then
+ echo "You need to specify a CONFIG or a CROSS_COMPILE"
+ usage
+ exit 1
+fi
+
+if [ ! "${ARCH}" ] || [ ! -d arch/${ARCH} ]
+then
+ do_build_all
+ if [ $? -eq 0 ]
+ then
+ echo "You need to specify the ARCH or CROSS_COMPILE_<arch> or CROSS_COMPILE_<target> in your config file"
+ usage
+ exit 1
+ fi
+ exit 0
+fi
+
+if [ $# -eq 0 ]
+then
+ do_build ${ARCH}
+else
+ do_build_target ${ARCH} $1
+fi
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] MAKEALL: make it generic
2010-10-01 3:19 ` [PATCH v3] " Jean-Christophe PLAGNIOL-VILLARD
@ 2010-10-01 7:16 ` Sascha Hauer
2010-10-01 16:48 ` Jean-Christophe PLAGNIOL-VILLARD
2010-10-01 16:48 ` [PATCH v4] " Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2010-10-01 7:16 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Fri, Oct 01, 2010 at 05:19:12AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> it's allow you to compile specific defconfig or ARCH or all
> as
>
> CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL
>
> The cross-compiler can be specify via
> CROSS_COMPILE default
> CROSS_COMPILE_<arch> arch default
> CROSS_COMPILE_<target> deconfig specifc
>
> it will be evaluated in the invert order
>
> or via config
>
> you can specify it via env CONFIG or option -c (overwrite env)
>
> CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL
>
> and for all
>
> CONFIG=./MAKEALL.cfg ./MAKEALL
>
> you can specify via env or option
> env option
> ARCH -a arch
> CONFIG -c config
> JOBS -j jobs
> BUILDDIR -O build dir
> LOGDIR -l log dir
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> v3:
> add getopts supports
>
> add usage support
>
> Best Rebards,
> J.
> MAKEALL | 286 ++++++++++++++++++++++++++++++++++++++++++++++++++-------------
> 1 files changed, 227 insertions(+), 59 deletions(-)
>
> diff --git a/MAKEALL b/MAKEALL
> index dd0f66b..d42be6e 100755
> --- a/MAKEALL
> +++ b/MAKEALL
> @@ -1,89 +1,257 @@
> -#!/bin/bash
> +#!/bin/sh
With /bin/sh here ./MAKEALL -c MAKEALL.cfg does not work. I have to
explicitely call ./MAKEALL -c ./MAKEALL.cfg. Can we keep /bin/bash here
or has anybody a better idea?
> +
> +if [ "${CONFIG}" ]
> +then
> + source "${CONFIG}"
> +fi
It fails here with:
./MAKEALL: line 230: source: MAKEALL.cfg: file not found
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] MAKEALL: make it generic
2010-10-01 7:16 ` Sascha Hauer
@ 2010-10-01 16:48 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-01 16:48 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 09:16 Fri 01 Oct , Sascha Hauer wrote:
> On Fri, Oct 01, 2010 at 05:19:12AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > it's allow you to compile specific defconfig or ARCH or all
> > as
> >
> > CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> > CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL
> >
> > The cross-compiler can be specify via
> > CROSS_COMPILE default
> > CROSS_COMPILE_<arch> arch default
> > CROSS_COMPILE_<target> deconfig specifc
> >
> > it will be evaluated in the invert order
> >
> > or via config
> >
> > you can specify it via env CONFIG or option -c (overwrite env)
> >
> > CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL at91sam9263ek_defconfig
> > CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL
> >
> > and for all
> >
> > CONFIG=./MAKEALL.cfg ./MAKEALL
> >
> > you can specify via env or option
> > env option
> > ARCH -a arch
> > CONFIG -c config
> > JOBS -j jobs
> > BUILDDIR -O build dir
> > LOGDIR -l log dir
> >
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> > v3:
> > add getopts supports
> >
> > add usage support
> >
> > Best Rebards,
> > J.
> > MAKEALL | 286 ++++++++++++++++++++++++++++++++++++++++++++++++++-------------
> > 1 files changed, 227 insertions(+), 59 deletions(-)
> >
> > diff --git a/MAKEALL b/MAKEALL
> > index dd0f66b..d42be6e 100755
> > --- a/MAKEALL
> > +++ b/MAKEALL
> > @@ -1,89 +1,257 @@
> > -#!/bin/bash
> > +#!/bin/sh
>
> With /bin/sh here ./MAKEALL -c MAKEALL.cfg does not work. I have to
> explicitely call ./MAKEALL -c ./MAKEALL.cfg. Can we keep /bin/bash here
> or has anybody a better idea?
I found the them issue and how to fix it
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v4] MAKEALL: make it generic
2010-10-01 3:19 ` [PATCH v3] " Jean-Christophe PLAGNIOL-VILLARD
2010-10-01 7:16 ` Sascha Hauer
@ 2010-10-01 16:48 ` Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 0 replies; 10+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-01 16:48 UTC (permalink / raw)
To: barebox
it's allow you to compile specific defconfig or ARCH or all
as
CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL at91sam9263ek_defconfig
CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL
The cross-compiler can be specify via
CROSS_COMPILE default
CROSS_COMPILE_<arch> arch default
CROSS_COMPILE_<target> deconfig specifc
it will be evaluated in the invert order
or via config
you can specify it via env CONFIG or option -c (overwrite env)
CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL at91sam9263ek_defconfig
CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL
and for all
CONFIG=./MAKEALL.cfg ./MAKEALL
you can specify via env or option
env option
ARCH -a arch
CONFIG -c config
JOBS -j jobs
BUILDDIR -O build dir
LOGDIR -l log dir
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
v4:
fix support of CONFIG=MAKEALL.cfg or -c MAKEALL.cfg
Best Regards,
J.
MAKEALL | 293 ++++++++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 234 insertions(+), 59 deletions(-)
diff --git a/MAKEALL b/MAKEALL
index dd0f66b..9353cd8 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -1,89 +1,264 @@
-#!/bin/bash
+#!/bin/sh
-check_pipe_status() {
- for i in "${PIPESTATUS[@]}"; do
- [ $i -gt 0 ] && return 1
- done
- return 0
-}
+# Print statistics when we exit
+trap exit 1 2 3 15
+trap stats 0
+# Keep track of the number of builds and errors
+nb_errors=0
+errors_list=""
+nb_defconfigs=0
+ret=0
-HERE=$(pwd)
-AUTOBUILD_DIR=${HERE}/autobuild
-REPORT=${AUTOBUILD_DIR}/REPORT
+here=$(pwd)
-if [ -d "${AUTOBUILD_DIR}" ]; then
- echo "warning: ${AUTOBUILD_DIR} exists, press <ctrl-c> to exit or wait for 3 seconds"
- sleep 3
- rm -fr ${AUTOBUILD_DIR}
-fi
+time_start=$(date +%s)
+
+filename=`basename $0`
+
+is_print_stats=1
-mkdir -p ${AUTOBUILD_DIR}
+#-----------------------------------------------------------------------
-BOARDS="${BOARDS} sandbox"
-sandbox_ARCH=sandbox
-sandbox_CROSS_COMPILE=
+usage() {
+ is_print_stats=0
+ echo "Usage: ${filename} [OPTION]..."
+ echo "Barebox MAKEALL tools."
+ echo ""
+ echo "it's allow you to compile specific defconfig or ARCH or all"
+ echo "as"
+ echo ""
+ echo "CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL at91sam9263ek_defconfig"
+ echo "CROSS_COMPILE=arm-linux- ARCH=arm ./MAKEALL"
+ echo ""
+ echo "The cross-compiler can be specify via"
+ echo " CROSS_COMPILE default"
+ echo " CROSS_COMPILE_<arch> arch default"
+ echo " CROSS_COMPILE_<target> deconfig specifc"
+ echo ""
+ echo "it will be evaluated in the invert order"
+ echo ""
+ echo "or via config"
+ echo ""
+ echo "you can specify it via env CONFIG or option -c (overwrite env)"
+ echo ""
+ echo "CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL at91sam9263ek_defconfig"
+ echo "CONFIG=./MAKEALL.cfg ARCH=arm ./MAKEALL"
+ echo ""
+ echo "and for all"
+ echo ""
+ echo "CONFIG=./MAKEALL.cfg ./MAKEALL"
+ echo ""
+ echo "you can specify via env or option"
+ echo "env option"
+ echo "ARCH -a arch"
+ echo "CONFIG -c config"
+ echo "JOBS -j jobs"
+ echo "BUILDDIR -O build dir"
+ echo "LOGDIR -l log dir"
+ echo ""
+}
-BOARDS="${BOARDS} ipe337"
-ipe337_ARCH=blackfin
-ipe337_CROSS_COMPILE=bfin-elf-
+stats() {
+ [ ${is_print_stats} -lt 1 ] && return
-BOARDS="${BOARDS} netx_nxdb500"
-netx_nxdb500_ARCH=arm
-netx_nxdb500_CROSS_COMPILE=arm-v4t-linux-gnueabi-
+ echo ""
+ echo "--------------------- SUMMARY ----------------------------"
+ echo "defconfigs compiled: ${nb_defconfigs}"
+ time_stop=$(date +%s)
+ time_diff=$((${time_stop} - ${time_start}))
+ printf "compiled in %4is\n" ${time_diff}
+ if [ ${nb_errors} -gt 0 ] ; then
+ echo "defcongids with warnings or errors: ${nb_errors} (${errors_list} )"
+ fi
+ echo "----------------------------------------------------------"
-BOARDS="${BOARDS} pcm030"
-pcm030_ARCH=ppc
-pcm030_CROSS_COMPILE=powerpc-603e-linux-gnu-
+ exit ${ret}
+}
-BOARDS="${BOARDS} pcm037"
-pcm037_ARCH=arm
-pcm037_CROSS_COMPILE=arm-1136jfs-linux-gnueabi-
+check_pipe_status() {
+ for i in "${PIPESTATUS[@]}"
+ do
+ [ $i -gt 0 ] && return 1
+ done
+ return 0
+}
-BOARDS="${BOARDS} pcm038"
-pcm038_ARCH=arm
-pcm038_CROSS_COMPILE=arm-v4t-linux-gnueabi-
+do_build_target() {
+ local arch=$1
+ local target=$2
+ local target_time_start=$(date +%s)
+ local log_report="${LOGDIR}/${target}/report.log"
+ local log_err="${LOGDIR}/${target}/errors.log"
-for board in ${BOARDS}; do
+ rm -rf "${BUILDDIR}"
+ mkdir -p "${BUILDDIR}"
+ mkdir -p "${LOGDIR}/${target}"
+ printf "Building ${arch} ${target} \n" >&2 | tee -a "${log_report}"
- time_start=$(date +%s)
- arch=${board}_ARCH
- cross_compile=${board}_CROSS_COMPILE
- mkdir -p ${AUTOBUILD_DIR}/${board}
- printf "%-20s defconfig: " ${board} | tee -a ${REPORT}
+ cross_compile=`eval echo '$CROSS_COMPILE_'${target}`
+ if [ ! "${cross_compile}" ]
+ then
+ cross_compile=`eval echo '$CROSS_COMPILE_'${arch}`
+ if [ ! "${cross_compile}" ]
+ then
+ cross_compile=${CROSS_COMPILE}
+ fi
+ fi
- make -C ${HERE} \
- O=${AUTOBUILD_DIR}/${board} \
- ARCH=${!arch} \
- ${board}_defconfig \
- > ${AUTOBUILD_DIR}/${board}.log 2>&1
+ MAKE="make -C ${here} CROSS_COMPILE=${cross_compile} ARCH=${arch} O=${BUILDDIR}"
+ ${MAKE} -j${JOBS} ${target} 2>&1 > "${log_report}" | tee "${log_err}"
+ printf "Configure: " | tee -a "${log_report}"
check_pipe_status
if [ "$?" = "0" ]; then
+ printf "OK \n" | tee -a "${log_report}"
- printf "OK " | tee -a ${REPORT}
- printf "compile: " ${board} | tee -a ${REPORT}
+ ${MAKE} -j${JOBS} -s 2>&1 >> "${log_report}" | tee -a "${log_err}"
- make -C ${HERE} \
- O=${AUTOBUILD_DIR}/${board} \
- ARCH=${!arch} \
- CROSS_COMPILE=${!cross_compile} \
- > ${AUTOBUILD_DIR}/${board}.log 2>&1
+ printf "Compile: " ${target} | tee -a "${log_report}"
check_pipe_status
if [ "$?" = "0" ]; then
- printf "OK " | tee -a ${REPORT}
+ printf "OK \n" | tee -a "${log_report}"
+ ${cross_compile}size ${BUILDDIR}/barebox | tee -a "${log_report}"
else
- printf "FAILED " | tee -a ${REPORT}
+ printf "FAILED \n" | tee -a "${log_report}"
+ ret=1
fi
+ else
+ printf "FAILED \n" | tee -a "${log_report}"
+ printf "Compile: ------ \n" | tee -a "${log_report}"
+ ret=1
+ fi
+ if [ -s "${log_err}" ] ; then
+ nb_errors=$((nb_errors + 1))
+ errors_list="${errors_list} ${target}"
else
- printf "FAILED " | tee -a ${REPORT}
- printf "compile: ------ " | tee -a ${REPORT}
+ rm "${log_err}"
fi
- time_stop=$(date +%s)
- time_diff=$(($time_stop - $time_start))
- printf "%4is\n" $time_diff | tee -a ${REPORT}
+ nb_defconfigs=$((nb_defconfigs + 1))
+
+ target_time_stop=$(date +%s)
+ target_time_diff=$((${target_time_stop} - ${target_time_start}))
+ printf "Compiled in %4is\n" ${target_time_diff} | tee -a "${log_report}"
+}
+
+do_build() {
+ local arch=$1
+
+ for i in arch/${arch}/configs/*_defconfig
+ do
+ local target=$(basename $i)
+
+ do_build_target ${arch} ${target}
+ done
+}
+
+do_build_all() {
+ local build_target=0
+
+ for i in arch/*
+ do
+ local arch=$(basename $i)
+
+ if [ -d $i ]
+ then
+ do_build ${arch}
+ build_target=$((build_target + 1))
+ fi
+ done
+
+ return $build_target
+}
+
+while getopts "hc:j:O:l:a:" Option
+do
+case $Option in
+ a )
+ ARCH=${OPTARG}
+ ;;
+ c )
+ CONFIG=${OPTARG}
+ ;;
+ j )
+ JOBS=${OPTARG}
+ ;;
+ l )
+ LOGDIR=${OPTARG}
+ ;;
+ O )
+ BUILDDIR=${OPTARG}
+ ;;
+ h )
+ usage
+ exit 0
+ ;;
+esac
done
+shift $((OPTIND - 1))
+
+if [ ! "${JOBS}" ] ; then
+ #linux, BSD, MacOS
+ nb_cpu=`getconf _NPROCESSORS_ONLN`
+
+ if [ $? -gt 0 ]
+ then
+ nb_cpu=1
+ fi
+
+ JOBS=$((${nb_cpu} * 2))
+fi
+
+if [ ! "${LOGDIR}" ]
+then
+ LOGDIR="log"
+fi
+
+if [ ! "${BUILDDIR}" ]
+then
+ BUILDDIR="makeall_builddir"
+fi
+
+if [ "${CONFIG}" ]
+then
+ basedir=`dirname ${CONFIG}`
+
+ if [ ! "${basedir}" ] || [ "${basedir}" = "." ]
+ then
+ CONFIG="./${CONFIG}"
+ fi
+
+ source "${CONFIG}"
+fi
+
+[ -d "${LOGDIR}" ] || mkdir ${LOGDIR} || exit 1
+
+if [ ! "${CONFIG}" ] && [ ! "${CROSS_COMPILE}" ]
+then
+ echo "You need to specify a CONFIG or a CROSS_COMPILE"
+ usage
+ exit 1
+fi
+
+if [ ! "${ARCH}" ] || [ ! -d arch/${ARCH} ]
+then
+ do_build_all
+ if [ $? -eq 0 ]
+ then
+ echo "You need to specify the ARCH or CROSS_COMPILE_<arch> or CROSS_COMPILE_<target> in your config file"
+ usage
+ exit 1
+ fi
+ exit 0
+fi
+
+if [ $# -eq 0 ]
+then
+ do_build ${ARCH}
+else
+ do_build_target ${ARCH} $1
+fi
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-10-01 16:50 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-27 6:12 [PATCH v2] MAKEALL: make it generic Jean-Christophe PLAGNIOL-VILLARD
2010-09-27 14:35 ` Sascha Hauer
2010-09-27 16:02 ` Jean-Christophe PLAGNIOL-VILLARD
2010-09-29 7:29 ` Sascha Hauer
2010-09-29 10:31 ` Jean-Christophe PLAGNIOL-VILLARD
2010-09-29 13:33 ` Sascha Hauer
2010-10-01 3:19 ` [PATCH v3] " Jean-Christophe PLAGNIOL-VILLARD
2010-10-01 7:16 ` Sascha Hauer
2010-10-01 16:48 ` Jean-Christophe PLAGNIOL-VILLARD
2010-10-01 16:48 ` [PATCH v4] " Jean-Christophe PLAGNIOL-VILLARD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox