forked from QiuSimons/YAOF
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBPI-R4-Minimal-MTK-Bootloader-Test.yml
More file actions
114 lines (95 loc) · 3.84 KB
/
BPI-R4-Minimal-MTK-Bootloader-Test.yml
File metadata and controls
114 lines (95 loc) · 3.84 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
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
name: BPI-R4-Minimal-MTK-Bootloader-Test
run-name: Minimal BPI-R4 test · ${{ inputs.media }} · ${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
media:
description: "Boot medium to validate (sd or emmc)"
required: false
type: string
default: "sd"
permissions:
contents: read
concurrency:
group: bpi-r4-minimal-${{ github.ref }}-${{ inputs.media }}
cancel-in-progress: false
jobs:
build:
runs-on: self-hosted
env:
seed: BPI-R4-MINIMAL
steps:
- name: Checkout
uses: actions/checkout@v4
with:
clean: false
- name: Cache OpenWrt build directories
uses: actions/cache@v4
with:
path: |
openwrt/dl
openwrt/staging_dir
openwrt/build_dir
# mtk-feed # disabled for now; upstream URL currently 404
bl-mt798x-dhcpd
key: ${{ runner.os }}-openwrt-minimal-${{ hashFiles('SCRIPTS/01_get_ready_minimal.sh') }}-${{ hashFiles('SEED/BPI-R4-MINIMAL/config.seed') }}
restore-keys: |
${{ runner.os }}-openwrt-minimal-${{ hashFiles('SCRIPTS/01_get_ready_minimal.sh') }}-
- name: Build with Podman
env:
INPUT_MEDIA: ${{ inputs.media || 'sd' }}
run: |
CURRENT_UID=$(id -u)
CURRENT_GID=$(id -g)
# Resolve GPT layout based on media
if [ "$INPUT_MEDIA" = "emmc" ]; then
GPT_LAYOUT="bpi-r4-emmc-8g-ab.json"
else
GPT_LAYOUT="bpi-r4-sd-ab.json"
fi
# Write build script to a file to avoid indentation issues
cat > build_script.sh <<'SCRIPT'
set -e
export DEBIAN_FRONTEND=noninteractive
# 1. Install dependencies
apt-get -o Acquire::Languages=none update -qq
apt-get install -y -qq --no-install-recommends \
asciidoc bash bin86 binutils bison bzip2 clang file flex g++ g++-multilib gawk \
gcc-multilib gettext git curl gzip help2man intltool jq libbpf-dev libelf-dev \
libncurses-dev libssl-dev libthread-queue-any-perl libusb-dev libxml-parser-perl \
make patch perl-modules pkg-config python3-dev python3-pip python3-pyelftools \
python3-setuptools rsync sharutils swig time unzip util-linux wget xsltproc \
xz-utils zlib1g-dev zip zstd dwarves dos2unix npm quilt bc llvm
npm install -g pnpm
pip3 install --user -U pylibfdt --break-system-packages
# 2. Execute scripts
chmod +x SCRIPTS/*.sh
chmod +x SCRIPTS/BPI-R4/*.sh
echo "=== Step 1: Get Ready ==="
bash SCRIPTS/01_get_ready_minimal.sh
echo "=== Step 2: Prepare Package ==="
cd openwrt
bash ../SCRIPTS/02_prepare_package_minimal.sh
bash ../SCRIPTS/BPI-R4/02_target_only_minimal.sh
echo "=== Step 3: Config ==="
cp -rf ../SEED/BPI-R4-MINIMAL/config.seed .config
echo "=== Step 4: Defconfig ==="
make defconfig
echo "=== Step 5: Download ==="
make download -j$(nproc)
echo "=== Step 6: Compile ==="
IGNORE_ERRORS=1 make -j$(nproc)
# 3. Fix permissions
echo "=== Fixing Permissions ==="
if [ "$(id -u)" = "0" ]; then
chown -R $CURRENT_UID:$CURRENT_GID /build || true
fi
SCRIPT
podman run --rm \
-v ${{ github.workspace }}:/build \
-w /build \
-e CURRENT_UID=$CURRENT_UID \
-e CURRENT_GID=$CURRENT_GID \
-e BPI_R4_GPT_LAYOUT=$GPT_LAYOUT \
ubuntu:24.04 \
bash build_script.sh