* [ptxdist] [RFC] ptxd_make_dts_dtb: error handling
@ 2014-07-08 12:59 Alexander Aring
2014-07-08 12:59 ` [ptxdist] [RFC] ptxd_make_dts_dtb: check on failure if dtc failed Alexander Aring
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Aring @ 2014-07-08 12:59 UTC (permalink / raw)
To: ptxdist; +Cc: Alexander Aring
Hi,
I had some syntax error on one of my dts files. Yes sometimes I do some
mistakes ;-).
Nevertheless ptxdist images runs fine and used the old dtb files in the
images directory. It took some time to realize that I had this error.
This patch adds a error handling for dtc. It's a RFC only. I don't know
if we should compare to string or numbers in calling of test and maybe we
should add eror handling for c preprocessor also.
btw: the spaces instead tabs in scripts/lib/ptxd_make_dts_dtc.sh are correct?
I just adapt it.
- Alex
Alexander Aring (1):
ptxd_make_dts_dtb: check on failure if dtc failed
scripts/lib/ptxd_make_dts_dtc.sh | 4 ++++
1 file changed, 4 insertions(+)
--
2.0.1
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ptxdist] [RFC] ptxd_make_dts_dtb: check on failure if dtc failed
2014-07-08 12:59 [ptxdist] [RFC] ptxd_make_dts_dtb: error handling Alexander Aring
@ 2014-07-08 12:59 ` Alexander Aring
2014-07-08 13:22 ` Marc Kleine-Budde
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Aring @ 2014-07-08 12:59 UTC (permalink / raw)
To: ptxdist; +Cc: Alexander Aring
This patch adds a error handling for the dtc and call a ptxd_bailout if
an error occur.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
scripts/lib/ptxd_make_dts_dtc.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/lib/ptxd_make_dts_dtc.sh b/scripts/lib/ptxd_make_dts_dtc.sh
index 24c5604..6a09cae 100644
--- a/scripts/lib/ptxd_make_dts_dtc.sh
+++ b/scripts/lib/ptxd_make_dts_dtc.sh
@@ -59,6 +59,10 @@ ptxd_make_dts_dtb() {
-I dts -O dtb -b 0 \
-o "${dts_dtb}" "${tmp_dts}"
+ if [ "$?" != "0" ]; then
+ ptxd_bailout "Unable to generate ${dts_dtb} file."
+ fi
+
awk '{ \
printf "%s", $1 ; \
for (i = 2; i <= NF; i++) { \
--
2.0.1
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [RFC] ptxd_make_dts_dtb: check on failure if dtc failed
2014-07-08 12:59 ` [ptxdist] [RFC] ptxd_make_dts_dtb: check on failure if dtc failed Alexander Aring
@ 2014-07-08 13:22 ` Marc Kleine-Budde
2014-07-08 13:24 ` Alexander Aring
0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2014-07-08 13:22 UTC (permalink / raw)
To: ptxdist; +Cc: Alexander Aring
[-- Attachment #1.1: Type: text/plain, Size: 1065 bytes --]
On 07/08/2014 02:59 PM, Alexander Aring wrote:
> This patch adds a error handling for the dtc and call a ptxd_bailout if
> an error occur.
>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> scripts/lib/ptxd_make_dts_dtc.sh | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/scripts/lib/ptxd_make_dts_dtc.sh b/scripts/lib/ptxd_make_dts_dtc.sh
> index 24c5604..6a09cae 100644
> --- a/scripts/lib/ptxd_make_dts_dtc.sh
> +++ b/scripts/lib/ptxd_make_dts_dtc.sh
> @@ -59,6 +59,10 @@ ptxd_make_dts_dtb() {
> -I dts -O dtb -b 0 \
> -o "${dts_dtb}" "${tmp_dts}"
>
> + if [ "$?" != "0" ]; then
> + ptxd_bailout "Unable to generate ${dts_dtb} file."
> + fi
What about:
|| ptxd_bailout "Unable to generate ${dts_dtb} file."
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
[-- Attachment #2: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [RFC] ptxd_make_dts_dtb: check on failure if dtc failed
2014-07-08 13:22 ` Marc Kleine-Budde
@ 2014-07-08 13:24 ` Alexander Aring
2014-07-08 13:30 ` Marc Kleine-Budde
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Aring @ 2014-07-08 13:24 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: ptxdist
On Tue, Jul 08, 2014 at 03:22:18PM +0200, Marc Kleine-Budde wrote:
> On 07/08/2014 02:59 PM, Alexander Aring wrote:
> > This patch adds a error handling for the dtc and call a ptxd_bailout if
> > an error occur.
> >
> > Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> > ---
> > scripts/lib/ptxd_make_dts_dtc.sh | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/scripts/lib/ptxd_make_dts_dtc.sh b/scripts/lib/ptxd_make_dts_dtc.sh
> > index 24c5604..6a09cae 100644
> > --- a/scripts/lib/ptxd_make_dts_dtc.sh
> > +++ b/scripts/lib/ptxd_make_dts_dtc.sh
> > @@ -59,6 +59,10 @@ ptxd_make_dts_dtb() {
> > -I dts -O dtb -b 0 \
> > -o "${dts_dtb}" "${tmp_dts}"
> >
> > + if [ "$?" != "0" ]; then
> > + ptxd_bailout "Unable to generate ${dts_dtb} file."
> > + fi
>
> What about:
>
> || ptxd_bailout "Unable to generate ${dts_dtb} file."
>
okay, yes then we could save the if. I can also add
|| ptxd_bailout ... for cpp call.
- Alex
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [RFC] ptxd_make_dts_dtb: check on failure if dtc failed
2014-07-08 13:24 ` Alexander Aring
@ 2014-07-08 13:30 ` Marc Kleine-Budde
2014-07-08 13:46 ` Alexander Aring
0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2014-07-08 13:30 UTC (permalink / raw)
To: ptxdist
[-- Attachment #1.1: Type: text/plain, Size: 1416 bytes --]
On 07/08/2014 03:24 PM, Alexander Aring wrote:
> On Tue, Jul 08, 2014 at 03:22:18PM +0200, Marc Kleine-Budde wrote:
>> On 07/08/2014 02:59 PM, Alexander Aring wrote:
>>> This patch adds a error handling for the dtc and call a ptxd_bailout if
>>> an error occur.
>>>
>>> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
>>> ---
>>> scripts/lib/ptxd_make_dts_dtc.sh | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/scripts/lib/ptxd_make_dts_dtc.sh b/scripts/lib/ptxd_make_dts_dtc.sh
>>> index 24c5604..6a09cae 100644
>>> --- a/scripts/lib/ptxd_make_dts_dtc.sh
>>> +++ b/scripts/lib/ptxd_make_dts_dtc.sh
>>> @@ -59,6 +59,10 @@ ptxd_make_dts_dtb() {
>>> -I dts -O dtb -b 0 \
>>> -o "${dts_dtb}" "${tmp_dts}"
>>>
>>> + if [ "$?" != "0" ]; then
>>> + ptxd_bailout "Unable to generate ${dts_dtb} file."
>>> + fi
>>
>> What about:
>>
>> || ptxd_bailout "Unable to generate ${dts_dtb} file."
>>
>
> okay, yes then we could save the if. I can also add
>
> || ptxd_bailout ... for cpp call.
Or better concatenate everything with a && and add || bailout at the end.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
[-- Attachment #2: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [RFC] ptxd_make_dts_dtb: check on failure if dtc failed
2014-07-08 13:30 ` Marc Kleine-Budde
@ 2014-07-08 13:46 ` Alexander Aring
2014-07-08 14:07 ` Marc Kleine-Budde
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Aring @ 2014-07-08 13:46 UTC (permalink / raw)
To: ptxdist
On Tue, Jul 08, 2014 at 03:30:37PM +0200, Marc Kleine-Budde wrote:
> On 07/08/2014 03:24 PM, Alexander Aring wrote:
> > On Tue, Jul 08, 2014 at 03:22:18PM +0200, Marc Kleine-Budde wrote:
> >> On 07/08/2014 02:59 PM, Alexander Aring wrote:
> >>> This patch adds a error handling for the dtc and call a ptxd_bailout if
> >>> an error occur.
> >>>
> >>> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> >>> ---
> >>> scripts/lib/ptxd_make_dts_dtc.sh | 4 ++++
> >>> 1 file changed, 4 insertions(+)
> >>>
> >>> diff --git a/scripts/lib/ptxd_make_dts_dtc.sh b/scripts/lib/ptxd_make_dts_dtc.sh
> >>> index 24c5604..6a09cae 100644
> >>> --- a/scripts/lib/ptxd_make_dts_dtc.sh
> >>> +++ b/scripts/lib/ptxd_make_dts_dtc.sh
> >>> @@ -59,6 +59,10 @@ ptxd_make_dts_dtb() {
> >>> -I dts -O dtb -b 0 \
> >>> -o "${dts_dtb}" "${tmp_dts}"
> >>>
> >>> + if [ "$?" != "0" ]; then
> >>> + ptxd_bailout "Unable to generate ${dts_dtb} file."
> >>> + fi
> >>
> >> What about:
> >>
> >> || ptxd_bailout "Unable to generate ${dts_dtb} file."
> >>
> >
> > okay, yes then we could save the if. I can also add
> >
> > || ptxd_bailout ... for cpp call.
>
> Or better concatenate everything with a && and add || bailout at the end.
>
uiuiuiui, but we have some other steps in the middle and the most looks
currently like magic for me. But I think we could do:
sed -e "s;^${tmp_dts}:;${dts_dtb}:;" \
-e 's;^ \([^ ]*\); $(wildcard \1);' "${tmp_deps}" > "${deps}"
if dtc -h 2>&1 | grep -q '^[[:space:]]\+-i\(,.*\)\?$'; then
dtc_include="-i $(dirname "${dts}") -i ${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts"
fi
echo "CPP $(ptxd_print_path "${tmp_dts}")"
cpp \
-Wp,-MD,${tmp_deps} \
-Wp,-MT,${tmp_dts} \
-nostdinc \
-P \
-I$(dirname "${dts}") \
-I${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts \
-I${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts/include \
-I${dts_kernel_dir}/drivers/of/testcase-data \
-I${dts_kernel_dir}/include \
-undef -D__DTS__ -x assembler-with-cpp \
-o ${tmp_dts} \
${dts} && \
echo "DTC $(ptxd_print_path "${dts_dtb}")" && \
dtc \
$(ptxd_get_ptxconf PTXCONF_DTC_EXTRA_ARGS) \
${dtc_include} \
-d "${tmp_deps}" \
-I dts -O dtb -b 0 \
-o "${dts_dtb}" "${tmp_dts}" || \
ptxd_bailout "Unable to generate ${dts_dtb} file."
normally we can forget to check error on echo, but it's in the
middle of the generation. I also moved the sed and dtc_include setting
before calling cpp step. I think this should work, maybe it looks a
little bit ugly, don't know what is a nice indentation. :-/
- Alex
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [RFC] ptxd_make_dts_dtb: check on failure if dtc failed
2014-07-08 13:46 ` Alexander Aring
@ 2014-07-08 14:07 ` Marc Kleine-Budde
0 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2014-07-08 14:07 UTC (permalink / raw)
To: ptxdist
[-- Attachment #1.1: Type: text/plain, Size: 3412 bytes --]
On 07/08/2014 03:46 PM, Alexander Aring wrote:
> On Tue, Jul 08, 2014 at 03:30:37PM +0200, Marc Kleine-Budde wrote:
>> On 07/08/2014 03:24 PM, Alexander Aring wrote:
>>> On Tue, Jul 08, 2014 at 03:22:18PM +0200, Marc Kleine-Budde wrote:
>>>> On 07/08/2014 02:59 PM, Alexander Aring wrote:
>>>>> This patch adds a error handling for the dtc and call a ptxd_bailout if
>>>>> an error occur.
>>>>>
>>>>> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
>>>>> ---
>>>>> scripts/lib/ptxd_make_dts_dtc.sh | 4 ++++
>>>>> 1 file changed, 4 insertions(+)
>>>>>
>>>>> diff --git a/scripts/lib/ptxd_make_dts_dtc.sh b/scripts/lib/ptxd_make_dts_dtc.sh
>>>>> index 24c5604..6a09cae 100644
>>>>> --- a/scripts/lib/ptxd_make_dts_dtc.sh
>>>>> +++ b/scripts/lib/ptxd_make_dts_dtc.sh
>>>>> @@ -59,6 +59,10 @@ ptxd_make_dts_dtb() {
>>>>> -I dts -O dtb -b 0 \
>>>>> -o "${dts_dtb}" "${tmp_dts}"
>>>>>
>>>>> + if [ "$?" != "0" ]; then
>>>>> + ptxd_bailout "Unable to generate ${dts_dtb} file."
>>>>> + fi
>>>>
>>>> What about:
>>>>
>>>> || ptxd_bailout "Unable to generate ${dts_dtb} file."
>>>>
>>>
>>> okay, yes then we could save the if. I can also add
>>>
>>> || ptxd_bailout ... for cpp call.
>>
>> Or better concatenate everything with a && and add || bailout at the end.
>>
>
> uiuiuiui, but we have some other steps in the middle and the most looks
> currently like magic for me. But I think we could do:
>
> sed -e "s;^${tmp_dts}:;${dts_dtb}:;" \
> -e 's;^ \([^ ]*\); $(wildcard \1);' "${tmp_deps}" > "${deps}"
>
> if dtc -h 2>&1 | grep -q '^[[:space:]]\+-i\(,.*\)\?$'; then
> dtc_include="-i $(dirname "${dts}") -i ${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts"
> fi
>
> echo "CPP $(ptxd_print_path "${tmp_dts}")"
> cpp \
> -Wp,-MD,${tmp_deps} \
> -Wp,-MT,${tmp_dts} \
> -nostdinc \
> -P \
> -I$(dirname "${dts}") \
> -I${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts \
> -I${dts_kernel_dir}/arch/${dts_kernel_arch}/boot/dts/include \
> -I${dts_kernel_dir}/drivers/of/testcase-data \
> -I${dts_kernel_dir}/include \
> -undef -D__DTS__ -x assembler-with-cpp \
> -o ${tmp_dts} \
> ${dts} && \
^^^
not needed, as like the others..
> echo "DTC $(ptxd_print_path "${dts_dtb}")" && \
^^^
> dtc \
> $(ptxd_get_ptxconf PTXCONF_DTC_EXTRA_ARGS) \
> ${dtc_include} \
> -d "${tmp_deps}" \
> -I dts -O dtb -b 0 \
> -o "${dts_dtb}" "${tmp_dts}" || \
> ptxd_bailout "Unable to generate ${dts_dtb} file."
>
>
> normally we can forget to check error on echo, but it's in the
> middle of the generation. I also moved the sed and dtc_include setting
> before calling cpp step. I think this should work, maybe it looks a
> little bit ugly, don't know what is a nice indentation. :-/
IMHO No need to rearrange the whole function, just add the missing &&
(and finally a || bailout).
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
[-- Attachment #2: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-07-08 14:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-08 12:59 [ptxdist] [RFC] ptxd_make_dts_dtb: error handling Alexander Aring
2014-07-08 12:59 ` [ptxdist] [RFC] ptxd_make_dts_dtb: check on failure if dtc failed Alexander Aring
2014-07-08 13:22 ` Marc Kleine-Budde
2014-07-08 13:24 ` Alexander Aring
2014-07-08 13:30 ` Marc Kleine-Budde
2014-07-08 13:46 ` Alexander Aring
2014-07-08 14:07 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox