-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sh
executable file
·59 lines (58 loc) · 1.36 KB
/
build.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
#!/bin/bash
set -ex
EXT=xz
BUILDROOT_VERSION=2024.02.8
if [ -z "$1" ]; then
steps="buildroot apt defconfig sdk build release"
else
steps="$@"
fi
for step in $steps; do
case $step in
"buildroot")
if [ ! -e "buildroot-${BUILDROOT_VERSION}.tar.${EXT}" ]; then
wget "https://buildroot.org/downloads/buildroot-${BUILDROOT_VERSION}.tar.${EXT}"
fi
if [ ! -e "buildroot-${BUILDROOT_VERSION}" ]; then
if [ "$EXT" == "xz" ]; then
tar xvJf "buildroot-${BUILDROOT_VERSION}.tar.${EXT}"
fi
if [ "$EXT" == "bz2" ]; then
tar xvjf "buildroot-${BUILDROOT_VERSION}.tar.${EXT}"
fi
fi
;;
"apt")
sudo apt install -y sed make binutils gcc g++ bash build-essential \
patch gzip bzip2 perl tar cpio python3 unzip rsync wget \
libncurses-dev bc findutils zstd file
;;
"defconfig")
(
cd "buildroot-${BUILDROOT_VERSION}" || exit 1
make BR2_EXTERNAL=../pag raspberrypi4_64_defconfig
)
;;
"sdk")
(
cd "buildroot-${BUILDROOT_VERSION}" || exit 1
make BR2_EXTERNAL=../pag prepare-sdk
)
;;
"build")
(
cd "buildroot-${BUILDROOT_VERSION}" || exit 1
make BR2_EXTERNAL=../pag all 2>&1 | tee make.log
)
;;
"release")
mkdir -p release
cp "buildroot-${BUILDROOT_VERSION}/output/images/sdcard.img" release/
zstd --rm release/sdcard.img
;;
*)
echo "Unsupported step: $step"
exit 1
;;
esac
done