public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] kbuild/makefile: allow building host tools separately
Date: Thu, 20 Mar 2014 21:23:10 +0400	[thread overview]
Message-ID: <1395336190-17175-1-git-send-email-abrodkin@synopsys.com> (raw)

Sometimes it is required to build only host U-Boot tools without building
U-Boot itself for either board.

For example:
 * In "buildroot" "uboot-tools" could be built for host just to have an ability
   to create uImage.
 * Linux distributions ship "mkimage" utility as a separate substance.

This patch allows building host U-Boot tools separately from U-Boot itself and
what is more important user only needs to have host compiler (gcc).

To build host tools just execute:
=====
make tools HOST_TOOLS_ONLY=yes
=====

Without this patch to generate tools user needs:
 1. Configure any existing board with "make XXX_config"
 2. Execute tools building but still cross-compiler will be invoked and if
    there's no proper cross-compiler in PATH compilation will fail.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
---
 Kbuild   | 5 +++++
 Makefile | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/Kbuild b/Kbuild
index 1d89761..b5e348d 100644
--- a/Kbuild
+++ b/Kbuild
@@ -4,6 +4,9 @@
 # 1) Generate generic-asm-offsets.h
 # 2) Generate asm-offsets.h
 
+# Don't execute target below if building host tools only
+ifneq ($(HOST_TOOLS_ONLY),yes)
+
 #####
 # 1) Generate generic-asm-offsets.h
 
@@ -85,3 +88,5 @@ $(CPUDIR)/$(SOC)/asm-offsets.s: $(CPUDIR)/$(SOC)/asm-offsets.c FORCE
 
 $(obj)/$(offsets-file): $(CPUDIR)/$(SOC)/asm-offsets.s
 	$(call cmd,offsets)
+
+endif
diff --git a/Makefile b/Makefile
index b795338..2fb8ea1 100644
--- a/Makefile
+++ b/Makefile
@@ -481,9 +481,12 @@ ifeq ($(dot-config),1)
 # load other configuration
 include $(srctree)/config.mk
 
+# Don't check for config.mk presence if building host tools only
+ifneq ($(HOST_TOOLS_ONLY),yes)
 ifeq ($(wildcard include/config.mk),)
 $(error "System not configured - see README")
 endif
+endif
 
 # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
 # that (or fail if absent).  Otherwise, search for a linker script in a
@@ -994,10 +997,14 @@ ifeq ($(CONFIG_SYS_GENERIC_BOARD),y)
 	@/bin/false
 endif
 endif
+
+# Don't check for ldscript presence if building host tools only
+ifneq ($(HOST_TOOLS_ONLY),yes)
 ifeq ($(wildcard $(LDSCRIPT)),)
 	@echo >&2 "  Could not find linker script."
 	@/bin/false
 endif
+endif
 
 archprepare: prepare1 scripts_basic
 
-- 
1.8.5.3

             reply	other threads:[~2014-03-20 17:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 17:23 Alexey Brodkin [this message]
2014-03-28  6:36 ` [U-Boot] [PATCH] kbuild/makefile: allow building host tools separately Masahiro Yamada
2014-03-28 21:58   ` Alexey Brodkin
2014-03-31  1:43     ` Masahiro Yamada
2014-03-31  5:52       ` Alexey Brodkin
2014-03-31  6:43         ` Masahiro Yamada

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=1395336190-17175-1-git-send-email-abrodkin@synopsys.com \
    --to=alexey.brodkin@synopsys.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