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
6 changed files with 132 additions and 58 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']

View File

@@ -2,12 +2,25 @@ name: build
on:
workflow_dispatch:
# push:
# tags:
# - v[0-9]+*
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:
REPO_URL: https://github.com/openwrt-xiaomi/openwrt.git
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
@@ -15,6 +28,9 @@ env:
TZ: UTC
DEVICE_NAME: unknown
BUILD_DATE: unknown
REPO_DATE: unknown
FW_DATE: unknown
FW_VER: unknown
jobs:
check:
@@ -25,43 +41,56 @@ jobs:
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 }}
REPO: 'openwrt-xiaomi/openwrt'
run: |
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
BRANCH=$(gh api repos/$REPO --jq '.default_branch')
DATE=$(gh api repos/$REPO/commits/$BRANCH --jq '.commit.committer.date')
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 $DATE +%Y%m%d)"
echo "sha=$(gh api repos/$REPO/commits/$BRANCH --jq '.sha[0:7]')"
echo "url=$(gh api repos/$REPO/commits/$BRANCH --jq '.html_url')"
echo "build_root=$BUILD_ROOT"
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/commits/$BRANCH --jq '.commit.message'
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
echo "DATE=$DATE" >> $GITHUB_ENV
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Check for repo activity
id: activity
env:
DATE: ${{ env.DATE }}
REPO_DATE: ${{ env.REPO_DATE }}
URL: ${{ steps.gh.outputs.url }}
run: |
TIMESTAMP=$(date --utc -d $DATE +%s)
TIMESTAMP=$(date --utc -d $REPO_DATE +%s)
DAYS=$(( ( $(date --utc +%s) - $TIMESTAMP ) / 86400 ))
echo "Repository activity: $(date --utc -d $DATE)"
echo "Repository activity: $(date --utc -d $REPO_DATE)"
echo "Commit: $URL"
if [ "${{ github.event_name }}" != "schedule" ]; then
is_active=true
@@ -118,7 +147,7 @@ jobs:
uses: actions/checkout@main
- name: Download OpenWrt sources
run: git clone --branch $REPO_BRANCH $REPO_URL $BUILD_ROOT
run: git clone --branch $REPO_BRANCH $REPO_URL.git $BUILD_ROOT
- name: Init builder
env:
@@ -131,35 +160,42 @@ jobs:
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
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 -m -t $TARGET
make -j $MAKE_JOBS download world
# || make V=sc
./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
# BLD_VER=24.10.0-rc5
BLD_VER=$( cat $OUT_DIR/profiles.json | grep -so '"version_number":"[^"]*' | grep -so '[^"]*$' )
FILE_DATE=$(date --utc +'%y%m%d')
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!"
# mkdir -p logs
# mkdir -p $OUT_DIR
# echo "$BOARD_NAME $SUBTARGET_NAME $DEVICE_NAME" > "$OUT_DIR/$DEVICE_NAME.txt"
if [ ! -f $OUT_DIR/kernel-debug.tar.zst ]; then
echo "File kernel-debug.tar.zst not found!"
exit 100
echo "File kernel-debug.tar.zst not found!"
exit 100
fi
echo "status=success" >> $GITHUB_OUTPUT
echo "DEVICE_NAME=$DEVICE_NAME" >> $GITHUB_ENV
@@ -167,8 +203,7 @@ jobs:
echo "SUBTARGET_NAME=$SUBTARGET_NAME" >> $GITHUB_ENV
echo "BLD_VER=$BLD_VER" >> $GITHUB_ENV
echo "OUT_DIR=$OUT_DIR" >> $GITHUB_ENV
echo "FILE_DATE=$(date --utc +'%y%m%d')" >> $GITHUB_ENV
echo "FILE_TIME=$(date --utc +'%Y%m%d%H%M')" >> $GITHUB_ENV
echo "FILE_DATE=$FILE_DATE" >> $GITHUB_ENV
- name: Check space usage
run: df -hT
@@ -177,9 +212,10 @@ jobs:
if: always()
env:
TARGET: ${{ matrix.target }}
FW_DATE: ${{ needs.check.outputs.fw_date }}
LOGS_DIR: ${{ env.BUILD_ROOT }}/logs
run: |
tar -cJvf logs-$TARGET.tar.xz $LOGS_DIR
tar -cJvf logs-$TARGET-$FW_DATE.tar.xz $LOGS_DIR
- name: Cleanup OUT directory
if: steps.compile.outputs.status == 'success'
@@ -196,19 +232,11 @@ jobs:
rm -f *ubi-cleaner*
rm -f *-ram-*.bin
- name: Info
env:
OUT_DIR: ${{ env.OUT_DIR }}
run: |
echo "---------------------------"
ls -la $OUT_DIR
echo "---------------------------"
- name: Upload OUT directory
uses: actions/upload-artifact@main
if: steps.compile.outputs.status == 'success'
with:
name: openwrt-${{ env.BLD_VER }}-${{ env.FILE_DATE }}-${{ env.DEVICE_NAME }}
name: openwrt-${{ env.BLD_VER }}-${{ needs.check.outputs.build_date }}-${{ env.DEVICE_NAME }}
path: ${{ env.OUT_DIR }}
if-no-files-found: error
@@ -216,7 +244,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.target }}
name: logs-${{ matrix.target }}-${{ env.FW_DATE }}
path: logs-*.tar.xz
release:
@@ -233,9 +261,6 @@ jobs:
pattern: openwrt-*
- name: Put images into zip
env:
TAG: ${{ needs.check.outputs.tag }}
DATE: ${{ needs.check.outputs.date }}
run: |
mkdir -p public
find . -mindepth 1 -type d -name 'openwrt-*' -exec sh -c 'zip -0 ./public/$(basename {}).zip -j {} {}/*' \;
@@ -250,4 +275,7 @@ jobs:
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
For OpenWrt >= 21.02
@@ -13,11 +18,11 @@ sudo apt-get install python3-distutils rsync unzip zlib1g-dev
## Build firmware
```
git clone https://github.com/openwrt-xiaomi/builder -b v23 openwrt-v23
cd openwrt-v23
git clone https://github.com/openwrt-xiaomi/builder -b v24 openwrt-v24
cd openwrt-v24
./xcreate.sh -v xq-23.05.0
cd xq-23.05.0
./xcreate.sh -v xq-24.10
cd xq-24.10
./xupdate.sh -f

View File

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

View File

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

View File

@@ -10,9 +10,11 @@ ADDONSNSS=$XDIR/_addons_nss.config
. ./xcommon.sh
OPT_FULL_UPDATE=false
USE_GITHUB_SRC=false
while getopts "f" opt; do
case $opt in
f) OPT_FULL_UPDATE=true;;
g) USE_GITHUB_SRC=true;;
esac
done
@@ -46,6 +48,12 @@ git reset --hard origin/$CUR_BRANCH
rm -f 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" )
for feed in $feed_lst; do
value=$( get_cfg_feed_url "$ADDONSCFG" $feed )