Build Padavan #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################################# | |
# 修改 TNAME: R2100 中的R2100为你需要编译的型号,注意名称要与configs/templates/目录下的名字相同 | |
# 小米AC2100型号为R2100 | |
# 红米AC2100型号为RM2100 | |
################################################################################################# | |
name: Build Padavan | |
on: | |
workflow_dispatch: | |
watch: | |
types: [started] | |
push: | |
tags: | |
- 'v*' | |
env: # 环境变量 | |
MHZ: 1100 # CPU超频频率 必须为20的倍数。开启超频请修改124行超频选项 | |
TNAME: RM2100 # 配置文件名 https://github.com/hanwckf/rt-n56u/tree/master/trunk/configs/templates | |
BUILD_VERSION: chongshengB # hanwckf 或者 chongshengB | |
FILE_PATH: /opt/images | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.event.repository.owner.id == github.event.sender.id | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Initialization environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install python-docutil | |
sudo apt-get -y install unzip libtool-bin curl cmake gperf gawk flex bison nano xxd fakeroot \ | |
cpio git python-docutils gettext automake autopoint texinfo build-essential help2man \ | |
pkg-config zlib1g-dev libgmp3-dev libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget | |
- name: Clone source code | |
run: | | |
git clone --depth=1 https://github.com/$BUILD_VERSION/rt-n56u.git /opt/rt-n56u | |
cd /opt/rt-n56u/toolchain-mipsel | |
sh dl_toolchain.sh | |
mkdir -p /opt/images/ | |
echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV | |
- name: Build Firmware | |
run: | | |
cd /opt/rt-n56u/trunk | |
echo "CPU超频到$MHZ"mhz | |
echo "修改CPU频率" | |
clock=`echo "obase=16 ; ibase=10 ; (((($MHZ/20)-1)*16+2))" | bc` | |
echo "16进制$clock" | |
sed -i "554,555s:0xff:0x7ff:g" /opt/rt-n56u/trunk/linux-3.4.x/arch/mips/rt2880/init.c | |
sed -i "554,556s:0xc2:0x$clock:g" /opt/rt-n56u/trunk/linux-3.4.x/arch/mips/rt2880/init.c | |
if [ ! -f configs/templates/$TNAME.config ] ; then | |
echo "configs/templates/$TNAME.config not found " | |
exit 1 | |
fi | |
cp -f configs/templates/$TNAME.config .config | |
sed -i 's/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=n/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=y/g' configs/templates/$TNAME.config | |
################################################################################################### | |
# 因不同型号配置功能不一样,所以先把配置项删除,如果你自己要添加其他的,也要写上删除这一条,切记!!! | |
################################################################################################### | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_LANG_UK/d' configs/templates/$TNAME.config #删除配置项英文界面 | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_QOS/d' configs/templates/$TNAME.config #删除配置项QOS | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_SMBD36/d' configs/templates/$TNAME.config #删除配置项SMBD36 | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_DDNS_SSL/d' configs/templates/$TNAME.config #删除配置项DDNS_SSL | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_HTTPS/d' configs/templates/$TNAME.config #删除配置项HTTPS | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_OPENVPN/d' configs/templates/$TNAME.config #删除配置项OPENVPN | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_FFMPEG_NEW/d' configs/templates/$TNAME.config #删除配置项FFMPEG_NEW | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_XUPNPD/d' configs/templates/$TNAME.config #删除配置项XUPNPD | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_DOGCOM/d' configs/templates/$TNAME.config #删除配置项DOGCOM | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS/d' configs/templates/$TNAME.config #删除配置项SS plus+ | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER/d' configs/templates/$TNAME.config #删除配置项DNSFORWARDER | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_VLMCSD/d' configs/templates/$TNAME.config #删除配置项VLMCSD | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_TTYD/d' configs/templates/$TNAME.config #删除配置项TTYD | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_NAPT66/d' configs/templates/$TNAME.config #删除配置项NAPT66 | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_SRELAY/d' configs/templates/$TNAME.config #删除配置项SRELAY | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_SOCAT/d' configs/templates/$TNAME.config #删除配置项SOCAT | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_MTR/d' configs/templates/$TNAME.config #删除配置项MTR | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_IPERF3/d' configs/templates/$TNAME.config #删除配置项IPERF3 | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_NANO/d' configs/templates/$TNAME.config #删除配置项NANO | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_HTOP/d' configs/templates/$TNAME.config #删除配置项HTOP | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_LRZSZ/d' configs/templates/$TNAME.config #删除配置项LRZSZ | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_CURL/d' configs/templates/$TNAME.config #删除配置项CURL | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_OPENSSH/d' configs/templates/$TNAME.config #删除配置项OPENSSH | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_SFTP/d' configs/templates/$TNAME.config #删除配置项SFTP | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_TCPDUMP/d' configs/templates/$TNAME.config #删除配置项TCPDUMP | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_EAP_PEAP/d' configs/templates/$TNAME.config #删除配置项EAP_PEAP | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EC/d' configs/templates/$TNAME.config #删除配置项OPENSSL_EC | |
sed -i '/CONFIG_FIRMWARE_CPU_900MHZ/d' configs/templates/$TNAME.config #删除配置项超频900MHz | |
#################################################################### | |
# 以下选项是定义你需要的功能(y=集成,n=忽略),重新写入到.config文件。 | |
#################################################################### | |
echo "CONFIG_FIRMWARE_INCLUDE_LANG_CN=y" >> configs/templates/$TNAME.config #设置界面简体中文 | |
echo "CONFIG_FIRMWARE_INCLUDE_QOS=n" >> configs/templates/$TNAME.config #删除QOS | |
echo "CONFIG_FIRMWARE_INCLUDE_SMBD36=y" >> configs/templates/$TNAME.config #使用SMBD36新版本 | |
echo "CONFIG_FIRMWARE_INCLUDE_DDNS_SSL=n" >> configs/templates/$TNAME.config #删除DDNS_SSL | |
echo "CONFIG_FIRMWARE_INCLUDE_HTTPS=n" >> configs/templates/$TNAME.config #删除HTTPS | |
echo "CONFIG_FIRMWARE_INCLUDE_OPENVPN=n" >> configs/templates/$TNAME.config #删除OPENVPN | |
echo "CONFIG_FIRMWARE_INCLUDE_FFMPEG_NEW=y" >> configs/templates/$TNAME.config #使用FFMPEG新版本 | |
echo "CONFIG_FIRMWARE_INCLUDE_XUPNPD=n" >> configs/templates/$TNAME.config #删除用于IPTV的XUPNPD | |
echo "CONFIG_FIRMWARE_INCLUDE_DOGCOM=n" >> configs/templates/$TNAME.config #删除用于Drcom的工具DOGCOM | |
echo "CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS=n" >> configs/templates/$TNAME.config #删除SS plus+ | |
echo "CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER=n" >> configs/templates/$TNAME.config #删除DNSFORWARDER | |
echo "CONFIG_FIRMWARE_INCLUDE_VLMCSD=n" >> configs/templates/$TNAME.config #删除用于KMS的工具VLMCSD | |
echo "CONFIG_FIRMWARE_INCLUDE_TTYD=n" >> configs/templates/$TNAME.config #删除网页终端模拟器TTYD | |
echo "CONFIG_FIRMWARE_INCLUDE_NAPT66=n" >> configs/templates/$TNAME.config #删除用于二级路由、教育网分发IPv6地址的NAPT66 | |
echo "CONFIG_FIRMWARE_INCLUDE_SRELAY=n" >> configs/templates/$TNAME.config #删除SRELAY | |
echo "CONFIG_FIRMWARE_INCLUDE_SOCAT=n" >> configs/templates/$TNAME.config #删除工具SOCAT | |
echo "CONFIG_FIRMWARE_INCLUDE_MTR=y" >> configs/templates/$TNAME.config #删除工具MTR | |
echo "CONFIG_FIRMWARE_INCLUDE_IPERF3=y" >> configs/templates/$TNAME.config #删除工具IPERF3 | |
echo "CONFIG_FIRMWARE_INCLUDE_NANO=n" >> configs/templates/$TNAME.config #删除工具NANO | |
echo "CONFIG_FIRMWARE_INCLUDE_HTOP=n" >> configs/templates/$TNAME.config #删除工具HTOP | |
echo "CONFIG_FIRMWARE_INCLUDE_LRZSZ=y" >> configs/templates/$TNAME.config #删除工具LRZSZ | |
echo "CONFIG_FIRMWARE_INCLUDE_CURL=y" >> configs/templates/$TNAME.config #删除工具CURL | |
echo "CONFIG_FIRMWARE_INCLUDE_OPENSSH=y" >> configs/templates/$TNAME.config #删除OPENSSH | |
echo "CONFIG_FIRMWARE_INCLUDE_SFTP=n" >> configs/templates/$TNAME.config #删除SFTP | |
echo "CONFIG_FIRMWARE_INCLUDE_TCPDUMP=n" >> configs/templates/$TNAME.config #删除TCPDUMP | |
echo "CONFIG_FIRMWARE_INCLUDE_EAP_PEAP=n" >> configs/templates/$TNAME.config #删除EAP_PEAP | |
echo "CONFIG_FIRMWARE_INCLUDE_OPENSSL_EC=y" >> configs/templates/$TNAME.config #删除OPENSSL_EC | |
echo "CONFIG_FIRMWARE_CPU_900MHZ=n" >> configs/templates/$TNAME.config #开启超频,仅MT7621可用 | |
######################################################################################### | |
# 自定义添加其它功能请参考源码configs/templates/目录下的config文件。按照上面的格式添加即可 | |
# https://github.com/hanwckf/rt-n56u/blob/master/trunk/configs/templates/ | |
# 格式如下: | |
# sed -i '/自定义项/d' configs/templates/$TNAME.config | |
# echo "自定义项=y" >> configs/templates/$TNAME.config | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_FTPD/d' configs/templates/$TNAME.config #测试样例 | |
echo "CONFIG_FIRMWARE_INCLUDE_FTPD=n" >> configs/templates/$TNAME.config #测试样例 | |
######################################################################################### | |
# 以下插件为 chongshengB 版本专属插件,hanwckf 版不可用!!! | |
# 如需使用这些插件,请修改24行 BUILD_VERSION 为 chongshengB | |
######################################################################################### | |
if [ $BUILD_VERSION == "chongshengB" ]; then | |
echo "CONFIG_FIRMWARE_INCLUDE_SSOBFS=n" >> configs/templates/$TNAME.config #simple-obfs混淆插件 | |
echo "CONFIG_FIRMWARE_INCLUDE_ADBYBY=y" >> configs/templates/$TNAME.config #adbyby plus+ | |
echo "CONFIG_FIRMWARE_INCLUDE_ALIDDNS=y" >> configs/templates/$TNAME.config #阿里DDNS | |
echo "CONFIG_FIRMWARE_INCLUDE_SMARTDNS=y" >> configs/templates/$TNAME.config #smartdns | |
echo "CONFIG_FIRMWARE_INCLUDE_SMARTDNSBIN=y" >> configs/templates/$TNAME.config #smartdns二进制文件 | |
# 特别注意,开启v2同样需要开启113行的shadowsocks,否则不会编译 | |
echo "CONFIG_FIRMWARE_INCLUDE_V2RAY=n" >> configs/templates/$TNAME.config #集成v2ray执行文件(3.8M左右),如果不集成,会从网上下载下来执行,不影响正常使用 | |
echo "CONFIG_FIRMWARE_INCLUDE_TROJAN=n" >> configs/templates/$TNAME.config #集成trojan执行文件(1.1M左右),如果不集成,会从网上下载下来执行,不影响正常使用 | |
echo "CONFIG_FIRMWARE_INCLUDE_KOOLPROXY=n" >> configs/templates/$TNAME.config #KP广告过滤 | |
echo "CONFIG_FIRMWARE_INCLUDE_CADDY=y" >> configs/templates/$TNAME.config #在线文件管理服务 | |
echo "CONFIG_FIRMWARE_INCLUDE_CADDYBIN=n" >> configs/templates/$TNAME.config #集成caddu执行文件,此文件有13M,请注意固件大小。如果不集成,会从网上下载下来执行,不影响正常使用 | |
echo "CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME=y" >> configs/templates/$TNAME.config #集成AdGuardHome | |
echo "CONFIG_FIRMWARE_INCLUDE_WYY=y" >> configs/templates/$TNAME.config #网易云解锁 | |
echo "CONFIG_FIRMWARE_INCLUDE_WYYBIN=n" >> configs/templates/$TNAME.config #网易云解锁GO版本执行文件(4M多)注意固件超大小,不集成会自动下载 | |
echo "CONFIG_FIRMWARE_INCLUDE_ZEROTIER=n" >> configs/templates/$TNAME.config #zerotier ~1.3M | |
# 更新v2ray版本 | |
v2_version=`curl --silent "https://api.github.com/repos/v2fly/v2ray-core/releases/latest" | jq -r '.tag_name | sub("^v";"")'` | |
sed -i "s/V2ray_VERSION := .*/V2ray_VERSION := $v2_version/g" /opt/rt-n56u/trunk/user/v2ray/Makefile | |
sed -i 's|codeload.github.com/v2ray|codeload.github.com/v2fly|g' /opt/rt-n56u/trunk/user/v2ray/Makefile | |
fi | |
######################################################################################### | |
sudo ./clear_tree | |
cp -f configs/templates/$TNAME.config .config | |
sudo fakeroot ./build_firmware_modify $TNAME 0 | |
#sudo ./build_firmware_modify $TNAME 0 | |
sudo mv -f images/*.trx /opt/images/ | |
#cp .config /opt/images/test.config | |
- name : Upload packages | |
uses: actions/upload-artifact@master | |
with: | |
name: Padavan-packages | |
path: /opt/images | |
- name: Upload to release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: R${{ env.DATE }} for Padavan | |
artifacts: ${{ env.FILE_PATH }}/*.trx | |
allowUpdates: true | |
tag: R${{ env.DATE }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Delete workflow runs | |
uses: GitRML/delete-workflow-runs@main | |
with: | |
retain_days: 1 | |
keep_minimum_runs: 2 | |
- name: Remove old releases | |
uses: dev-drprasad/[email protected] | |
with: | |
keep_latest: 3 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |