From patchwork Thu Dec 22 18:39:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 132888 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 C60CDB7199 for ; Fri, 23 Dec 2011 06:31:15 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D5EF62819C; Thu, 22 Dec 2011 20:31:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 lll551y3Z0wH; Thu, 22 Dec 2011 20:31:12 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5B16028189; Thu, 22 Dec 2011 20:31:03 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 462602815C for ; Thu, 22 Dec 2011 19:39:54 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 VO6Vist2nhyl for ; Thu, 22 Dec 2011 19:39:52 +0100 (CET) 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 mail-gx0-f172.google.com (mail-gx0-f172.google.com [209.85.161.172]) by theia.denx.de (Postfix) with ESMTPS id 101C62815A for ; Thu, 22 Dec 2011 19:39:50 +0100 (CET) Received: by ggnk5 with SMTP id k5so6190725ggn.3 for ; Thu, 22 Dec 2011 10:39:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=tYyPN7RAUR4yBHcrQsVfJsYe0twehS9mKU1okgUgjGk=; b=mmIo2NkbS/mJC1bLA1ojgJT6kOvfhbVRQkkPOLJVia2Iln5RKIMDcBlQR6qW8qrEMq pcMMonY4UliV5N3hGCW9iR6FIjNF3nWPdZU+cdq+psZPidHOqmvfhj+UZ+ueCyu/7Mcg /PHdQ2AsdLJW7gSmYa8nPO3Yx6CsjygA3TF2o= Received: by 10.50.40.129 with SMTP id x1mr11917168igk.4.1324579188462; Thu, 22 Dec 2011 10:39:48 -0800 (PST) Received: from localhost.localdomain (74-93-5-105-SFBA.hfc.comcastbusiness.net. [74.93.5.105]) by mx.google.com with ESMTPS id l28sm31694808ibc.3.2011.12.22.10.39.46 (version=SSLv3 cipher=OTHER); Thu, 22 Dec 2011 10:39:47 -0800 (PST) From: Grant Erickson To: u-boot@lists.denx.de Date: Thu, 22 Dec 2011 10:39:35 -0800 Message-Id: <1324579175-26503-1-git-send-email-marathon96@gmail.com> X-Mailer: git-send-email 1.7.7.3 X-Mailman-Approved-At: Thu, 22 Dec 2011 20:31:00 +0100 Cc: Grant Erickson Subject: [U-Boot] [PATCH] tools/env: fix cross-compilation X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This patch fixes the make infrastructure for the fw_printenv tool such that it is built, by default, as a cross-compilation for the target board when so requested with TOOLSUBDIRS on the U-Boot make command line. Signed-off-by: Grant Erickson --- tools/env/Makefile | 18 +++++++++--------- tools/env/README | 19 ++++++++++++++----- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/tools/env/Makefile b/tools/env/Makefile index 28b73da..705d5e8 100644 --- a/tools/env/Makefile +++ b/tools/env/Makefile @@ -23,24 +23,24 @@ include $(TOPDIR)/config.mk -HOSTSRCS := $(SRCTREE)/lib/crc32.c fw_env.c fw_env_main.c +SRCS := $(SRCTREE)/lib/crc32.c fw_env.c fw_env_main.c HEADERS := fw_env.h # Compile for a hosted environment on the target -HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \ - -idirafter $(OBJTREE)/include2 \ - -idirafter $(OBJTREE)/include \ - -DUSE_HOSTCC +CPPFLAGS = -Wall \ + -idirafter $(SRCTREE)/include \ + -idirafter $(OBJTREE)/include2 \ + -idirafter $(OBJTREE)/include \ + -DUSE_HOSTCC ifeq ($(MTD_VERSION),old) -HOSTCPPFLAGS += -DMTD_OLD +CPPFLAGS += -DMTD_OLD endif all: $(obj)fw_printenv -# Some files complain if compiled with -pedantic, use HOSTCFLAGS_NOPED -$(obj)fw_printenv: $(HOSTSRCS) $(HEADERS) - $(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTLDFLAGS) -o $@ $(HOSTSRCS) +$(obj)fw_printenv: $(SRCS) $(HEADERS) + $(CROSS_COMPILE)gcc $(CPPFLAGS) $(SRCS) -o $@ clean: rm -f $(obj)fw_printenv diff --git a/tools/env/README b/tools/env/README index 3f0d77e..5b02f7d 100644 --- a/tools/env/README +++ b/tools/env/README @@ -2,11 +2,20 @@ This is a demo implementation of a Linux command line tool to access the U-Boot's environment variables. -In the current version, there is an issue in cross-compilation. -In order to cross-compile fw_printenv, run - make HOSTCC= env -in the root directory of the U-Boot distribution. For example, - make HOSTCC=arm-linux-gcc env +To build it for your target board along with U-Boot itself, simply add: + + TOOLSUBDIRS=env + +to your make invocation such as: + + make -C u-boot/source \ + O=$(CURDIR)/u-boot/build \ + TOOLSUBDIRS=env \ + all + +and you will find, for example: + + $(CURDIR)/u-boot/build/tools/env/fw_printenv For the run-time utiltity configuration uncomment the line #define CONFIG_FILE "/etc/fw_env.config"