From: Grant Erickson <marathon96@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] tools/env: fix cross-compilation
Date: Thu, 22 Dec 2011 10:39:35 -0800 [thread overview]
Message-ID: <1324579175-26503-1-git-send-email-marathon96@gmail.com> (raw)
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 <marathon96@gmail.com>
---
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=<your CC cross-compiler> 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"
--
1.7.7.3
next reply other threads:[~2011-12-22 18:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-22 18:39 Grant Erickson [this message]
2012-01-05 23:18 ` [U-Boot] [PATCH] tools/env: fix cross-compilation Mike Frysinger
2012-01-05 23:25 ` Grant Erickson
2012-01-08 6:54 ` Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1324579175-26503-1-git-send-email-marathon96@gmail.com \
--to=marathon96@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox