/
bootloader.sh
executable file
·93 lines (93 loc) · 3.2 KB
/
bootloader.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
#!/usr/bin/env bash
echo "Acquiring u-boot..."
pushd /build/
mkdir u-boot
cd u-boot
mkdir -p /build/cache/
UBOOT_FILENAME=u-boot-2017.03-armada-17.10.tar.gz
FQ_UBOOT_FILENAME=$CACHE_DIR$UBOOT_FILENAME
if [ -f "${FQ_UBOOT_FILENAME}" ]; then
echo "Using cached u-boot download."
cp $FQ_UBOOT_FILENAME $UBOOT_FILENAME
else
echo "u-boot is not cached, downloading..."
wget --no-verbose https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/archive/$UBOOT_FILENAME
echo "Copying u-boot to cache..."
cp -v $UBOOT_FILENAME $FQ_UBOOT_FILENAME
fi
echo "Extracting u-boot..."
tar --extract --gzip --file=$UBOOT_FILENAME --strip=1 --check-links
rm $UBOOT_FILENAME
sync
echo "Building u-boot..."
make -j$(($(nproc)+1)) mvebu_espressobin-88f3720_defconfig
sync
make -j$(($(nproc)+1)) DEVICE_TREE=armada-3720-espressobin
sync
echo "Exposing desired files..."
mkdir -p /data/u-boot
cp -v u-boot.bin /data/u-boot/
export BL33=/build/u-boot/u-boot.bin
echo "Done building u-boot."
cd ..
echo "Acquiring atf..."
mkdir atf
cd atf
ATF_FILENAME=atf-v1.3-armada-17.10.tar.gz
FQ_ATF_FILENAME=$CACHE_DIR$ATF_FILENAME
if [ -f "${FQ_ATF_FILENAME}" ]; then
echo "Using cached atf download..."
cp $FQ_ATF_FILENAME $ATF_FILENAME
else
echo "atf is not cached, downloading..."
# Due to applying patches, must be git repo.
git clone -b atf-v1.3-armada-17.10 https://github.com/MarvellEmbeddedProcessors/atf-marvell.git
tar czf $ATF_FILENAME atf-marvell
rm -rf atf-marvell
echo "Copying atf to cache..."
cp -v $ATF_FILENAME $FQ_ATF_FILENAME
fi
echo "Extracting atf..."
tar --extract --gzip --file=$ATF_FILENAME --strip=1 --check-links
rm $ATF_FILENAME
sync
cd ..
echo "Acquiring utils..."
mkdir a3700-utils
cd a3700-utils
UTILS_FILENAME=A3700_utils-armada-17.10.tar.gz
FQ_UTILS_FILENAME=$CACHE_DIR$UTILS_FILENAME
if [ -f "${FQ_UTILS_FILENAME}" ]; then
echo "Using cached utils download."
cp $FQ_UTILS_FILENAME $UTILS_FILENAME
else
echo "utils is not cached, downloading..."
# Due to applying patches, must be git repo.
git clone -b A3700_utils-armada-17.10 https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell.git
tar czf $UTILS_FILENAME A3700-utils-marvell
rm -rf A3700-utils-marvell
echo "Copying utils to cache..."
cp -v $UTILS_FILENAME $FQ_UTILS_FILENAME
fi
echo "Extracting utils..."
tar --extract --gzip --file=$UTILS_FILENAME --strip=1 --check-links
rm $UTILS_FILENAME
sync
echo "Acquiring patches..."
# Get the aforementioned patches, used in the make command below.
wget --no-verbose --content-disposition http://wiki.espressobin.net/tiki-download_file.php?fileId=152
wget --no-verbose --content-disposition http://wiki.espressobin.net/tiki-download_file.php?fileId=151
sync
cd ..
cd atf
echo "Building atf..."
# TODO: Is a nonstandard toolchain used? toolchain?
# export CROSS_CM3=/build/toolchain/bin/arm-linux-gnueabi
make -j$(($(nproc)+1)) DEBUG=1 USE_COHERENT_MEM=0 LOG_LEVEL=20 SECURE=0 CLOCKSPRESET=CPU_1000_DDR_800 DDR_TOPOLOGY=2 BOOTDEV=SPINOR PARTNUM=0 WTP=../a3700-utils/ PLAT=a3700 all fip
sync
echo "Exposing desired files..."
mkdir -p /data/atf
cp -v build/a3700/debug/flash-image.bin /data/atf/
cp -v -r build/a3700/debug/uart-images /data/atf/
echo "Done building atf."
popd