-
Notifications
You must be signed in to change notification settings - Fork 4
131 lines (115 loc) · 4.85 KB
/
build-openwrt-lede.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#========================================================================================================================
# 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 lede
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/lede-master/feeds.conf.default
CONFIG_FILE: router-config/lede-master/.config
DIY_P1_SH: router-config/lede-master/diy-part1.sh
DIY_P2_SH: router-config/lede-master/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 s905x3_s905x -k 5.4.170_5.15.13 -v dev
#sudo rm -rf amlogic-s9xxx/amlogic-kernel/* && sync
sudo ./make -d -b s922x_s922x-n2_s922x-reva_s905d_s912_s912-t95z_s905x2_s905_s905d-ki_s905x3_s905x -k 5.4.170_5.15.13
sudo ./make -d -b s905w -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_s9xxx_lede_${{ env.PACKAGED_OUTPUTDATE }}
artifacts: ${{ env.PACKAGED_OUTPUTPATH }}/*
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}
body: |
This is OpenWrt firmware for Amlogic s9xxx tv box
* Firmware information
Default IP: 192.168.1.1
Default username: root
Default password: password
Default WIFI name: OpenWrt
Default WIFI password: none
Install to EMMC: Login to OpenWrt → System → Amlogic Service → Install OpenWrt