barebox: add option to build bareboxenv for target
authorPeter Korsgaard <jacmet@sunsite.dk>
Sun, 6 Feb 2011 20:40:19 +0000 (21:40 +0100)
committerPeter Korsgaard <jacmet@sunsite.dk>
Sun, 6 Feb 2011 20:40:19 +0000 (21:40 +0100)
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
boot/barebox/Config.in
boot/barebox/barebox.mk

index 0c90f03823edad51a320f3894c7e828de950786d..a821c45c00f7168aa5ceaefe7d5a903f22ab81c9 100644 (file)
@@ -11,4 +11,10 @@ config BR2_TARGET_BAREBOX_BOARD_DEFCONFIG
        help
          Name of the board for which Barebox should be built, without
          the _defconfig suffix.
+
+config BR2_TARGET_BAREBOX_BAREBOXENV
+       bool "bareboxenv tool in target"
+       help
+         Install bareboxenv tool in target.
+
 endif
index 07266d996b81cb012a9c566aa8fa1356cd5e8807..09deb5cd29d76beab5c38bf414100bb4d89c8c05 100644 (file)
@@ -48,7 +48,14 @@ $(BAREBOX_DIR)/.installed: $(BAREBOX_DIR)/.built
        cp $(BAREBOX_DIR)/barebox.bin $(BINARIES_DIR)
        touch $@
 
-barebox: $(BAREBOX_DIR)/.installed
+# bareboxenv for the target
+$(TARGET_DIR)/usr/bin/bareboxenv: $(BAREBOX_DIR)/.configured
+       mkdir -p $(@D)
+       $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -o $@ \
+               $(BAREBOX_DIR)/scripts/bareboxenv.c
+
+barebox: $(BAREBOX_DIR)/.installed \
+       $(if $(BR2_TARGET_BAREBOX_BAREBOXENV),$(TARGET_DIR)/usr/bin/bareboxenv)
 
 ifeq ($(BR2_TARGET_BAREBOX),y)
 TARGETS+=barebox