[PATCH 5/6] eukrea-cpuimx25: enable dfu sequence conditionaly

Eric Bénard eric at eukrea.com
Fri Sep 25 08:48:51 PDT 2015


this can be useful on the evaluation board but we don't want
the sequence to launch on custom board when there is not the
switch button on gpio 82

Signed-off-by: Eric Bénard <eric at eukrea.com>
---
 arch/arm/boards/eukrea_cpuimx25/env/bin/init_board | 26 ++++++++++++----------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/arch/arm/boards/eukrea_cpuimx25/env/bin/init_board b/arch/arm/boards/eukrea_cpuimx25/env/bin/init_board
index 58e07e0..8f4151c 100644
--- a/arch/arm/boards/eukrea_cpuimx25/env/bin/init_board
+++ b/arch/arm/boards/eukrea_cpuimx25/env/bin/init_board
@@ -9,24 +9,26 @@ elif [ -f /env/logo.bmp.lzo ]; then
 	fb0.enable=1
 fi
 
-gpio_get_value 82
-if [ $? -eq 0 ]; then
-	gpio_set_value 83 0
-	usbserial
-	timeout -s -a 2
+if [ ! -z $use_dfu ]; then
 	gpio_get_value 82
 	if [ $? -eq 0 ]; then
-		usbserial -d
-		dfu -V 0x1234 -P 0x1234 /dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.root.bb(root)r
+		gpio_set_value 83 0
+		usbserial
+		timeout -s -a 2
 		gpio_get_value 82
 		if [ $? -eq 0 ]; then
-			usbserial
-			autoboot_timeout=60
+			usbserial -d
+			dfu -V 0x1234 -P 0x1234 /dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.root.bb(root)r
+			gpio_get_value 82
+			if [ $? -eq 0 ]; then
+				usbserial
+				autoboot_timeout=60
+			else
+				reset
+			fi
 		else
-			reset
+			autoboot_timeout=28
 		fi
-	else
-		autoboot_timeout=28
 	fi
 fi
 
-- 
2.4.3




More information about the barebox mailing list