usb-boot 1.51 KB
Newer Older
1
#!/bin/sh -e
2
top=`dirname $0`
3
if [ $# -lt 2 ]; then
Michal Suchanek's avatar
Michal Suchanek committed
4
	echo "Usage: $0 u-boot-spl.bin u-boot.bin [boot.scr] [kernel script.bin [initramfs]]"
5
6
	exit 1
fi
7
board=$1; shift || (echo "ERROR: u-boot-spl.bin must be specified"; exit 1;)
8
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
20
21
22
23
24
25
if [ $# -ge 1 ]; then
	kernel=$1; shift || true
fi
if [ $# -ge 1 ]; then
	scriptbin=$1; shift || true
fi
if [ $# -ge 1 ]; then
	initramfs=$1; shift || true
fi
26
27
fel() {
	echo fel "$@"
28
	$top/fel $@
29
}
30
31
32
33
34
35
36
37
38
39
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
40
if [ ! -f $felboot ]; then
41
42
43
44
45
	echo "ERROR: Can't find SPL FEL binary ${board}"
	exit 1
fi
if [ `wc -c $felboot | cut '-d ' -f1` -gt 15616 ]; then
	echo "ERROR: SPL FEL binary too large. Must be the FEL version of SPL"
46
47
	exit 1
fi
48
49
50
51
if [ ! -f $bootscr ]; then
	echo "ERROR: Can't fint boot script '${bootscr}'"
	exit 1
fi
52
53
fel write 0x2000 $felboot
fel exe 0x2000
54
sleep 1 # Wait for DRAM initialization to complete
55
56
57
if [ -n "$uboot" ]; then
	fel write 0x4a000000 $uboot
fi
58
59
60
if [ -n "$bootscr" ]; then
	fel write 0x41000000 $bootscr
fi
61
if [ -n "$kernel" ]; then
62
 if [ -n "$scriptbin" ]; then
63
64
65
66
67
68
69
70
  fel write 0x43000000 $scriptbin
 fi
 fel write 0x44000000 $kernel
 if [ -n "$initramfs" ]; then
  fel write 0x4c000000 $initramfs
 fi
fi
fel exe 0x4a000000