forked from probonopd/MiniDexed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_local.sh
More file actions
67 lines (54 loc) · 1.86 KB
/
build_local.sh
File metadata and controls
67 lines (54 loc) · 1.86 KB
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
#!/bin/bash
set -e
# Default to RPi 4 if not specified
RPI=${RPI:-4}
echo "Building for Raspberry Pi ${RPI}"
# Create necessary directories
mkdir -p kernels sdcard
# Recursively pull git submodules
git submodule update --init --recursive
# Get particular git commits of the submodules
sh -ex submod.sh
# Install appropriate toolchain based on RPi version
if [ "${RPI}" -gt 2 ]; then
# For RPi 3 and 4 (64-bit)
if [ ! -f "gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz" ]; then
wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
fi
tar xf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
else
# For RPi 1 and 2 (32-bit)
if [ ! -f "gcc-arm-10.3-2021.07-x86_64-arm-none-eabi.tar.xz" ]; then
wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi.tar.xz
fi
tar xf gcc-arm-10.3-2021.07-x86_64-arm-none-eabi.tar.xz
fi
# Add toolchain to PATH
export PATH=$(readlink -f ./gcc-*/bin/):$PATH
# Build dependencies and MiniDexed
./build.sh
cp ./src/kernel*.img ./kernels/
# Build Raspberry Pi boot files
cd ./circle-stdlib/libs/circle/boot
make
if [ "${RPI}" -gt 2 ]; then
make armstub64
fi
cd -
# Prepare SD card contents
cd sdcard
../getsysex.sh
cd ..
# Copy boot files and configurations
cp -r ./circle-stdlib/libs/circle/boot/* sdcard/
rm -rf sdcard/config*.txt sdcard/README sdcard/Makefile sdcard/armstub sdcard/COPYING.linux
cp ./src/config.txt ./src/minidexed.ini ./src/*img ./src/performance.ini sdcard/
echo "usbspeed=full" > sdcard/cmdline.txt
# Copy kernel images
cd sdcard
cp ../kernels/* . || true
# Create dated zip file
zip -r ../MiniDexed_$(date +%Y-%m-%d).zip *
cd ..
echo "Build completed successfully!"
echo "The build files are available in MiniDexed_$(date +%Y-%m-%d).zip"