Minimal BPI-R4 test · sd · 24.10 #31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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', 'SCRIPTS/02_prepare_package_minimal.sh', 'SCRIPTS/BPI-R4/02_target_only_minimal.sh', 'SEED/BPI-R4-MINIMAL/config.seed') }} | |
| restore-keys: | | |
| ${{ runner.os }}-openwrt-minimal- | |
| - 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 | |
| if [ "$(id -u)" = "0" ]; then | |
| export FORCE_UNSAFE_CONFIGURE=1 | |
| fi | |
| # 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: Refresh host tar ===" | |
| rm -rf build_dir/host/tar-* \ | |
| staging_dir/host/stamp/.tar_installed \ | |
| staging_dir/host/bin/tar \ | |
| staging_dir/host/share/man/man1/tar.1 \ | |
| staging_dir/host/man/man1/tar.1 | |
| make -j1 V=sc tools/tar/compile | |
| echo "=== Step 7: 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 |