From: Remy Bohmer <[email protected]>

Add config option that can be used to install u-boot tools on target
Current tools that can be selected:
- fw_setenv
- fw_printenv
- gen_eth_addr

Signed-off-by: Remy Bohmer <[email protected]>
Signed-off-by: Ivo Sieben <[email protected]>
---
 platforms/u-boot.in |    6 ++++++
 rules/u-boot.make   |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/platforms/u-boot.in b/platforms/u-boot.in
index e5401d6..f3a7a63 100644
--- a/platforms/u-boot.in
+++ b/platforms/u-boot.in
@@ -79,5 +79,11 @@ config U_BOOT_INSTALL_U_BOOT_IMG

 endif

+config U_BOOT_INSTALL_TOOLS
+       prompt "install u-boot userspace tools"
+       bool
+       help
+         Installs the u-boot user space tools (fw_printenv, fw_setenv &
+         gen_eth_addr) tools in the target image.
 endif

diff --git a/rules/u-boot.make b/rules/u-boot.make
index 36760ee..7ab9959 100644
--- a/rules/u-boot.make
+++ b/rules/u-boot.make
@@ -50,11 +50,30 @@ $(STATEDIR)/u-boot.prepare:
        @$(call touch)

 # ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/u-boot.compile:
+       @$(call targetinfo)
+       @$(call world/compile,U_BOOT)
+ifdef PTXCONF_U_BOOT_INSTALL_TOOLS
+       @cd $(U_BOOT_DIR) && make env CROSS_COMPILE=$(BOOTLOADER_CROSS_COMPILE) 
HOSTCC=$(PTXCONF_GNU_TARGET)-gcc
+       @cd $(U_BOOT_DIR) && make eth CROSS_COMPILE=$(BOOTLOADER_CROSS_COMPILE) 
HOSTCC=$(PTXCONF_GNU_TARGET)-gcc
+endif
+       @$(call touch)
+
+# ----------------------------------------------------------------------------
 # Install
 # ----------------------------------------------------------------------------

 $(STATEDIR)/u-boot.install:
        @$(call targetinfo)
+ifdef PTXCONF_U_BOOT_INSTALL_TOOLS
+       @mkdir -p $(U_BOOT_PKGDIR)/usr/bin/ $(U_BOOT_PKGDIR)/etc/
+       @install -D -m 755 $(U_BOOT_DIR)/tools/env/fw_printenv 
$(U_BOOT_PKGDIR)/usr/bin/
+       @ln -sf fw_printenv $(U_BOOT_PKGDIR)/usr/bin/fw_setenv
+       @install -D -m 755 $(U_BOOT_DIR)/tools/eth/gen_eth_addr 
$(U_BOOT_PKGDIR)/usr/bin/
+endif
        @$(call touch)

 # ----------------------------------------------------------------------------
@@ -76,6 +95,21 @@ endif
 ifdef PTXCONF_U_BOOT_INSTALL_U_BOOT_IMG
        @install -D -m644 $(U_BOOT_DIR)/u-boot.img $(IMAGEDIR)/u-boot.img
 endif
+
+ifdef PTXCONF_U_BOOT_INSTALL_TOOLS
+       @$(call install_init, u-boot)
+       @$(call install_fixup, u-boot,PRIORITY,optional)
+       @$(call install_fixup, u-boot,SECTION,base)
+       @$(call install_fixup, u-boot,AUTHOR,"Remy Bohmer <[email protected]>")
+       @$(call install_fixup, u-boot,DESCRIPTION,missing)
+
+       @$(call install_copy, u-boot, 0, 0, 0755, -, /usr/bin/fw_printenv)
+       @$(call install_link, u-boot, fw_printenv, /usr/bin/fw_setenv)
+       @$(call install_copy, u-boot, 0, 0, 0755, -, /usr/bin/gen_eth_addr)
+
+       @$(call install_finish, u-boot)
+endif
+
        @$(call touch)

 # ----------------------------------------------------------------------------
--
1.7.9.5


-- 
ptxdist mailing list
[email protected]

Reply via email to