-
Notifications
You must be signed in to change notification settings - Fork 4
/
install_uboot.sh
executable file
·126 lines (110 loc) · 3.95 KB
/
install_uboot.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
#!/bin/bash
#***************************************************************************
# FILE NAME : install_uboot.sh
# DESCRIPTION: gets xilinx's u-boot and merges with ezynq
# AUTHOR: Oleg Dzhimiev <[email protected]>
# Copyright (C) 2013 Elphel, Inc
# -----------------------------------------------------------------------------**
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# The four essential freedoms with GNU GPL software:
# * to run the program for any purpose
# * to study how the program works and change it to make it do what you wish
# * to redistribute copies so you can help your neighbor
# * to distribute copies of your modified versions to others
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------**
#get the current script path
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
#constants
UBOOT_TREE="$SCRIPTPATH/u-boot-tree"
CONFIGS="include/configs"
EZYNQ="ezynq"
REPO_DIR_NAME="u-boot"
PATCH_NAME="u-boot.patch"
SUFFIX=".orig"
INITENV="initenv"
OVERWRITE_INITENV=1
CROSS_COMPILE="arm-poky-linux-gnueabi-"
#COMPILE_PATH="/opt/poky/1.4.2/sysroots/x86_64-pokysdk-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi"
COMPILE_PATH="/opt/poky/1.5.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi"
echo "Step 1: Cloning u-boot repository (master branch)"
if [ ! -d "$REPO_DIR_NAME/.git" ]; then
git clone -b master git://git.denx.de/u-boot.git "$REPO_DIR_NAME"
else
echo " Already there"
fi
echo "Step 2: Checking out u-boot version with the certain hash"
cd "$REPO_DIR_NAME"
#git checkout 54fee227ef141214141a226efd17ae0516deaf32
#git checkout 2a0536fa48db1fc5332e3cd33b846d0da0c8bc1e
git checkout fa85e826c16b9ce1ad302a57e9c4b24db0d8b930
echo "Step 3: Merging ezynq with u-boot"
echo "Step 3a: Creating symbolic link for the root folder"
if [ ! -h $EZYNQ ]; then
ln -s $SCRIPTPATH $EZYNQ
fi
echo "Step 3b: Creating symbolic link for the 'ezynq' folder"
if [ ! -h "$CONFIGS/$EZYNQ" ]; then
ln -s "$UBOOT_TREE/$CONFIGS/$EZYNQ" $CONFIGS
fi
echo "Step 3c: Creating symbolic links for separate files (a suffix is added to the originals)"
if [ ! -d "board/elphel" ]; then
mkdir "board/elphel"
fi
if [ ! -d "board/elphel/elphel393" ]; then
mkdir "board/elphel/elphel393"
fi
for SRC in $(find $UBOOT_TREE -type f -not -path "$UBOOT_TREE/$CONFIGS/$EZYNQ/*")
do
LINK=$(echo $SRC | sed "s:^$UBOOT_TREE/::")
#echo "$SRC | $LINK"
if [ ! -h $LINK ]; then
ln -s -S $SUFFIX $SRC $LINK
fi
done
# echo "Step 3b: Creating a patch file"
# cd ..
# if [ ! -f $PATCH_NAME ]; then
# diff -rubPB "$REPO_DIR_NAME" "$UBOOT_TREE" > "$PATCH_NAME"
# fi
#
# echo "Step 3c: Applying the patch"
# cd "$REPO_DIR_NAME"
# patch -r - -Np1 < "../$PATCH_NAME"
# chmod +x makeuboot
echo "Step 4: Creating initenv script"
if [ -f $INITENV ]; then
read -p "Overwrite an already existing initenv? (y/n) " yn
if [ ! $yn = "y" ]; then
OVERWRITE_INITENV=0;
fi
fi
if [ $OVERWRITE_INITENV = 1 ] ; then
echo "#!/bin/sh
export CROSS_COMPILE=$CROSS_COMPILE
export PATH=$COMPILE_PATH/:\$PATH" > $INITENV
fi
if [ ! -d $COMPILE_PATH ] ; then
echo " WARNING: Please update initenv with your cross compiler path"
fi
echo "DONE.
FURTHER INSTRUCTIONS (TO GENERATE BOOT.BIN):
cd u-boot
./makeuboot <target>
SUPPORTED TARGETS:
./makeuboot zynq_microzed_config
./makeuboot zynq_zc706_config
./makeuboot elphel393_config
./makeuboot zynq_zed_config "