9
0
Fork 0
barebox/arch/arm/boards/at91sam9263ek/env/bin/init_board

52 lines
969 B
Bash

#!/bin/sh
button_name="dfu_bp"
button_wait=5
product_id=0x1234
vendor_id=0x4321
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 ""
led ds2 1
dfu ${dfu_config} -P ${product_id} -V ${vendor_id}
led ds2 0