Skip to content

Commit

Permalink
openwrt: Initial branding homemade version
Browse files Browse the repository at this point in the history
  • Loading branch information
sweetieice committed Jan 8, 2022
1 parent ce0f2be commit c351bb0
Show file tree
Hide file tree
Showing 4 changed files with 885 additions and 0 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/build-openwrt-homemade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#========================================================================================================================
# https://github.com/ophub/amlogic-s9xxx-openwrt
# Description: Automatically Build OpenWrt for Amlogic s9xxx tv box
# Cron: min (0 - 59) / hour (0 - 23) / day of month (1 - 31) / month (1 - 12) / day of week (0 - 6)(Sunday - Saturday)
# Source code repository: https://github.com/coolsnowwolf/lede / Branch: master
#========================================================================================================================

name: Build OpenWrt Homemade

on:
repository_dispatch:
workflow_dispatch:
#schedule:
#- cron: '0 17 * * 0'

env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master
FEEDS_CONF: router-config/homemade/feeds.conf.default
CONFIG_FILE: router-config/homemade/.config
DIY_P1_SH: router-config/homemade/diy-part1.sh
DIY_P2_SH: router-config/homemade/diy-part2.sh
TZ: Asia/Shanghai

jobs:
build:
runs-on: ubuntu-20.04
if: github.event.repository.owner.id == github.event.sender.id

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo -E apt-get -qq update
sudo -E apt-get -qq install $(curl -fsSL git.io/ubuntu-2004-openwrt)
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo timedatectl set-timezone "$TZ"
sudo mkdir -p /workdir
sudo chown $USER:$GROUPS /workdir
echo "COMPILE_STARTINGTIME=$(date +"%Y.%m.%d.%H%M")" >> $GITHUB_ENV
- name: Clone source code
working-directory: /workdir
run: |
df -hT $PWD
git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
- name: Load custom feeds
run: |
[ -e $FEEDS_CONF ] && cp -f $FEEDS_CONF openwrt/feeds.conf.default
chmod +x $DIY_P1_SH
cd openwrt
$GITHUB_WORKSPACE/$DIY_P1_SH
- name: Update feeds
run: cd openwrt && ./scripts/feeds update -a

- name: Install feeds
run: cd openwrt && ./scripts/feeds install -a

- name: Load custom configuration
run: |
[ -e files ] && mv files openwrt/files
[ -e $CONFIG_FILE ] && cp -f $CONFIG_FILE openwrt/.config
chmod +x $DIY_P2_SH
cd openwrt
$GITHUB_WORKSPACE/$DIY_P2_SH
- name: Download package
id: package
run: |
cd openwrt
make defconfig
make download -j8
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
- name: Compile the firmware
id: compile
run: |
cd openwrt
echo -e "$(nproc) thread compile"
make -j$(($(nproc) + 1)) V=s || make -j1 || make -j1 V=s
grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' > DEVICE_NAME
[ -s DEVICE_NAME ] && echo "DEVICE_NAME=$(cat DEVICE_NAME)" >> $GITHUB_ENV
echo "FILE_DATE=$(date +"%Y.%m.%d.%H%M")" >> $GITHUB_ENV
echo "::set-output name=status::success"
- name: Build OpenWrt firmware
if: steps.compile.outputs.status == 'success' && !cancelled()
id: build
run: |
[ -d openwrt-armvirt ] || mkdir -p openwrt-armvirt
cp -f openwrt/bin/targets/*/*/*.tar.gz openwrt-armvirt/ && sync
sudo chmod +x make
sudo ./make -d -b s905x -k 5.4.170
[ -d ipk ] || mkdir -p ipk
cp -rf $(find openwrt/bin/packages/ -type f -name "*.ipk") ipk/ && sync
sudo tar -czf ipk.tar.gz ipk && mv -f ipk.tar.gz out/ && sync
echo "PACKAGED_OUTPUTPATH=${PWD}/out" >> $GITHUB_ENV
echo "PACKAGED_OUTPUTDATE=$(date +"%Y.%m.%d.%H%M")" >> $GITHUB_ENV
echo "::set-output name=status::success"
- name: Upload OpenWrt Firmware to Release
uses: ncipollo/release-action@v1
if: steps.build.outputs.status == 'success' && !cancelled()
with:
tag: openwrt_s905x_homemade_${{ env.PACKAGED_OUTPUTDATE }}
artifacts: ${{ env.PACKAGED_OUTPUTPATH }}/*
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}
body: |
This is OpenWrt firmware for Amlogic s905x tv box
* Firmware information
Default IP: 192.168.1.1
Default username: root
Default password: password
Default WIFI name: OpenWrt
Default WIFI password: none
Loading

0 comments on commit c351bb0

Please sign in to comment.