Signed-off-by: Marc Kleine-Budde <m...@pengutronix.de>
---

Changes since v2:
- correction of subject and help text: crc -> crc32
- more typos in help text fixes

Marc

 platforms/barebox.in | 23 +++++++++++++++++++++++
 rules/barebox.make   | 44 +++++++++++++++++++++++++++++++-------------
 2 files changed, 54 insertions(+), 13 deletions(-)

diff --git a/platforms/barebox.in b/platforms/barebox.in
index 9364e78473c7..a40118973847 100644
--- a/platforms/barebox.in
+++ b/platforms/barebox.in
@@ -54,6 +54,29 @@ config BAREBOX_BAREBOXENV
          environment. Enable this option access the barebox environment
          from the target Linux system.
 
+config BAREBOX_BAREBOXCRC32
+       prompt "install 'bareboxcrc32'"
+       bool
+       help
+         The tool 'bareboxcrc32' can be used to calculate the crc32 of
+         files, with the same crc32 flavour that the barebox crc32
+         command uses.
+
+config BAREBOX_KERNEL_INSTALL
+       prompt "install 'kernel-install'"
+       bool
+       help
+         The tool 'kernel-install' can be used to install a kernel
+         according to the bootloader spec:
+         http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/
+
+config BAREBOX_BAREBOXIMD
+       prompt "install 'bareboximd'"
+       bool
+       help
+         The tool 'bareboximd' can be used to extract metadata from
+         the (flashed) barebox image.
+
 config BAREBOX_NEEDS_HOST_LIBUSB
        prompt "barebox needs libusb"
        bool
diff --git a/rules/barebox.make b/rules/barebox.make
index 5f938db03db1..60d8e2e8bb05 100644
--- a/rules/barebox.make
+++ b/rules/barebox.make
@@ -107,18 +107,32 @@ $(STATEDIR)/barebox.compile:
 # Install
 # ----------------------------------------------------------------------------
 
+BAREBOX_PROGS_HOST := \
+       bareboxenv \
+       kernel-install \
+       bareboxcrc32 \
+       bareboximd \
+       setupmbr/setupmbr
+
+BAREBOX_PROGS_TARGET_y :=
+BAREBOX_PROGS_TARGET_$(PTXCONF_BAREBOX_BAREBOXENV) += bareboxenv
+BAREBOX_PROGS_TARGET_$(PTXCONF_BAREBOX_BAREBOXCRC32) += kernel-install
+BAREBOX_PROGS_TARGET_$(PTXCONF_BAREBOX_KERNEL_INSTALL) += bareboxcrc32
+BAREBOX_PROGS_TARGET_$(PTXCONF_BAREBOX_BAREBOXIMD) += bareboximd
+
 $(STATEDIR)/barebox.install:
        @$(call targetinfo)
-       @install -v -D -m755 $(BAREBOX_DIR)/scripts/bareboxenv 
$(PTXCONF_SYSROOT_HOST)/bin/bareboxenv
-       @if [ -e $(BAREBOX_DIR)/scripts/bareboxcrc32 ]; then \
-               install -v -D -m755 $(BAREBOX_DIR)/scripts/bareboxcrc32 
$(PTXCONF_SYSROOT_HOST)/bin/bareboxcrc32; \
-       fi
-ifdef PTXCONF_ARCH_X86
-       @if [ -e $(BAREBOX_DIR)/scripts/setupmbr/setupmbr ]; then \
-               install -v -D -m755 $(BAREBOX_DIR)/scripts/setupmbr/setupmbr \
-                       $(PTXCONF_SYSROOT_HOST)/bin/setupmbr; \
-       fi
-endif
+
+       @$(foreach prog, $(BAREBOX_PROGS_HOST), \
+               if [ -e $(BAREBOX_DIR)/scripts/$(prog) ]; then \
+                       install -v -D -m755 $(BAREBOX_DIR)/scripts/$(prog) \
+                               $(PTXCONF_SYSROOT_HOST)/bin/$(notdir $(prog)); \
+               fi;)
+
+       @$(foreach prog, $(BAREBOX_PROGS_TARGET_y), \
+               install -v -D -m755 $(BAREBOX_DIR)/scripts/$(prog)-target \
+                       $(BAREBOX_PKGDIR)/usr/bin/$(prog);)
+
        @$(call touch)
 
 # ----------------------------------------------------------------------------
@@ -128,18 +142,20 @@ endif
 $(STATEDIR)/barebox.targetinstall:
        @$(call targetinfo)
 
-ifdef PTXCONF_BAREBOX_BAREBOXENV
+ifneq ($(strip $(BAREBOX_PROGS_TARGET_y)),)
        @$(call install_init, barebox)
        @$(call install_fixup, barebox,PRIORITY,optional)
        @$(call install_fixup, barebox,SECTION,base)
        @$(call install_fixup, barebox,AUTHOR,"Robert Schwebel 
<r.schwe...@pengutronix.de>")
        @$(call install_fixup, barebox,DESCRIPTION,missing)
 
-       @$(call install_copy, barebox, 0, 0, 0755, 
$(BAREBOX_DIR)/scripts/bareboxenv-target, \
-               /usr/bin/bareboxenv)
+       @$(foreach prog, $(BAREBOX_PROGS_TARGET_y), \
+               $(call install_copy, barebox, 0, 0, 0755, -, \
+                       /usr/bin/$(prog));)
 
        @$(call install_finish, barebox)
 endif
+
        @rm -f $(IMAGEDIR)/barebox-image
        @find $(BAREBOX_DIR)/images/ -name "barebox-*.img" | sort | while read 
image; do \
                install -D -m644 $$image $(IMAGEDIR)/`basename $$image`; \
@@ -170,6 +186,8 @@ endif
 $(STATEDIR)/barebox.clean:
        @$(call targetinfo)
        @$(call clean_pkg, BAREBOX)
+       @$(foreach prog, $(BAREBOX_PROGS_HOST), \
+               rm -rf $(PTXCONF_SYSROOT_HOST)/bin/$(notdir $(prog));)
        rm -rf $(IMAGEDIR)/barebox-image $(IMAGEDIR)/barebox-default-environment
 
 # ----------------------------------------------------------------------------
-- 
2.7.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to