Skip to content

OpenWrt for R2S

OpenWrt for R2S #217

Workflow file for this run

name: OpenWrt for R2S
on: workflow_dispatch
env:
UPLOAD_FIRMWARE: true
TZ: Asia/Shanghai
MYOPENWRTTARGET: R2S
jobs:
build:
runs-on: ubuntu-22.04
if: github.event.repository.owner.id == github.event.sender.id
steps:
- name: Show system
run: |
echo -e "Total CPU cores\t: $(nproc)"
grep 'model name' /proc/cpuinfo
free -h
uname -a
[ -f /proc/version ] && cat /proc/version
[ -f /etc/issue.net ] && cat /etc/issue.net
- name: Free disk space
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E docker image prune -a -f
sudo -E snap set system refresh.retain=2
sudo -E apt-get -qq update
sudo -E apt-get -qq -y purge dotnet* google* llvm* mono* mysql* php* zulu*
sudo -E apt-get -qq -y autoremove --purge
sudo -E rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /etc/mysql /etc/php
df -h
- name: Init build dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E rm -rf /etc/apt/sources.list.d/*
sudo -E apt-get -qq update
sudo -E apt-get -qq install -y antlr3 aria2 asciidoc autoconf automake autopoint bash binutils build-essential bzip2 ccache clang cmake coreutils cpio curl device-tree-compiler diffutils dwarves findutils flex g++ g++-multilib gawk gcc gcc-multilib genisoimage gettext git gnutls-dev gperf grep gzip help2man intltool jq lib32gcc-s1 libc6-dev-i386 libelf-dev libglib2.0-dev libncurses-dev libreadline-dev libssl-dev libthread-queue-any-perl libtool libusb-dev lld llvm lrzsz make msmtp nano p7zip-full patch perl perl-modules python3-dev python3-pip python3-ply python3-pyelftools qemu-utils rsync scons subversion swig texinfo time unzip upx-ucl util-linux vim wget xsltproc xxd zlib1g-dev
sudo -E apt-get -qq clean
pip3 install --user -U pylibfdt
git config --global user.name 'GitHub Actions' && git config --global user.email '[email protected]'
df -h
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 4095
temp-reserve-mb: 1023
swap-size-mb: 511
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- name: Checkout
uses: actions/checkout@v4
with:
ref: 'master'
- name: Prepare OpenWrt
run: |
sudo chown -R runner:docker ./
cp -f ./SCRIPTS/01_get_ready.sh ./01_get_ready.sh
echo "FMDATETIME=$(date '+%Y%m%d-%H%M')" >> $GITHUB_ENV
/bin/bash ./01_get_ready.sh
- name: Prepare Package
working-directory: ${{ github.workspace }}/openwrt
run: |
cp -f ../SCRIPTS/*.sh ./
/bin/bash ./02_prepare_package.sh
- name: Remove Upx
working-directory: ${{ github.workspace }}/openwrt
run: |
/bin/bash ./03_remove_upx.sh
- name: Convert Translation
working-directory: ${{ github.workspace }}/openwrt
run: |
/bin/bash ./04_convert_translation.sh
- name: Add ACL
working-directory: ${{ github.workspace }}/openwrt
run: |
/bin/bash ./05_create_acl_for_luci.sh -a
- name: Make Config
working-directory: ${{ github.workspace }}/openwrt
run: |
cp -f ../SEED/R2S.config.seed .config
cat ../SEED/more.seed >> .config
make defconfig
- name: Make Download
working-directory: ${{ github.workspace }}/openwrt
run: |
df -h
make download -j$(($(nproc) * 8))
echo $?
- name: Make Toolchain
id: maketoolchain
continue-on-error: true
working-directory: ${{ github.workspace }}/openwrt
run: |
df -h
make toolchain/install -j$(($(nproc) + 1))
echo $?
/bin/ls -AF staging_dir/toolchain-*/bin/
- name: If Toolchain Error
if: steps.maketoolchain.outcome == 'failure'
working-directory: ${{ github.workspace }}/openwrt
run: |
df -h
make toolchain/install -j1 V=s
- name: Compile OpenWrt
id: compileopenwrt
continue-on-error: true
working-directory: ${{ github.workspace }}/openwrt
run: |
df -h
make -j$(($(nproc) + 1)) V=w
echo $?
- name: If Compiling Error
if: steps.compileopenwrt.outcome == 'failure'
working-directory: ${{ github.workspace }}/openwrt
run: |
df -h
cat .config
echo '================================================================'
make -j1 V=s
- name: Cleaning and hashing
run: |
rm -rf ./artifact && mkdir -p ./artifact
cd ./artifact
echo "FIRMWAREDIR=$(pwd)" >> $GITHUB_ENV
cd ../openwrt
cp -f ../clean_flash.sh ../artifact/clean_flash.sh
cp -f .config ../artifact/kconfig-full
/bin/bash ./scripts/diffconfig.sh > ../artifact/kconfig-lite
cd bin/targets/rockchip/armv8
ls -Ahl
/bin/bash ../../../../../SCRIPTS/06_cleaning.sh
mv -f ./* ../../../../../artifact/
echo "status=success" >> $GITHUB_OUTPUT
- name: Upload Firmwares
uses: actions/upload-artifact@v4
if: env.UPLOAD_FIRMWARE == 'true' && ${{ success() }}
with:
name: OpenWrt_R2S_${{ env.FMDATETIME }}
path: ${{ env.FIRMWAREDIR }}