4 Commits

Author SHA1 Message Date
remittor
053d54a01b readme: Add new badges 2025-01-31 13:04:25 +03:00
remittor
f07b1487bf readme: Add download counter 2025-01-14 14:44:11 +03:00
remittor
9add7ffb32 r3d: Enable CONFIG_KERNEL_KALLSYMS 2025-01-14 12:43:01 +03:00
remittor
2c59084788 Add support github actions 2025-01-14 12:33:35 +03:00
7 changed files with 337 additions and 5 deletions

31
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
# These are supported funding model platforms
# Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github:
# Replace with a single Patreon username
patreon:
# Replace with a single Open Collective username
open_collective:
# Replace with a single Ko-fi username
ko_fi:
# Replace with a single Tidelift platform-name/package-name e.g., npm/babel
tidelift:
# Replace with a single Community Bridge project-name e.g., cloud-foundry
community_bridge:
# Replace with a single Liberapay username
liberapay:
# Replace with a single IssueHunt username
issuehunt:
# Replace with a single Otechie username
otechie:
# Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
custom: ['https://github.com/remittor/donate']

281
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,281 @@
name: build
on:
workflow_dispatch:
inputs:
fake_build:
description: 'Fake build'
required: true
default: 'false'
type: choice
options:
- true
- false
suffix:
description: 'TAG suffix'
required: false
default: ''
type: string
env:
FAKE_BUILD: ${{ github.event.inputs.fake_build }}
REPO_URL: https://github.com/openwrt-xiaomi/openwrt
REPO_LNK: openwrt-xiaomi/openwrt
REPO_BRANCH: xq-24.10
TAG_PREFIX: v24-
BUILD_ROOT: ${{ github.workspace }}/openwrt
DEPENDENCIES: ${{ github.workspace }}/dependencies-ubuntu.txt
TZ: UTC
DEVICE_NAME: unknown
BUILD_DATE: unknown
REPO_DATE: unknown
FW_DATE: unknown
FW_VER: unknown
jobs:
check:
runs-on: ubuntu-24.04
outputs:
tag: ${{ steps.gh.outputs.tag }}
date: ${{ steps.gh.outputs.date }}
sha: ${{ steps.gh.outputs.sha }}
url: ${{ steps.gh.outputs.url }}
message: ${{ steps.gh.outputs.message }}
build_date: ${{ steps.gh.outputs.build_date }}
fw_date: ${{ steps.gh.outputs.fw_date }}
fw_ver: ${{ steps.gh.outputs.fw_ver }}
is_active: ${{ steps.activity.outputs.is_active }}
steps:
- name: Get repo data via GH API
id: gh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
BRANCH=$REPO_BRANCH
REPO_DATE=$(gh api repos/$REPO_LNK/commits/$BRANCH --jq '.commit.committer.date')
BUILD_DATE=$( date --utc +'%y%m%d' )
FW_DATE=$( date --utc +'%Y-%m-%d' )
TAG=$TAG_PREFIX$BUILD_DATE
echo "REPO_DATE=$REPO_DATE" >> $GITHUB_ENV
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
echo "FW_DATE=$FW_DATE" >> $GITHUB_ENV
echo "TAG=$TAG" >> $GITHUB_ENV
wget $REPO_URL/raw/refs/heads/$BRANCH/include/version.mk
FW_VERSION=$( grep -s '^VERSION_NUMBER:=$(if' version.mk 2>/dev/null )
[ -z "$FW_VERSION" ] && { echo "ERROR: Cannot find VERSION_NUMBER"; exit 90; }
FW_VER=$( echo $FW_VERSION | cut -d"," -f3 | cut -d")" -f1 )
echo 'FW_VER = "'$FW_VER'"'
echo "FW_VER=$FW_VER" >> $GITHUB_ENV
rm -f version.mk
{
echo "tag=$TAG"
echo "date=$(date --utc -d $REPO_DATE +%Y%m%d)"
echo "sha=$(gh api repos/$REPO_LNK/commits/$BRANCH --jq '.sha[0:7]')"
echo "url=$(gh api repos/$REPO_LNK/commits/$BRANCH --jq '.html_url')"
echo "message<<EOF"
gh api repos/$REPO_LNK/commits/$BRANCH --jq '.commit.message'
echo EOF
echo "build_date=$BUILD_DATE"
echo "fw_date=$FW_DATE"
echo "fw_ver=$FW_VER"
} >> $GITHUB_OUTPUT
- name: Check for repo activity
id: activity
env:
REPO_DATE: ${{ env.REPO_DATE }}
URL: ${{ steps.gh.outputs.url }}
run: |
TIMESTAMP=$(date --utc -d $REPO_DATE +%s)
DAYS=$(( ( $(date --utc +%s) - $TIMESTAMP ) / 86400 ))
echo "Repository activity: $(date --utc -d $REPO_DATE)"
echo "Commit: $URL"
if [ "${{ github.event_name }}" != "schedule" ]; then
is_active=true
elif [[ $DAYS -lt 1 ]] ; then
is_active=true
else
echo "Repository not updated within last 24 hours."
is_active=false
fi
echo "is_active=$is_active" >> $GITHUB_OUTPUT
build:
needs: check
#if: needs.check.outputs.is_active == 'true'
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
target:
- kng_re
- r3d
- r3g
- rb03
- rb06
- rd03
- rt-ax52
- rt-ax57m
- rt-ax59u
- rt-ax89x
- tuf_ax4200
- tuf_ax6000
steps:
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get -qq update
#sudo apt-get -qq update && sudo apt-get -qq upgrade
sudo apt-get -qq install $(cat $DEPENDENCIES)
sudo apt-get -qq autoremove --purge
sudo apt-get -qq clean
sudo timedatectl set-timezone "$TZ"
- name: Maximize build disk space
uses: easimon/maximize-build-space@master
with:
remove-dotnet: true
remove-android: true
remove-haskell: true
remove-codeql: true
remove-docker-images: true
- name: Checkout builder
uses: actions/checkout@main
- name: Download OpenWrt sources
run: git clone --branch $REPO_BRANCH $REPO_URL.git $BUILD_ROOT
- name: Init builder
env:
BLDROOT: ${{ github.workspace }}
shell: bash
run: |
rsync -avq --exclude=".*" --exclude="$(basename $BUILD_ROOT)" $BLDROOT/ $BUILD_ROOT/
cd $BUILD_ROOT
chmod +x *.sh
wget https://github.com/fantastic-packages/packages/raw/refs/heads/24.10/keys/usign/53FF2B6672243D28.pub
- name: Update OpenWrt packages
id: update
run: |
cd $BUILD_ROOT && ./xupdate.sh -f
echo "status=success" >> $GITHUB_OUTPUT
- name: Build the firmware image
id: compile
if: steps.update.outputs.status == 'success'
env:
TARGET: ${{ matrix.target }}
FW_VER: ${{ needs.check.outputs.fw_ver }}
run: |
cd $BUILD_ROOT
MAKE_JOBS=$(($(nproc)+1))
echo "$MAKE_JOBS thread compile"
./xmake.sh -I -t $TARGET
[ "$FAKE_BUILD" != "true" ] && make -j $MAKE_JOBS download world
FILE_DATE=$(date --utc +'%y%m%d')
DEVICE_NAME=$( grep -so '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' )
BOARD_NAME=$( grep -so '^CONFIG_TARGET_BOARD=.*' .config | cut -d'"' -f2 )
SUBTARGET_NAME=$( grep -so '^CONFIG_TARGET_SUBTARGET=.*' .config | cut -d'"' -f2 )
OUT_DIR=$BUILD_ROOT/bin/targets/$BOARD_NAME/$SUBTARGET_NAME
if [ "$FAKE_BUILD" = "true" ]; then
mkdir -p logs
mkdir -p $OUT_DIR
echo "$BOARD_NAME $SUBTARGET_NAME $DEVICE_NAME" > "$OUT_DIR/$DEVICE_NAME.txt"
touch "$OUT_DIR/kernel-debug.tar.zst"
ls -la
BLD_VER=$FW_VER
else
BLD_VER=$( cat $OUT_DIR/profiles.json | grep -so '"version_number":"[^"]*' | grep -so '[^"]*$' )
fi
echo "Firmware $BLD_VER [$FILE_DATE] builded!"
if [ ! -f $OUT_DIR/kernel-debug.tar.zst ]; then
echo "File kernel-debug.tar.zst not found!"
exit 100
fi
echo "status=success" >> $GITHUB_OUTPUT
echo "DEVICE_NAME=$DEVICE_NAME" >> $GITHUB_ENV
echo "BOARD_NAME=$BOARD_NAME" >> $GITHUB_ENV
echo "SUBTARGET_NAME=$SUBTARGET_NAME" >> $GITHUB_ENV
echo "BLD_VER=$BLD_VER" >> $GITHUB_ENV
echo "OUT_DIR=$OUT_DIR" >> $GITHUB_ENV
echo "FILE_DATE=$FILE_DATE" >> $GITHUB_ENV
- name: Check space usage
run: df -hT
- name: Compress build logs
if: always()
env:
TARGET: ${{ matrix.target }}
FW_DATE: ${{ needs.check.outputs.fw_date }}
LOGS_DIR: ${{ env.BUILD_ROOT }}/logs
run: |
tar -cJvf logs-$TARGET-$FW_DATE.tar.xz $LOGS_DIR
- name: Cleanup OUT directory
if: steps.compile.outputs.status == 'success'
env:
OUT_DIR: ${{ env.OUT_DIR }}
run: |
cd $OUT_DIR
echo "---------------------------"
ls -la
echo "---------------------------"
rm -rf packages
rm -f kernel-*
rm -f *uImage
rm -f *ubi-cleaner*
rm -f *-ram-*.bin
- name: Upload OUT directory
uses: actions/upload-artifact@main
if: steps.compile.outputs.status == 'success'
with:
name: openwrt-${{ env.BLD_VER }}-${{ needs.check.outputs.build_date }}-${{ env.DEVICE_NAME }}
path: ${{ env.OUT_DIR }}
if-no-files-found: error
- name: Upload build logs
if: always()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.target }}-${{ env.FW_DATE }}
path: logs-*.tar.xz
release:
needs: [ check, build ]
permissions:
contents: write
runs-on: ubuntu-24.04
strategy:
max-parallel: 1
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: openwrt-*
- name: Put images into zip
run: |
mkdir -p public
find . -mindepth 1 -type d -name 'openwrt-*' -exec sh -c 'zip -0 ./public/$(basename {}).zip -j {} {}/*' \;
ls -lh ./public/*.zip
- name: Upload assets
uses: andelf/nightly-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ needs.check.outputs.tag }}
with:
prerelease: false
tag_name: ${{ needs.check.outputs.tag }}
name: '${{ needs.check.outputs.tag }}'
body: |
OpenWrt ${{ needs.check.outputs.fw_ver }} [${{ needs.check.outputs.fw_date }}]
author: [remittor](https://github.com/remittor)
files: ./public/*.zip

View File

@@ -1,3 +1,8 @@
[![Github All Releases](https://img.shields.io/github/downloads/openwrt-xiaomi/builder/total.svg)](https://github.com/openwrt-xiaomi/builder/releases)
[![ViewCount](https://views.whatilearened.today/views/github/openwrt-xiaomi/builder.svg)](https://github.com/openwrt-xiaomi/builder/releases)
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fopenwrt-xiaomi%2Fbuilder&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://github.com/openwrt-xiaomi/builder/releases)
[![Donations Page](https://github.com/andry81-cache/gh-content-static-cache/raw/master/common/badges/donate/donate.svg)](https://github.com/remittor/donate)
# OpenWrt builder # OpenWrt builder
For OpenWrt >= 21.02 For OpenWrt >= 21.02
@@ -13,11 +18,11 @@ sudo apt-get install python3-distutils rsync unzip zlib1g-dev
## Build firmware ## Build firmware
``` ```
git clone https://github.com/openwrt-xiaomi/builder -b v23 openwrt-v23 git clone https://github.com/openwrt-xiaomi/builder -b v24 openwrt-v24
cd openwrt-v23 cd openwrt-v24
./xcreate.sh -v xq-23.05.0 ./xcreate.sh -v xq-24.10
cd xq-23.05.0 cd xq-24.10
./xupdate.sh -f ./xupdate.sh -f

1
dependencies-ubuntu.txt Normal file
View File

@@ -0,0 +1 @@
build-essential clang flex bison g++ gawk gcc-multilib g++-multilib gettext git libncurses5-dev libssl-dev python3-setuptools rsync swig unzip zlib1g-dev file wget

View File

@@ -12,6 +12,8 @@ CONFIG_TARGET_ipq806x_generic_DEVICE_xiaomi_r3d=y
#include _argon.config #include _argon.config
#include _vpn.config #include _vpn.config
CONFIG_KERNEL_KALLSYMS=y
### Temp and sensors ### Temp and sensors
CONFIG_PACKAGE_lm-sensors=y CONFIG_PACKAGE_lm-sensors=y
CONFIG_PACKAGE_lm-sensors-detect=y CONFIG_PACKAGE_lm-sensors-detect=y

View File

@@ -16,8 +16,9 @@ KALLSYMS=false
TESTING_KERNEL=false TESTING_KERNEL=false
BUILD_ONLY_INITRAMFS=false BUILD_ONLY_INITRAMFS=false
BUILD_SKIP_INITRAMFS=false BUILD_SKIP_INITRAMFS=false
ONLY_INIT=false
while getopts "j:t:fiskT" opt; do while getopts "j:t:fiskTI" opt; do
case $opt in case $opt in
j) MAKE_JOBS=$OPTARG;; j) MAKE_JOBS=$OPTARG;;
t) XTARGET=$OPTARG;; t) XTARGET=$OPTARG;;
@@ -26,6 +27,7 @@ while getopts "j:t:fiskT" opt; do
T) TESTING_KERNEL=true;; T) TESTING_KERNEL=true;;
i) BUILD_ONLY_INITRAMFS=true;; i) BUILD_ONLY_INITRAMFS=true;;
s) BUILD_SKIP_INITRAMFS=true;; s) BUILD_SKIP_INITRAMFS=true;;
I) ONLY_INIT=true;;
esac esac
done done
@@ -262,6 +264,8 @@ function build_target {
#make tools/install -j$make_jobs #make tools/install -j$make_jobs
#make toolchain/install -j$make_jobs #make toolchain/install -j$make_jobs
[ "$ONLY_INIT" = "true" ] && return 0
make -j $make_jobs download world make -j $make_jobs download world
} }

View File

@@ -10,9 +10,11 @@ ADDONSNSS=$XDIR/_addons_nss.config
. ./xcommon.sh . ./xcommon.sh
OPT_FULL_UPDATE=false OPT_FULL_UPDATE=false
USE_GITHUB_SRC=false
while getopts "f" opt; do while getopts "f" opt; do
case $opt in case $opt in
f) OPT_FULL_UPDATE=true;; f) OPT_FULL_UPDATE=true;;
g) USE_GITHUB_SRC=true;;
esac esac
done done
@@ -46,6 +48,12 @@ git reset --hard origin/$CUR_BRANCH
rm -f feeds.conf rm -f feeds.conf
cp -f feeds.conf.default feeds.conf cp -f feeds.conf.default feeds.conf
if [ "$USE_GITHUB_SRC" = "true" ]; then
sed -i -e 's|https://git.openwrt.org/feed/|https://github.com/openwrt/|' feeds.conf
sed -i -e 's|https://git.openwrt.org/project/|https://github.com/openwrt/|' feeds.conf
fi
feed_lst=$( get_cfg_feed_lst "$ADDONSCFG" ) feed_lst=$( get_cfg_feed_lst "$ADDONSCFG" )
for feed in $feed_lst; do for feed in $feed_lst; do
value=$( get_cfg_feed_url "$ADDONSCFG" $feed ) value=$( get_cfg_feed_url "$ADDONSCFG" $feed )