-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_boot_files.sh
executable file
·132 lines (108 loc) · 2.89 KB
/
get_boot_files.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
cd $( dirname "${BASH_SOURCE[0]}" )
echo -n "Looking for git... "
if [ ! `command -v git 2>/dev/null` ] ; then
echo -e "FAILED!\n\nPlease install git and retry."
exit 1
fi
echo "OK!"
# Get cross compiler #
echo "Getting cross compiler..."
NEW=""
if [ ! $CROSS_COMPILE ] ; then
if [ ! -d rpi-tools/ ] ; then
git clone git://github.com/raspberrypi/tools rpi-tools
if [ $? != "0" ] ; then
echo -e "Cannot clone repository." >&2
exit 1
fi
NEW="true"
else
cd rpi-tools
git pull
if [ $? != "0" ] ; then
echo -e "Cannot pull repository." >&2
exit 1
fi
cd ..
fi
#export CROSS_COMPILE=$(pwd)/rpi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-
export CROSS_COMPILE=$(pwd)/rpi-tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi-
#export CROSS_COMPILE=$(pwd)/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/bin/
fi
# Get U-Boot #
echo "Getting uboot..."
NEW=""
if [ ! -d u-boot/ ] ; then
git clone git://git.denx.de/u-boot.git
if [ $? != "0" ] ; then
echo -e "Cannot clone repository." >&2
exit 1
fi
NEW="true"
fi
cd u-boot/
if [ ! $NEW ] ; then
git pull
if [ $? != "0" ] ; then
echo -e "Cannot pull repository." >&2
exit 1
fi
fi
make distclean
make rpi_defconfig
if [ $? != "0" ] ; then
echo -e "Error configuring uboot." >&2
exit 1
fi
make -j$(grep -c ^processor /proc/cpuinfo) -s
if [ $? != "0" ] ; then
echo -e "Error compiling uboot." >&2
exit 1
fi
cd ..
# Copy required files into a directory #
echo "Copying files into folder..."
mkdir -p sd-card/
if [ $? != "0" ] ; then
echo -e "Cannot create output directory." >&2
exit 1
fi
cd sd-card/
cp ../u-boot/u-boot.bin ./kernel.img
wget https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin -O bootcode.bin
if [ $? != "0" ] ; then
echo -e "Cannot download bootcode.bin." >&2
exit 1
fi
wget https://github.com/raspberrypi/firmware/raw/master/boot/fixup.dat -O fixup.dat
if [ $? != "0" ] ; then
echo -e "Cannot download fixup.dat." >&2
exit 1
fi
wget https://github.com/raspberrypi/firmware/raw/master/boot/fixup_cd.dat -O fixup_cd.dat
if [ $? != "0" ] ; then
echo -e "Cannot download fixup_cd.dat." >&2
exit 1
fi
wget https://github.com/raspberrypi/firmware/raw/master/boot/fixup_x.dat -O fixup_x.dat
if [ $? != "0" ] ; then
echo -e "Cannot download fixup_x.dat." >&2
exit 1
fi
wget https://github.com/raspberrypi/firmware/raw/master/boot/start.elf -O start.elf
if [ $? != "0" ] ; then
echo -e "Cannot download start.elf." >&2
exit 1
fi
wget https://github.com/raspberrypi/firmware/raw/master/boot/start_cd.elf -O start_cd.elf
if [ $? != "0" ] ; then
echo -e "Cannot download start_cd.elf." >&2
exit 1
fi
wget https://github.com/raspberrypi/firmware/raw/master/boot/start_x.elf -O start_x.elf
if [ $? != "0" ] ; then
echo -e "Cannot download start_x.elf." >&2
exit 1
fi
echo -e "\n\nDONE!"