From patchwork Fri Oct 24 21:39:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_Bie=C3=9Fmann?= X-Patchwork-Id: 403240 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5F01614007D for ; Mon, 27 Oct 2014 02:27:14 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7A322A7A14; Sun, 26 Oct 2014 16:25:51 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fXqVzsp35vka; Sun, 26 Oct 2014 16:25:51 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B0B68A795B; Sun, 26 Oct 2014 16:24:07 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5A2974B629 for ; Fri, 24 Oct 2014 23:39:30 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qGHmwBdQpwoa for ; Fri, 24 Oct 2014 23:39:30 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from cyclops.biessmann.org (cyclops.biessmann.org [134.0.25.77]) by theia.denx.de (Postfix) with ESMTP id 3DF704B628 for ; Fri, 24 Oct 2014 23:39:29 +0200 (CEST) Received: from localhost (er.biessmann.org [80.81.14.92]) by cyclops.biessmann.org (Postfix) with ESMTPSA id E623CB6262; Fri, 24 Oct 2014 23:39:28 +0200 (CEST) From: andreas.devel@googlemail.com To: u-boot@lists.denx.de Date: Fri, 24 Oct 2014 23:39:11 +0200 Message-Id: <1414186751-3061-3-git-send-email-andreas.devel@googlemail.com> X-Mailer: git-send-email 1.9.3 (Apple Git-50) In-Reply-To: <1414186751-3061-1-git-send-email-andreas.devel@googlemail.com> References: <1414186751-3061-1-git-send-email-andreas.devel@googlemail.com> MIME-Version: 1.0 Cc: Stefan Roese , Guilherme Maciel Ferreira Subject: [U-Boot] [PATCH 2/2] tools/kwbimage.c: fix build on darwin X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Andreas Bießmann 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 Cc: Stefan Roese Acked-by: Stefan Roese --- 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 #include #include #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; }