Skip to content

Commit

Permalink
添加immortalwrt编译源
Browse files Browse the repository at this point in the history
  • Loading branch information
hugcabbage committed Nov 9, 2022
1 parent 9e27588 commit 7415bd0
Show file tree
Hide file tree
Showing 9 changed files with 228 additions and 14 deletions.
199 changes: 199 additions & 0 deletions .github/workflows/build-immortalwrt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
#
# Copyright (C) 2022 hugcabbage <[email protected]>
#
# This is free software, licensed under the MIT License.
#
# <https://github.com/hugcabbage/shared-lede>
#
# 源码采用immortalwrt openwrt-21.02分支
#
name: 固件编译 immortalwrt 21.02

on:
workflow_dispatch:
inputs:
build:
description: '若要编译固件,请输入true'
required: true
default: 'true'
type: string
model:
description: '选择设备'
required: true
type: choice
options:
- 'xiaomi-cr6608'
- 'xiaomi-cr6606'
- 'xiaomi-cr6609'
- 'redmi-ac2100'
- 'xiaomi-ac2100'
- 'xiaomi-4a-gigabit'
- 'xiaomi-3g-v2'
- 'xiaomi-3g'
- 'xiaomi-4'
- 'xiaomi-3-pro'
- 'phicomm-k2p'
- 'redmi-ax6s'
- 'xiaomi-4a-100m'
- 'xiaomi-4c'
- 'miwifi-nano'
- 'glinet-mt300n-v2'
- 'glinet-microuter-n300'
- 'miwifi-mini'
- 'miwifi-r3'
lan_ipad:
description: '设置LAN口IP地址(会覆盖modify脚本中的设置)'
required: false
default: ''
type: string
record:
description: '输入版本描述'
required: false
default: '升级内容:内核升级,更新应用版本'
type: string
release:
description: '上传到release'
required: false
default: true
type: boolean
artifact:
description: '上传到artifact'
required: false
type: boolean

jobs:
build:
name: 固件编译
if: inputs.build == 'true'
runs-on: ubuntu-latest
env:
TEMP_PREFIX: temp
DEPLOYDIR: preset-immortalwrt
steps:

- name: 初始空间情况
run: |
df -h
- name: Checkout
uses: actions/checkout@v3

- name: 环境准备
run: |
sudo apt-get update
sudo apt-get -y install \
antlr3 asciidoc autoconf automake autopoint binutils build-essential \
bzip2 device-tree-compiler flex g++-multilib gawk gcc-multilib \
gettext git gperf lib32gcc1 libc6-dev-i386 libelf-dev libglib2.0-dev \
libncurses5-dev libssl-dev libtinfo5 libtool libz-dev msmtp p7zip \
p7zip-full patch python3 qemu-utils subversion swig texinfo uglifyjs \
unzip upx xmlto zip zlib1g-dev
sudo apt-get clean
pip install -r extra-files/requirements-build.txt
- name: 读取配置
env:
MODEL_NAME: ${{ inputs.model }}
run: |
python3 $DEPLOYDIR/transit.py
- name: 下载源码与插件
env:
CLONE_SH: ${{ env.DEPLOYDIR }}/${{ env.TEMP_PREFIX }}.clone.sh
run: |
chmod +x $CLONE_SH
$CLONE_SH
- name: 升级feeds
run: |
./scripts/feeds update -a
./scripts/feeds install -a
- name: 修改配置
env:
MODIFY_SH: ${{ env.DEPLOYDIR }}/${{ env.TEMP_PREFIX }}.modify.sh
run: |
chmod +x $MODIFY_SH
$MODIFY_SH
${{ inputs.lan_ipad != '' }} && \
sed -i "/lan) ipad=/clan) ipad=\${ipaddr:-\"${{ inputs.lan_ipad }}\"} ;;" \
package/base-files/files/bin/config_generate
:
- name: 生成.config文件
env:
DOT_CONFIG: ${{ env.DEPLOYDIR }}/${{ env.TEMP_PREFIX }}.config
run: |
mv $DOT_CONFIG .config
make defconfig
- name: 下载编译资源
run: |
make download -j8 || make download -j1 V=s
- name: 编译
run: |
make -j$(nproc) || make -j1 V=s
- name: 整理固件目录
run: |
mkdir -p collected_firmware/packages
rm -rf $(find bin/targets/ -type d -name 'packages')
cp $(find bin/targets/ -type f) collected_firmware
cp $(find bin/packages/ -type f -name '*.ipk') collected_firmware/packages
cd collected_firmware
zip -r allfiles.zip *
cd packages
zip -r ../packages.zip *
- name: 读取release文本
id: release-text
if: inputs.release == true && env.RELEASE_FIRMWARE_VALUE != ''
env:
RELEASE_TEXT: ${{ env.DEPLOYDIR }}/${{ env.TEMP_PREFIX }}.release
RELEASE_FIRMWARE_VALUE: ${{ secrets.RELEASE_FIRMWARE }}
run: |
echo "RELEASE_TITLE=$(sed -n '1p' $RELEASE_TEXT)" >> $GITHUB_OUTPUT
echo 'RELEASE_BODY<<EOF' >> $GITHUB_OUTPUT
sed -n '2,$p' $RELEASE_TEXT >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: 计算tag版本
id: tag-version
if: steps.release-text.conclusion == 'success'
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.RELEASE_FIRMWARE }}
dry_run: true

- name: 上传固件到release
id: to-release
if: steps.release-text.conclusion == 'success'
continue-on-error: true
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.RELEASE_FIRMWARE }}
file: collected_firmware/*
tag: ${{ steps.tag-version.outputs.new_tag }}
release_name: ${{ steps.tag-version.outputs.new_version }} ${{ steps.release-text.outputs.RELEASE_TITLE }}
overwrite: true
prerelease: false
body: |
${{ steps.release-text.outputs.RELEASE_BODY }}
${{ inputs.record }}
file_glob: true

- name: 上传固件到artifact
if: inputs.artifact == true || steps.to-release.outcome != 'success'
uses: actions/upload-artifact@v3
with:
name: collected_firmware
path: |
collected_firmware/
!collected_firmware/*.zip
- name: 空间使用情况
run: |
df -h
echo "----------------------------"
du -h --max-depth=1
15 changes: 15 additions & 0 deletions preset-immortalwrt/1.clone.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# 下载源码
git clone --single-branch -b openwrt-21.02 https://github.com/immortalwrt/immortalwrt.git
mv ./immortalwrt/* ./

# 下载插件
SUPPLY_DIR=supply-packages
echo "src-link supply $PWD/$SUPPLY_DIR" >> feeds.conf.default
mkdir $SUPPLY_DIR && cd $SUPPLY_DIR
git clone --depth 1 https://github.com/jerrykuku/luci-theme-argon.git
git clone --depth 1 https://github.com/jerrykuku/luci-app-argon-config.git
git clone --depth 1 https://github.com/yichya/luci-app-xray.git
git clone --depth 1 -b packages https://github.com/xiaorouji/openwrt-passwall.git pw-dependencies
svn export https://github.com/xiaorouji/openwrt-passwall/branches/luci/luci-app-passwall
7 changes: 0 additions & 7 deletions official-openwrt/1.config → preset-immortalwrt/1.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt7621=y
CONFIG_TARGET_ramips_mt7621_DEVICE_xiaomi_mi-router-cr6608=y

# Collections
CONFIG_PACKAGE_luci=y

# Translations
CONFIG_LUCI_LANG_en=y
CONFIG_LUCI_LANG_zh_Hans=y

# Applications
CONFIG_PACKAGE_luci-app-argon-config=y
CONFIG_PACKAGE_luci-app-ddns=y
Expand Down
4 changes: 4 additions & 0 deletions preset-immortalwrt/1.modify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

#修改登录IP
#sed -i 's/192.168.1.1/192.168.10.1/g' package/base-files/files/bin/config_generate
7 changes: 0 additions & 7 deletions official-openwrt/2.config → preset-immortalwrt/2.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt7621=y
CONFIG_TARGET_ramips_mt7621_DEVICE_xiaomi_mi-router-4a-gigabit=y

# Collections
CONFIG_PACKAGE_luci=y

# Translations
CONFIG_LUCI_LANG_en=y
CONFIG_LUCI_LANG_zh_Hans=y

# Applications
CONFIG_PACKAGE_luci-app-argon-config=y
CONFIG_PACKAGE_luci-app-ddns=y
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions preset-immortalwrt/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This is the release content file.
# It will be showed in the release.

model_xiaomi-cr6608:
title: immortalwrt for xiaomi cr6608
body:
- 小米CR6608 immortalwrt固件
- 版本:immortalwrt源码,openwrt-21.02分支
- 登录信息:IP 192.168.1.1,密码 无
- 应用:argon主题、ddns、upnp等。
File renamed without changes.

0 comments on commit 7415bd0

Please sign in to comment.