diff options
Diffstat (limited to 'arch/arm/boards/usb-a926x/defaultenv-usb-a926x/bin/init_board')
-rw-r--r-- | arch/arm/boards/usb-a926x/defaultenv-usb-a926x/bin/init_board | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/arm/boards/usb-a926x/defaultenv-usb-a926x/bin/init_board b/arch/arm/boards/usb-a926x/defaultenv-usb-a926x/bin/init_board new file mode 100644 index 0000000000..09ba7cc981 --- /dev/null +++ b/arch/arm/boards/usb-a926x/defaultenv-usb-a926x/bin/init_board @@ -0,0 +1,46 @@ +#!/bin/sh + +button_name="dfu_bp" +button_wait=5 + +dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r" + +if [ $at91_udc0.vbus != 1 ] +then + echo "No USB Device cable plugged, normal boot" + exit +fi + +gpio_get_value ${dfu_button} +if [ $? != 0 ] +then + autoboot_timeout=16 + echo "enable tty over USB Device, increase the boot delay to ${autoboot_timeout}s" + usbserial + exit +fi + +echo "${button_name} pressed detected wait ${button_wait}s" +timeout -s -a ${button_wait} + +if [ $at91_udc0.vbus != 1 ] +then + echo "No USB Device cable plugged, normal boot" + exit +fi + +gpio_get_value ${dfu_button} +if [ $? != 0 ] +then + echo "${button_name} released, normal boot" + autoboot_timeout=16 + echo "enable tty over USB Device, increase the boot delay to ${autoboot_timeout}s" + usbserial + exit +fi + +echo "" +echo "Start DFU Mode" +echo "" + +dfu ${dfu_config} |