usb-boot 1.05 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
9
10
11
12
13
14
15
16
17
18
19
board=$1; shift
uboot=$1; shift
bootscr=$tob/felboot/ramboot.scr
if [ ! -f $bootscr ]; then
	bootscr=$top/bin/ramboot.scr
fi
case "$1" in
*.scr)	bootscr="$1"; shift
	;;
esac
kernel=$1; shift
scriptbin=$1; shift
initramfs=$1; shift
20
21
fel() {
	echo fel "$@"
22
	$top/fel $@
23
}
24
felboot=$top/felboot/fel-boot-${board}.bin
25
if [ ! -f $felboot ]; then
26
	felboot=$top/bin/fel-boot-${board}.bin
27
28
29
30
31
fi
if [ ! -f $felboot ]; then
	echo "ERROR: Can't find fel-boot binary for ${board}"
	exit 1
fi
32
33
34
35
if [ ! -f $bootscr ]; then
	echo "ERROR: Can't fint boot script '${bootscr}'"
	exit 1
fi
36
37
38
39
40
fel write 0x2000 $felboot
fel exe 0x2000
if [ -n "$uboot" ]; then
	fel write 0x4a000000 $uboot
fi
41
42
43
if [ -n "$bootscr" ]; then
	fel write 0x41000000 $bootscr
fi
44
if [ -n "$kernel" ]; then
45
 if [ -n "$scriptbin" ]; then
46
47
48
49
50
51
52
53
  fel write 0x43000000 $scriptbin
 fi
 fel write 0x44000000 $kernel
 if [ -n "$initramfs" ]; then
  fel write 0x4c000000 $initramfs
 fi
fi
fel exe 0x4a000000