Skip to contentSkip to conversation

Adopt u-boot build to OS X

PATCH New Andreas Bießmann 5 participants 14 messages Jun 30, 2013 – Jul 4, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/3 lib/rsa/rsa-sig.c: compile on OS X

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---

---
Supersedes http://patchwork.ozlabs.org/patch/255283/

 lib/rsa/rsa-sign.c | 1 -
 1 file changed, 1 deletion(-)
lib/rsa/rsa-sign.c +0 -1
index a75ae24..e30d8ca 100644
@@ -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>
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 1/3 lib/rsa/rsa-sig.c: compile on OS X

Hi Andreas,

Quoted 9 lines

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---

---

Entire series

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

#3 lore raw

PATCH 1/3 lib/rsa/rsa-sig.c: compile on OS X

In reply to Andreas Bießmann
Quoted 9 lines · Andreas Bie?mann

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---

Thanks for sorting this out. Might even break out my Mac to try it :-)

Quoted 22 lines

---
Supersedes http://patchwork.ozlabs.org/patch/255283/

 lib/rsa/rsa-sign.c | 1 -
 1 file changed, 1 deletion(-)
lib/rsa/rsa-sign.c +0 -2
index a75ae24..e30d8ca 100644
@@ -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

#4 lore raw

PATCH 2/3 tools/proftool: add missing definition

In reply to Andreas Bießmann

BSD (like OS X) variants of regex.h do not declare REG_NOERROR, add a simple define for them.

---
 tools/proftool.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/proftool.c +5 -0
index a48ed28..d910b50 100644
@@ -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 */
 };
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH 2/3 tools/proftool: add missing definition

Hello Andreas,

tools/proftool.c line 42

Quoted 11 lines · Andreas Bie?mann

BSD (like OS X) variants of regex.h do not declare REG_NOERROR, add a simple define for them.

---

tools/proftool.c +5 -0
+#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...

#6 lore raw

PATCH 2/3 tools/proftool: add missing definition

Hello Andreas,

Quoted 27 lines · Jeroen Hofstee

Hello Andreas,

tools/proftool.c line 42

Quoted 11 lines · Andreas Bie?mann

BSD (like OS X) variants of regex.h do not declare REG_NOERROR, add a simple
define for them.

---
+#ifndef REG_NOERROR

tools/proftool.c +4 -0
+/* 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;
        }
Quoted 4 lines

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...

#7 lore raw

PATCH 2/3 tools/proftool: add missing definition

Hi Jeroen,

Quoted 34 lines · Jeroen Hofstee

Hello Andreas,

Quoted 27 lines · Jeroen Hofstee

Hello Andreas,

tools/proftool.c line 42

Quoted 11 lines · Andreas Bie?mann

BSD (like OS X) variants of regex.h do not declare REG_NOERROR, add a simple
define for them.

---
+#ifndef REG_NOERROR

tools/proftool.c +4 -0
+/* 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;
        }
Quoted 4 lines

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.

Quoted 5 lines

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 ...

Quoted 1 line

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

#9 lore raw

PATCH 3/3 Makefile: fix readelf usage

In reply to Andreas Bießmann

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.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index ba1c10b..446c2f8 100644
@@ -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
 
Signature · 1 line
1.8.3.1
#11 lore raw

PATCH 3/3 Makefile: fix readelf usage

In reply to Andreas Bießmann

Hi Andreas,

Quoted 13 lines · Andreas Bie?mann

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.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index ba1c10b..446c2f8 100644

Makefile endif # config.mk · line 752

Quoted 7 lines
Makefile +1 -1
@@ -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

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,

Signature · 1 line
Albert.
#12 lore raw

PATCH 3/3 Makefile: fix readelf usage

Hi Albert,

Quoted 12 lines · Albert ARIBAUD

Hi Andreas,

Quoted 7 lines · Andreas Bie?mann

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.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

<snip>

Quoted 5 lines

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=c1273d7162bd4bf795f8637cac3532a490dd9024

#13 lore raw

PATCH 3/3 Makefile: fix readelf usage

Hi Andreas,

Quoted 19 lines · Andreas Bie?mann

Hi Albert,

Quoted 12 lines · Albert ARIBAUD

Hi Andreas,

Quoted 7 lines · Andreas Bie?mann

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.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

<snip>

Quoted 1 line
Quoted 6 lines
Quoted 4 lines

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.

Quoted 6 lines

Regards,

Andreas Bie?mann

[1]
http://git.denx.de/?p=u-boot.git;a=commit;h=c1273d7162bd4bf795f8637cac3532a490dd9024

Amicalement,

Signature · 1 line
Albert.