[U-Boot] [PATCH] bin_dep.sh Support

Prafulla Wadaskar prafulla at marvell.com
Fri Apr 3 13:49:18 CEST 2009


From: prafulla_wadaskar <prafulla at marvell.com>

In some cases the u-boot.bin need to be processed further
to create bootable u-boot binary from boot device
This processing may be cpu,soc and/or board spcific
bin_dep.sh provides a mechanism to execute bin_dep.sh
if present in above platform specific folders

Signed-off-by: prafulla_wadaskar <prafulla at marvell.com>
---
 Makefile         |    2 +
 tools/bin_dep.sh |   79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100755 tools/bin_dep.sh

diff --git a/Makefile b/Makefile
index f857641..8bf36ce 100644
--- a/Makefile
+++ b/Makefile
@@ -318,6 +318,7 @@ $(obj)u-boot.srec:	$(obj)u-boot
 
 $(obj)u-boot.bin:	$(obj)u-boot
 		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
+		@./tools/bin_dep.sh $(CPU) $(BOARD) $(VENDOR) $(SOC) $@
 
 $(obj)u-boot.ldr:	$(obj)u-boot
 		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
@@ -3506,6 +3507,7 @@ clean:
 	       $(obj)tools/gen_eth_addr    $(obj)tools/img2srec		  \
 	       $(obj)tools/mkimage	   $(obj)tools/mpc86x_clk	  \
 	       $(obj)tools/ncb		   $(obj)tools/ubsha1
+	@./tools/bin_dep.sh $(CPU) $(BOARD) $(VENDOR) $(SOC) $@
 	@rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image}	  \
 	       $(obj)board/netstar/{eeprom,crcek,crcit,*.srec,*.bin}	  \
 	       $(obj)board/trab/trab_fkt   $(obj)board/voiceblue/eeprom   \
diff --git a/tools/bin_dep.sh b/tools/bin_dep.sh
new file mode 100755
index 0000000..b32e2ab
--- /dev/null
+++ b/tools/bin_dep.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Prafulla Wadaskar <prafulla at marvell.com>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+# Some platform may require additional post processing of u-boot.bin
+# to create usefull binaries
+# This script will be executed after each make u-boot.bin and make clean operation
+
+CUR_DIR=`pwd`
+CPU_DIR=$CUR_DIR/cpu/$1
+SOC_DIR=$CPU_DIR/$4
+BOARD_DIR=$CUR_DIR/board/$2
+VENDOR_DIR=$CUR_DIR/board/$3
+VENDOR_BOARD_DIR=$CUR_DIR/board/$3/$2
+DEFAULT_ARG=$5
+#default argument will be <binary name> to be processed in case of build
+#default argument will be "clean" in case of mrproper/distclean operation
+BIN_ARGS=$DEFAULT_ARG
+
+#echo CPU_DIR $CPU_DIR
+#echo SOC_DIR $SOC_DIR
+#echo BOARD_DIR $BOARD_DIR
+#echo VENDOR_DIR $VENDOR_DIR
+#echo VENDOR_BOARD_DIR $VENDOR_BOARD_DIR
+#echo BIN_ARGS $BIN_ARGS
+
+if [ -d $CPU_DIR ]; then
+	if [ -f $CPU_DIR/bin_dep.sh ]; then
+		$CPU_DIR/bin_dep.sh $BIN_ARGS $CPU_DIR
+	else
+		if [ -d $SOC_DIR ]; then
+			if [ -f $SOC_DIR/bin_dep.sh ]; then
+				$SOC_DIR/bin_dep.sh $BIN_ARGS $SOC_DIR
+			fi
+		fi
+	fi
+fi
+
+
+if [ -d $BOARD_DIR ]; then
+	if [ -f $BOARD_DIR/bin_dep.sh ]; then
+		$BOARD_DIR/bin_dep.sh $BIN_ARGS $BOARD_DIR
+	fi
+else
+	if [ -d $VENDOR_DIR ]; then
+		if [ -f $VENDOR_DIR/bin_dep.sh ]; then
+			$VENDOR_DIR/bin_dep.sh $BIN_ARGS $VENDOR_DIR
+		else
+			if [ -d $VENDOR_BOARD_DIR ]; then
+				if [ -f $VENDOR_BOARD_DIR/bin_dep.sh ]; then
+					$VENDOR_BOARD_DIR/bin_dep.sh $BIN_ARGS $VENDOR_BOARD_DIR
+				fi
+			fi
+		fi
+	fi
+fi
+
+
-- 
1.5.3.3



More information about the U-Boot mailing list