u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] Fix u-boot compile on darwin host
@ 2014-10-24 21:39 andreas.devel at googlemail.com
  2014-10-24 21:39 ` [U-Boot] [PATCH 1/2] tools/socfpgaimage.c: fix build on darwin andreas.devel at googlemail.com
  2014-10-24 21:39 ` [U-Boot] [PATCH 2/2] tools/kwbimage.c: " andreas.devel at googlemail.com
  0 siblings, 2 replies; 9+ messages in thread
From: andreas.devel at googlemail.com @ 2014-10-24 21:39 UTC (permalink / raw)
  To: u-boot

From: Andreas Bie?mann <andreas.devel@googlemail.com>


This series make u-boot compile on OS X again, tested with Yosemite and Lion.


Andreas Bie?mann (2):
  tools/socfpgaimage.c: fix build on darwin
  tools/kwbimage.c: fix build on darwin

 tools/kwbimage.c     |  6 ++++--
 tools/socfpgaimage.c | 16 ++++++++--------
 2 files changed, 12 insertions(+), 10 deletions(-)

-- 
1.9.3 (Apple Git-50)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/2] tools/socfpgaimage.c: fix build on darwin
  2014-10-24 21:39 [U-Boot] [PATCH 0/2] Fix u-boot compile on darwin host andreas.devel at googlemail.com
@ 2014-10-24 21:39 ` andreas.devel at googlemail.com
  2014-10-24 21:40   ` Marek Vasut
  2014-10-24 21:39 ` [U-Boot] [PATCH 2/2] tools/kwbimage.c: " andreas.devel at googlemail.com
  1 sibling, 1 reply; 9+ messages in thread
From: andreas.devel at googlemail.com @ 2014-10-24 21:39 UTC (permalink / raw)
  To: u-boot

From: Andreas Bie?mann <andreas.devel@googlemail.com>

socfpgaimage utilizes htole32 and friends, unfortunately these functions are
not available on darwin. Fix it by using the cpu_to_le32 and friends defined
in compiler.h as other parts in mkimage do.

This patch fixes the following error:
---8<---
  HOSTCC  tools/socfpgaimage.o
tools/socfpgaimage.c:77:22: warning: implicit declaration of function 'htole32' is invalid in C99 [-Wimplicit-function-declaration]
        header.validation = htole32(VALIDATION_WORD);
                            ^
tools/socfpgaimage.c:80:22: warning: implicit declaration of function 'htole16' is invalid in C99 [-Wimplicit-function-declaration]
        header.length_u32 = htole16(length_bytes/4);
                            ^
tools/socfpgaimage.c:95:6: warning: implicit declaration of function 'le32toh' is invalid in C99 [-Wimplicit-function-declaration]
        if (le32toh(header.validation) != VALIDATION_WORD)
            ^
tools/socfpgaimage.c:97:6: warning: implicit declaration of function 'le16toh' is invalid in C99 [-Wimplicit-function-declaration]
        if (le16toh(header.checksum) != hdr_checksum(&header))
            ^
4 warnings generated.
...
  HOSTLD  tools/dumpimage
Undefined symbols for architecture x86_64:
  "_htole16", referenced from:
      _socfpgaimage_set_header in socfpgaimage.o
  "_htole32", referenced from:
      _socfpgaimage_set_header in socfpgaimage.o
  "_le16toh", referenced from:
      _verify_buffer in socfpgaimage.o
  "_le32toh", referenced from:
      _verify_buffer in socfpgaimage.o
ld: symbol(s) not found for architecture x86_64
--->8---

Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
---

 tools/socfpgaimage.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/socfpgaimage.c b/tools/socfpgaimage.c
index 396d8a5..917873e 100644
--- a/tools/socfpgaimage.c
+++ b/tools/socfpgaimage.c
@@ -74,12 +74,12 @@ static uint16_t hdr_checksum(struct socfpga_header *header)
 static void build_header(uint8_t *buf, uint8_t version, uint8_t flags,
 			 uint16_t length_bytes)
 {
-	header.validation = htole32(VALIDATION_WORD);
+	header.validation = cpu_to_le32(VALIDATION_WORD);
 	header.version = version;
 	header.flags = flags;
-	header.length_u32 = htole16(length_bytes/4);
+	header.length_u32 = cpu_to_le16(length_bytes/4);
 	header.zero = 0;
-	header.checksum = htole16(hdr_checksum(&header));
+	header.checksum = cpu_to_le16(hdr_checksum(&header));
 
 	memcpy(buf, &header, sizeof(header));
 }
@@ -92,12 +92,12 @@ static int verify_header(const uint8_t *buf)
 {
 	memcpy(&header, buf, sizeof(header));
 
-	if (le32toh(header.validation) != VALIDATION_WORD)
+	if (le32_to_cpu(header.validation) != VALIDATION_WORD)
 		return -1;
-	if (le16toh(header.checksum) != hdr_checksum(&header))
+	if (le16_to_cpu(header.checksum) != hdr_checksum(&header))
 		return -1;
 
-	return le16toh(header.length_u32) * 4;
+	return le16_to_cpu(header.length_u32) * 4;
 }
 
 /* Sign the buffer and return the signed buffer size */
@@ -116,7 +116,7 @@ static int sign_buffer(uint8_t *buf,
 	/* Calculate and apply the CRC */
 	calc_crc = ~pbl_crc32(0, (char *)buf, len);
 
-	*((uint32_t *)(buf + len)) = htole32(calc_crc);
+	*((uint32_t *)(buf + len)) = cpu_to_le32(calc_crc);
 
 	if (!pad_64k)
 		return len + 4;
@@ -150,7 +150,7 @@ static int verify_buffer(const uint8_t *buf)
 
 	calc_crc = ~pbl_crc32(0, (const char *)buf, len);
 
-	buf_crc = le32toh(*((uint32_t *)(buf + len)));
+	buf_crc = le32_to_cpu(*((uint32_t *)(buf + len)));
 
 	if (buf_crc != calc_crc) {
 		fprintf(stderr, "CRC32 does not match (%08x != %08x)\n",
-- 
1.9.3 (Apple Git-50)

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/2] tools/kwbimage.c: fix build on darwin
  2014-10-24 21:39 [U-Boot] [PATCH 0/2] Fix u-boot compile on darwin host andreas.devel at googlemail.com
  2014-10-24 21:39 ` [U-Boot] [PATCH 1/2] tools/socfpgaimage.c: fix build on darwin andreas.devel at googlemail.com
@ 2014-10-24 21:39 ` andreas.devel at googlemail.com
  2014-10-27  7:14   ` Stefan Roese
  2014-10-30 22:11   ` Anatolij Gustschin
  1 sibling, 2 replies; 9+ messages in thread
From: andreas.devel at googlemail.com @ 2014-10-24 21:39 UTC (permalink / raw)
  To: u-boot

From: Andreas Bie?mann <andreas.devel@googlemail.com>

kwbimage uses get_current_dir_name(3) which is a gnu extension and not
available on darwin host. Fix this by converting to portable getcwd(3)
function.

This patch fixes the following error:
---8<---
  HOSTCC  tools/kwbimage.o
tools/kwbimage.c:399:16: warning: implicit declaration of function 'get_current_dir_name' is invalid in C99 [-Wimplicit-function-declaration]
                        char *cwd = get_current_dir_name();
                                    ^
tools/kwbimage.c:399:10: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
                        char *cwd = get_current_dir_name();
                              ^     ~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
...
Undefined symbols for architecture x86_64:
  "_get_current_dir_name", referenced from:
      _image_headersz_v1 in kwbimage.o
ld: symbol(s) not found for architecture x86_64
--->8---

Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
Cc: Stefan Roese <sr@denx.de>

---

 tools/kwbimage.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index ca4fc78..8fd70ef 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -12,6 +12,7 @@
  */
 
 #include "imagetool.h"
+#include <limits.h>
 #include <image.h>
 #include <stdint.h>
 #include "kwbimage.h"
@@ -396,13 +397,14 @@ static size_t image_headersz_v1(struct image_tool_params *params,
 
 		ret = stat(binarye->binary.file, &s);
 		if (ret < 0) {
-			char *cwd = get_current_dir_name();
+			char cwd[PATH_MAX];
+			memset(cwd, 0, sizeof(cwd));
+			getcwd(cwd, sizeof(cwd));
 			fprintf(stderr,
 				"Didn't find the file '%s' in '%s' which is mandatory to generate the image\n"
 				"This file generally contains the DDR3 training code, and should be extracted from an existing bootable\n"
 				"image for your board. See 'kwbimage -x' to extract it from an existing image.\n",
 				binarye->binary.file, cwd);
-			free(cwd);
 			return 0;
 		}
 
-- 
1.9.3 (Apple Git-50)

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/2] tools/socfpgaimage.c: fix build on darwin
  2014-10-24 21:39 ` [U-Boot] [PATCH 1/2] tools/socfpgaimage.c: fix build on darwin andreas.devel at googlemail.com
@ 2014-10-24 21:40   ` Marek Vasut
  2014-10-25  9:25     ` Pavel Machek
  0 siblings, 1 reply; 9+ messages in thread
From: Marek Vasut @ 2014-10-24 21:40 UTC (permalink / raw)
  To: u-boot

On Friday, October 24, 2014 at 11:39:10 PM, andreas.devel at googlemail.com wrote:
> From: Andreas Bie?mann <andreas.devel@googlemail.com>
> 
> socfpgaimage utilizes htole32 and friends, unfortunately these functions
> are not available on darwin. Fix it by using the cpu_to_le32 and friends
> defined in compiler.h as other parts in mkimage do.
> 
> This patch fixes the following error:
> ---8<---
>   HOSTCC  tools/socfpgaimage.o
> tools/socfpgaimage.c:77:22: warning: implicit declaration of function
> 'htole32' is invalid in C99 [-Wimplicit-function-declaration]
> header.validation = htole32(VALIDATION_WORD);
>                             ^
> tools/socfpgaimage.c:80:22: warning: implicit declaration of function
> 'htole16' is invalid in C99 [-Wimplicit-function-declaration]
> header.length_u32 = htole16(length_bytes/4);
>                             ^
> tools/socfpgaimage.c:95:6: warning: implicit declaration of function
> 'le32toh' is invalid in C99 [-Wimplicit-function-declaration] if
> (le32toh(header.validation) != VALIDATION_WORD)
>             ^
> tools/socfpgaimage.c:97:6: warning: implicit declaration of function
> 'le16toh' is invalid in C99 [-Wimplicit-function-declaration] if
> (le16toh(header.checksum) != hdr_checksum(&header))
>             ^
> 4 warnings generated.
> ...
>   HOSTLD  tools/dumpimage
> Undefined symbols for architecture x86_64:
>   "_htole16", referenced from:
>       _socfpgaimage_set_header in socfpgaimage.o
>   "_htole32", referenced from:
>       _socfpgaimage_set_header in socfpgaimage.o
>   "_le16toh", referenced from:
>       _verify_buffer in socfpgaimage.o
>   "_le32toh", referenced from:
>       _verify_buffer in socfpgaimage.o
> ld: symbol(s) not found for architecture x86_64
> --->8---
> 
> Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/2] tools/socfpgaimage.c: fix build on darwin
  2014-10-24 21:40   ` Marek Vasut
@ 2014-10-25  9:25     ` Pavel Machek
  2014-10-25 22:51       ` Marek Vasut
  0 siblings, 1 reply; 9+ messages in thread
From: Pavel Machek @ 2014-10-25  9:25 UTC (permalink / raw)
  To: u-boot

On Fri 2014-10-24 23:40:13, Marek Vasut wrote:
> On Friday, October 24, 2014 at 11:39:10 PM, andreas.devel at googlemail.com wrote:
> > From: Andreas Bie?mann <andreas.devel@googlemail.com>
> > 
> > socfpgaimage utilizes htole32 and friends, unfortunately these functions
> > are not available on darwin. Fix it by using the cpu_to_le32 and friends
> > defined in compiler.h as other parts in mkimage do.
> > 
> > This patch fixes the following error:
> > ---8<---
> >   HOSTCC  tools/socfpgaimage.o
> > tools/socfpgaimage.c:77:22: warning: implicit declaration of function
> > 'htole32' is invalid in C99 [-Wimplicit-function-declaration]
> > header.validation = htole32(VALIDATION_WORD);
> >                             ^
> > tools/socfpgaimage.c:80:22: warning: implicit declaration of function
> > 'htole16' is invalid in C99 [-Wimplicit-function-declaration]
> > header.length_u32 = htole16(length_bytes/4);
> >                             ^
> > tools/socfpgaimage.c:95:6: warning: implicit declaration of function
> > 'le32toh' is invalid in C99 [-Wimplicit-function-declaration] if
> > (le32toh(header.validation) != VALIDATION_WORD)
> >             ^
> > tools/socfpgaimage.c:97:6: warning: implicit declaration of function
> > 'le16toh' is invalid in C99 [-Wimplicit-function-declaration] if
> > (le16toh(header.checksum) != hdr_checksum(&header))
> >             ^
> > 4 warnings generated.
> > ...
> >   HOSTLD  tools/dumpimage
> > Undefined symbols for architecture x86_64:
> >   "_htole16", referenced from:
> >       _socfpgaimage_set_header in socfpgaimage.o
> >   "_htole32", referenced from:
> >       _socfpgaimage_set_header in socfpgaimage.o
> >   "_le16toh", referenced from:
> >       _verify_buffer in socfpgaimage.o
> >   "_le32toh", referenced from:
> >       _verify_buffer in socfpgaimage.o
> > ld: symbol(s) not found for architecture x86_64
> > --->8---
> > 
> > Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
> 
> Acked-by: Marek Vasut <marex@denx.de>

Acked-by: Pavel Machek <pavel@denx.de>

Marek, do you want to take it to your tree? Tom was not cc-ed on the
mail, so I'm not sure if you he'll apply it...
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/2] tools/socfpgaimage.c: fix build on darwin
  2014-10-25  9:25     ` Pavel Machek
@ 2014-10-25 22:51       ` Marek Vasut
  0 siblings, 0 replies; 9+ messages in thread
From: Marek Vasut @ 2014-10-25 22:51 UTC (permalink / raw)
  To: u-boot

On Saturday, October 25, 2014 at 11:25:51 AM, Pavel Machek wrote:
> On Fri 2014-10-24 23:40:13, Marek Vasut wrote:
> > On Friday, October 24, 2014 at 11:39:10 PM, andreas.devel at googlemail.com 
wrote:
> > > From: Andreas Bie?mann <andreas.devel@googlemail.com>
> > > 
> > > socfpgaimage utilizes htole32 and friends, unfortunately these
> > > functions are not available on darwin. Fix it by using the cpu_to_le32
> > > and friends defined in compiler.h as other parts in mkimage do.
> > > 
> > > This patch fixes the following error:
> > > ---8<---
> > > 
> > >   HOSTCC  tools/socfpgaimage.o
> > > 
> > > tools/socfpgaimage.c:77:22: warning: implicit declaration of function
> > > 'htole32' is invalid in C99 [-Wimplicit-function-declaration]
> > > header.validation = htole32(VALIDATION_WORD);
> > > 
> > >                             ^
> > > 
> > > tools/socfpgaimage.c:80:22: warning: implicit declaration of function
> > > 'htole16' is invalid in C99 [-Wimplicit-function-declaration]
> > > header.length_u32 = htole16(length_bytes/4);
> > > 
> > >                             ^
> > > 
> > > tools/socfpgaimage.c:95:6: warning: implicit declaration of function
> > > 'le32toh' is invalid in C99 [-Wimplicit-function-declaration] if
> > > (le32toh(header.validation) != VALIDATION_WORD)
> > > 
> > >             ^
> > > 
> > > tools/socfpgaimage.c:97:6: warning: implicit declaration of function
> > > 'le16toh' is invalid in C99 [-Wimplicit-function-declaration] if
> > > (le16toh(header.checksum) != hdr_checksum(&header))
> > > 
> > >             ^
> > > 
> > > 4 warnings generated.
> > > ...
> > > 
> > >   HOSTLD  tools/dumpimage
> > > 
> > > Undefined symbols for architecture x86_64:
> > >   "_htole16", referenced from:
> > >       _socfpgaimage_set_header in socfpgaimage.o
> > >   
> > >   "_htole32", referenced from:
> > >       _socfpgaimage_set_header in socfpgaimage.o
> > >   
> > >   "_le16toh", referenced from:
> > >       _verify_buffer in socfpgaimage.o
> > >   
> > >   "_le32toh", referenced from:
> > >       _verify_buffer in socfpgaimage.o
> > > 
> > > ld: symbol(s) not found for architecture x86_64
> > > --->8---
> > > 
> > > Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
> > 
> > Acked-by: Marek Vasut <marex@denx.de>
> 
> Acked-by: Pavel Machek <pavel@denx.de>

Applied, thanks.

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/2] tools/kwbimage.c: fix build on darwin
  2014-10-24 21:39 ` [U-Boot] [PATCH 2/2] tools/kwbimage.c: " andreas.devel at googlemail.com
@ 2014-10-27  7:14   ` Stefan Roese
  2014-10-30 22:11   ` Anatolij Gustschin
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Roese @ 2014-10-27  7:14 UTC (permalink / raw)
  To: u-boot

On 24.10.2014 23:39, andreas.devel at googlemail.com wrote:
> From: Andreas Bie?mann <andreas.devel@googlemail.com>
>
> kwbimage uses get_current_dir_name(3) which is a gnu extension and not
> available on darwin host. Fix this by converting to portable getcwd(3)
> function.
>
> This patch fixes the following error:
> ---8<---
>    HOSTCC  tools/kwbimage.o
> tools/kwbimage.c:399:16: warning: implicit declaration of function 'get_current_dir_name' is invalid in C99 [-Wimplicit-function-declaration]
>                          char *cwd = get_current_dir_name();
>                                      ^
> tools/kwbimage.c:399:10: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
>                          char *cwd = get_current_dir_name();
>                                ^     ~~~~~~~~~~~~~~~~~~~~~~
> 2 warnings generated.
> ...
> Undefined symbols for architecture x86_64:
>    "_get_current_dir_name", referenced from:
>        _image_headersz_v1 in kwbimage.o
> ld: symbol(s) not found for architecture x86_64
> --->8---
>
> Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
> Cc: Stefan Roese <sr@denx.de>

Acked-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/2] tools/kwbimage.c: fix build on darwin
  2014-10-24 21:39 ` [U-Boot] [PATCH 2/2] tools/kwbimage.c: " andreas.devel at googlemail.com
  2014-10-27  7:14   ` Stefan Roese
@ 2014-10-30 22:11   ` Anatolij Gustschin
  2014-10-30 23:27     ` Anatolij Gustschin
  1 sibling, 1 reply; 9+ messages in thread
From: Anatolij Gustschin @ 2014-10-30 22:11 UTC (permalink / raw)
  To: u-boot

On Fri, 24 Oct 2014 23:39:11 +0200
andreas.devel at googlemail.com wrote:

> From: Andreas Bie?mann <andreas.devel@googlemail.com>
> 
> kwbimage uses get_current_dir_name(3) which is a gnu extension and not
> available on darwin host. Fix this by converting to portable getcwd(3)
> function.
> 
> This patch fixes the following error:
> ---8<---
>   HOSTCC  tools/kwbimage.o
> tools/kwbimage.c:399:16: warning: implicit declaration of function 'get_current_dir_name' is invalid in C99 [-Wimplicit-function-declaration]
>                         char *cwd = get_current_dir_name();
>                                     ^
> tools/kwbimage.c:399:10: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
>                         char *cwd = get_current_dir_name();
>                               ^     ~~~~~~~~~~~~~~~~~~~~~~
> 2 warnings generated.
> ...
> Undefined symbols for architecture x86_64:
>   "_get_current_dir_name", referenced from:
>       _image_headersz_v1 in kwbimage.o
> ld: symbol(s) not found for architecture x86_64
> --->8---
> 
> Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
> Cc: Stefan Roese <sr@denx.de>
> 
> ---
> 
>  tools/kwbimage.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Applied to u-boot-staging. Thanks!

Anatolij

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/2] tools/kwbimage.c: fix build on darwin
  2014-10-30 22:11   ` Anatolij Gustschin
@ 2014-10-30 23:27     ` Anatolij Gustschin
  0 siblings, 0 replies; 9+ messages in thread
From: Anatolij Gustschin @ 2014-10-30 23:27 UTC (permalink / raw)
  To: u-boot

On Thu, 30 Oct 2014 23:11:03 +0100
Anatolij Gustschin <agust@denx.de> wrote:

> On Fri, 24 Oct 2014 23:39:11 +0200
> andreas.devel at googlemail.com wrote:
> 
> > From: Andreas Bie?mann <andreas.devel@googlemail.com>
> > 
> > kwbimage uses get_current_dir_name(3) which is a gnu extension and not
> > available on darwin host. Fix this by converting to portable getcwd(3)
> > function.
> > 
> > This patch fixes the following error:
> > ---8<---
> >   HOSTCC  tools/kwbimage.o
> > tools/kwbimage.c:399:16: warning: implicit declaration of function 'get_current_dir_name' is invalid in C99 [-Wimplicit-function-declaration]
> >                         char *cwd = get_current_dir_name();
> >                                     ^
> > tools/kwbimage.c:399:10: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
> >                         char *cwd = get_current_dir_name();
> >                               ^     ~~~~~~~~~~~~~~~~~~~~~~
> > 2 warnings generated.
> > ...
> > Undefined symbols for architecture x86_64:
> >   "_get_current_dir_name", referenced from:
> >       _image_headersz_v1 in kwbimage.o
> > ld: symbol(s) not found for architecture x86_64
> > --->8---
> > 
> > Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
> > Cc: Stefan Roese <sr@denx.de>
> > 
> > ---
> > 
> >  tools/kwbimage.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> Applied to u-boot-staging. Thanks!

Now I see

tools/kwbimage.c:402:4: warning: ignoring return value of ?getcwd?,
declared with attribute warn_unused_result [-Wunused-result]

So, additionally applied:

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 0a388c8..ec52f9e 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -398,13 +398,19 @@ static size_t image_headersz_v1(struct image_tool_params *params,
 		ret = stat(binarye->binary.file, &s);
 		if (ret < 0) {
 			char cwd[PATH_MAX];
+			char *dir = cwd;
+
 			memset(cwd, 0, sizeof(cwd));
-			getcwd(cwd, sizeof(cwd));
+			if (!getcwd(cwd, sizeof(cwd))) {
+				dir = "current working directory";
+				perror("getcwd() failed");
+			}
+
 			fprintf(stderr,
 				"Didn't find the file '%s' in '%s' which is mandatory to generate the image\n"
 				"This file generally contains the DDR3 training code, and should be extracted from an existing bootable\n"
 				"image for your board. See 'kwbimage -x' to extract it from an existing image.\n",
-				binarye->binary.file, cwd);
+				binarye->binary.file, dir);
 			return 0;
 		}
 

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-10-30 23:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-24 21:39 [U-Boot] [PATCH 0/2] Fix u-boot compile on darwin host andreas.devel at googlemail.com
2014-10-24 21:39 ` [U-Boot] [PATCH 1/2] tools/socfpgaimage.c: fix build on darwin andreas.devel at googlemail.com
2014-10-24 21:40   ` Marek Vasut
2014-10-25  9:25     ` Pavel Machek
2014-10-25 22:51       ` Marek Vasut
2014-10-24 21:39 ` [U-Boot] [PATCH 2/2] tools/kwbimage.c: " andreas.devel at googlemail.com
2014-10-27  7:14   ` Stefan Roese
2014-10-30 22:11   ` Anatolij Gustschin
2014-10-30 23:27     ` Anatolij Gustschin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).