-
Notifications
You must be signed in to change notification settings - Fork 165
/
Copy pathmake-u-boot
executable file
·45 lines (39 loc) · 1.5 KB
/
make-u-boot
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
#!/bin/bash
#########################################################
VERSION=$1
#########################################################
SCRIPT_HOME="$PWD"
SOURCE_URL=https://github.com/u-boot/u-boot/archive/${VERSION}.tar.gz
UBOOT_DIR="$SCRIPT_HOME"/u-boot
UBOOR_SRC_DIR="$UBOOT_DIR"/src
#########################################################
function cleanup() {
set +e
rm -rf "$UBOOR_SRC_DIR"
}
trap cleanup EXIT
mkdir -p "$UBOOT_DIR"
curl -fsSL "$SOURCE_URL" | tar -C "$UBOOT_DIR"/ -xzf - && rm -rf "$UBOOR_SRC_DIR" && mv "$UBOOT_DIR"/u-boot* "$UBOOR_SRC_DIR"
if [ "$(uname -m)" = x86_64 ]; then
"$SCRIPT_HOME"/get-gcc
export CROSS_COMPILE="$SCRIPT_HOME"/gcc/bin/aarch64-linux-gnu-
export ARCH=arm64
fi
function apply_patches() {
if [ -d "$UBOOT_DIR/patches-$VERSION" ]; then
cd "$UBOOT_DIR"/src || return
for patch in "$UBOOT_DIR/patches-$VERSION"/*.patch; do
echo "Applying ${patch}"
patch -p1 < "$patch"
done
cd "$SCRIPT_HOME" || return
fi
}
apply_patches
# jetson-nano-b00
make -C "$UBOOR_SRC_DIR" O=build/p3450-0000 p3450-0000_defconfig
make -C "$UBOOR_SRC_DIR" O=build/p3450-0000 -j "$(getconf _NPROCESSORS_ONLN)"
if ! [ -e BSP/t210/Linux_for_Tegra/bootloader/t210ref/p3450-0000/u-boot.bin_orig ]; then
mv BSP/t210/Linux_for_Tegra/bootloader/t210ref/p3450-0000/u-boot.bin BSP/t210/Linux_for_Tegra/bootloader/t210ref/p3450-0000/u-boot.bin_orig
fi
cp "$UBOOR_SRC_DIR"/build/p3450-0000/u-boot.bin BSP/t210/Linux_for_Tegra/bootloader/t210ref/p3450-0000/u-boot.bin