[U-Boot] [PATCH 0/3] Adopt u-boot build to OS X

Latest changes to mkimage, Makefile and added proftool broke compilation on OS X. This series makes u-boot build clean again with some little adoptions.
Patch 'lib/rsa/rsa-sig.c: compile on OS X' supersedes http://patchwork.ozlabs.org/patch/255283/
Andreas Bießmann (3): lib/rsa/rsa-sig.c: compile on OS X tools/proftool: add missing definition Makefile: fix readelf usage
Makefile | 2 +- lib/rsa/rsa-sign.c | 1 - tools/proftool.c | 5 +++++ 3 files changed, 6 insertions(+), 2 deletions(-)

Interfaces exposed by error.h seems not to be used in rsa-sig.c, remove it. This also fixes an compile error on OS X:
---8<--- u-boot/lib/rsa/rsa-sign.c:23:19: error: error.h: No such file or directory --->8---
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com --- Supersedes http://patchwork.ozlabs.org/patch/255283/
lib/rsa/rsa-sign.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c index a75ae24..e30d8ca 100644 --- a/lib/rsa/rsa-sign.c +++ b/lib/rsa/rsa-sign.c @@ -20,7 +20,6 @@ #include "mkimage.h" #include <stdio.h> #include <string.h> -#include <error.h> #include <image.h> #include <time.h> #include <openssl/rsa.h>

Hi Andreas,
Interfaces exposed by error.h seems not to be used in rsa-sig.c, remove it. This also fixes an compile error on OS X:
---8<--- u-boot/lib/rsa/rsa-sign.c:23:19: error: error.h: No such file or directory --->8---
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
Entire series
Tested-by: Lubomir Popov lpopov@mm-sol.com
on MacOS X 10.8.3 with the following tools used for building U-Boot for one ARM (OMAP) board:
arm-none-eabi-gcc (GCC) 4.7.2 GNU ld (GNU Binutils) 2.23.1
Best regards, Lubo

On Sun, Jun 30, 2013 at 8:15 PM, Andreas Bießmann < andreas.devel@googlemail.com> wrote:
Interfaces exposed by error.h seems not to be used in rsa-sig.c, remove it. This also fixes an compile error on OS X:
---8<--- u-boot/lib/rsa/rsa-sign.c:23:19: error: error.h: No such file or directory --->8---
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
Reviewed-by: Simon Glass <sjg@chromium.org?
Thanks for sorting this out. Might even break out my Mac to try it :-)
Supersedes http://patchwork.ozlabs.org/patch/255283/
lib/rsa/rsa-sign.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c index a75ae24..e30d8ca 100644 --- a/lib/rsa/rsa-sign.c +++ b/lib/rsa/rsa-sign.c @@ -20,7 +20,6 @@ #include "mkimage.h" #include <stdio.h> #include <string.h> -#include <error.h> #include <image.h> #include <time.h>
#include <openssl/rsa.h>
1.8.3.1

BSD (like OS X) variants of regex.h do not declare REG_NOERROR, add a simple define for them.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com --- tools/proftool.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/tools/proftool.c b/tools/proftool.c index a48ed28..d910b50 100644 --- a/tools/proftool.c +++ b/tools/proftool.c @@ -35,6 +35,11 @@
#define MAX_LINE_LEN 500
+#ifndef REG_NOERROR +/* BSD regex.h do not expose REG_NOERROR */ +# define REG_NOERROR 0 +#endif + enum { FUNCF_TRACE = 1 << 0, /* Include this function in trace */ };

Hello Andreas,
On 06/30/2013 01:15 PM, Andreas Bießmann wrote:
BSD (like OS X) variants of regex.h do not declare REG_NOERROR, add a simple define for them.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
+#ifndef REG_NOERROR +/* BSD regex.h do not expose REG_NOERROR */ +# define REG_NOERROR 0 +#endif
I think a neater solutions is to actually remove the REG_NOERROR. From man regexec, GNU 2011-09-27: "regexec() returns zero for a successful match or REG_NOMATCH for failure.". Opengroup specs will mention the same. REG_NOERROR is not mentioned at all.
e.g.:
if (err) { regex_report_error(&item->regex, err, "match", item->name); break; }
should do the job in a portable way (and reads a bit better, as well). But this is only a cosmetic comment, the patch by itself should do the job.
Regards, Jeroen
p.s. Strictly speaking it is dead code actually...

Hello Andreas,
On 07/01/2013 08:45 PM, Jeroen Hofstee wrote:
Hello Andreas,
On 06/30/2013 01:15 PM, Andreas Bießmann wrote:
BSD (like OS X) variants of regex.h do not declare REG_NOERROR, add a simple define for them.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
+#ifndef REG_NOERROR +/* BSD regex.h do not expose REG_NOERROR */ +# define REG_NOERROR 0 +#endif
I think a neater solutions is to actually remove the REG_NOERROR. From man regexec, GNU 2011-09-27: "regexec() returns zero for a successful match or REG_NOMATCH for failure.". Opengroup specs will mention the same. REG_NOERROR is not mentioned at all.
e.g.:
if (err) { regex_report_error(&item->regex, err, "match", item->name); break; }
should do the job in a portable way (and reads a bit better, as well). But this is only a cosmetic comment, the patch by itself should do the job.
Just realized this is more then cosmetic. Also GNU will not have REG_NOERROR defined since it is an enum, so it will always take the #ifndef REG_NOERROR road, which boils down to !! 0.
So this needs a new version instead of hiding how this works.
Regards, Jeroe
p.s. Simon, Andreas sorry for spamming, selected the wrong email...

Hi Jeroen,
On 01.07.13 22:12, Jeroen Hofstee wrote:
Hello Andreas,
On 07/01/2013 08:45 PM, Jeroen Hofstee wrote:
Hello Andreas,
On 06/30/2013 01:15 PM, Andreas Bießmann wrote:
BSD (like OS X) variants of regex.h do not declare REG_NOERROR, add a simple define for them.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
+#ifndef REG_NOERROR +/* BSD regex.h do not expose REG_NOERROR */ +# define REG_NOERROR 0 +#endif
I think a neater solutions is to actually remove the REG_NOERROR. From man regexec, GNU 2011-09-27: "regexec() returns zero for a successful match or REG_NOMATCH for failure.". Opengroup specs will mention the same. REG_NOERROR is not mentioned at all.
e.g.:
if (err) { regex_report_error(&item->regex, err, "match", item->name); break; }
should do the job in a portable way (and reads a bit better, as well). But this is only a cosmetic comment, the patch by itself should do the job.
Just realized this is more then cosmetic. Also GNU will not have REG_NOERROR defined since it is an enum, so it will always take the #ifndef REG_NOERROR road, which boils down to !! 0.
So this needs a new version instead of hiding how this works.
you are right, v2 is on the way ...
p.s. Simon, Andreas sorry for spamming, selected the wrong email...
Ouch, sorry! Just realized that I took the wrong mail too.
Best regards
Andreas Bießmann

BSD (like OS X) variants of regex.h do not declare REG_NOERROR, add a simple define for them.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
Tested-by: Lubomir Popov lpopov@mm-sol.com

Some OS (like OS X) do not provide a generic readelf. We should enforce to use the toochain provided readelf instead, to do so use $(CROSS_COMPILE)readelf.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile index ba1c10b..446c2f8 100644 --- a/Makefile +++ b/Makefile @@ -747,7 +747,7 @@ endif # config.mk # ARM relocations should all be R_ARM_RELATIVE. checkarmreloc: $(obj)u-boot @if test "R_ARM_RELATIVE" != \ - "`readelf -r $< | cut -d ' ' -f 4 | grep R_ARM | sort -u`"; \ + "`$(CROSS_COMPILE)readelf -r $< | cut -d ' ' -f 4 | grep R_ARM | sort -u`"; \ then echo "$< contains relocations other than \ R_ARM_RELATIVE"; false; fi

Some OS (like OS X) do not provide a generic readelf. We should enforce to use the toochain provided readelf instead, to do so use $(CROSS_COMPILE)readelf.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
Tested-by: Lubomir Popov lpopov@mm-sol.com

Hi Andreas,
On Sun, 30 Jun 2013 13:15:06 +0200, Andreas Bießmann andreas.devel@googlemail.com wrote:
Some OS (like OS X) do not provide a generic readelf. We should enforce to use the toochain provided readelf instead, to do so use $(CROSS_COMPILE)readelf.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile index ba1c10b..446c2f8 100644 --- a/Makefile +++ b/Makefile @@ -747,7 +747,7 @@ endif # config.mk # ARM relocations should all be R_ARM_RELATIVE. checkarmreloc: $(obj)u-boot @if test "R_ARM_RELATIVE" != \
"`readelf -r $< | cut -d ' ' -f 4 | grep R_ARM | sort -u`"; \
then echo "$< contains relocations other than \ R_ARM_RELATIVE"; false; fi"`$(CROSS_COMPILE)readelf -r $< | cut -d ' ' -f 4 | grep R_ARM | sort -u`"; \
Acked-by: Albert ARIBAUD albert.u.boot@aribaud.net
Tom, do I take this in u-boot-arm and then deliver this later in my PR, or do you want to pick it directly in mainline?
Amicalement,

Hi Albert,
On 07/04/2013 02:09 PM, Albert ARIBAUD wrote:
Hi Andreas,
On Sun, 30 Jun 2013 13:15:06 +0200, Andreas Bießmann andreas.devel@googlemail.com wrote:
Some OS (like OS X) do not provide a generic readelf. We should enforce to use the toochain provided readelf instead, to do so use $(CROSS_COMPILE)readelf.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
<snip>
Acked-by: Albert ARIBAUD albert.u.boot@aribaud.net
Tom, do I take this in u-boot-arm and then deliver this later in my PR, or do you want to pick it directly in mainline?
It is in fact in master [1].
Regards,
Andreas Bießmann
[1] http://git.denx.de/?p=u-boot.git;a=commit;h=c1273d7162bd4bf795f8637cac3532a4...

Hi Andreas,
On Thu, 04 Jul 2013 15:25:53 +0200, "Andreas Bießmann" andreas.devel@googlemail.com wrote:
Hi Albert,
On 07/04/2013 02:09 PM, Albert ARIBAUD wrote:
Hi Andreas,
On Sun, 30 Jun 2013 13:15:06 +0200, Andreas Bießmann andreas.devel@googlemail.com wrote:
Some OS (like OS X) do not provide a generic readelf. We should enforce to use the toochain provided readelf instead, to do so use $(CROSS_COMPILE)readelf.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
<snip>
Acked-by: Albert ARIBAUD albert.u.boot@aribaud.net
Tom, do I take this in u-boot-arm and then deliver this later in my PR, or do you want to pick it directly in mainline?
It is in fact in master [1].
Good! :) I'd missed the 'applied' reply to it.
Regards,
Andreas Bießmann
[1] http://git.denx.de/?p=u-boot.git;a=commit;h=c1273d7162bd4bf795f8637cac3532a4...
Amicalement,
participants (5)
-
Albert ARIBAUD
-
Andreas Bießmann
-
Jeroen Hofstee
-
Lubomir Popov
-
Simon Glass