usb-boot 1.29 KB
Newer Older
1
#!/bin/sh -e
2
top=`dirname $0`
3
if [ $# -lt 2 ]; then
4
	echo "Usage: $0 board u-boot.bin [boot.scr|-] [kernel script.bin [initramfs]]"
5
6
	exit 1
fi
7
8
board=$1; shift || (echo "ERROR: Board must be specified"; exit 1;)
uboot=$1; shift || (echo "ERROR: u-boot.bin must be specified"; exit 1;)
Alejandro Mery's avatar
Alejandro Mery committed
9
bootscr=$top/felboot/ramboot.scr
10
11
12
13
14
15
16
if [ ! -f $bootscr ]; then
	bootscr=$top/bin/ramboot.scr
fi
case "$1" in
*.scr)	bootscr="$1"; shift
	;;
esac
17
18
19
kernel=$1; shift || true
scriptbin=$1; shift || true
initramfs=$1; shift || true
20
21
fel() {
	echo fel "$@"
22
	$top/fel $@
23
}
24
25
26
27
28
29
30
31
32
33
case $board in
*/*)	felboot=$board
	;;
*)
	felboot=$top/felboot/fel-boot-${board}.bin
	if [ ! -f $felboot ]; then
		felboot=$top/bin/fel-boot-${board}.bin
	fi
	;;
esac
34
35
36
37
if [ ! -f $felboot ]; then
	echo "ERROR: Can't find fel-boot binary for ${board}"
	exit 1
fi
38
39
40
41
if [ ! -f $bootscr ]; then
	echo "ERROR: Can't fint boot script '${bootscr}'"
	exit 1
fi
42
43
fel write 0x2000 $felboot
fel exe 0x2000
44
sleep 1 # Wait for DRAM initialization to complete
45
46
47
if [ -n "$uboot" ]; then
	fel write 0x4a000000 $uboot
fi
48
49
50
if [ -n "$bootscr" ]; then
	fel write 0x41000000 $bootscr
fi
51
if [ -n "$kernel" ]; then
52
 if [ -n "$scriptbin" ]; then
53
54
55
56
57
58
59
60
  fel write 0x43000000 $scriptbin
 fi
 fel write 0x44000000 $kernel
 if [ -n "$initramfs" ]; then
  fel write 0x4c000000 $initramfs
 fi
fi
fel exe 0x4a000000