Skip to content

Commit

Permalink
N1 OpenWrt
Browse files Browse the repository at this point in the history
  • Loading branch information
nantayo committed Jan 30, 2025
0 parents commit c13f446
Show file tree
Hide file tree
Showing 8 changed files with 465 additions and 0 deletions.
128 changes: 128 additions & 0 deletions .github/workflows/N1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Build ImmortalWrt for N1

on:
workflow_dispatch:
inputs:
ssh:
description: 'SSH connection to Actions'
required: false
default: 'false'
schedule:
- cron: "0 0 1,16 * *"

env:
REPO_URL: https://github.com/immortalwrt/immortalwrt
REPO_BRANCH: openwrt-23.05
CONFIG_FILE: N1/.config
DIY_SH: N1/diy.sh
FILES: N1/files
TZ: Asia/Shanghai

jobs:
build:
runs-on: ubuntu-20.04

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

- name: Free up space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Initialize environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E apt-get -qq update -y
sudo -E apt-get -qq install -y $(curl -fsSL https://raw.githubusercontent.com/nantayo/My-Pkg/master/2305)
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
- name: Clone source code
working-directory: /workdir
run: |
git clone $REPO_URL -b $REPO_BRANCH --single-branch --depth=1 openwrt
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
- name: Update & Install feeds
run: |
chmod +x $DIY_SH
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
$GITHUB_WORKSPACE/$DIY_SH
./scripts/feeds update -a
./scripts/feeds install -a
- name: Load custom config
run: |
[ -e $FILES ] && mv $FILES openwrt/files
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config
- name: SSH connect to Actions
uses: P3TERX/ssh2actions@main
if: (github.event.inputs.ssh == 'true') || contains(github.event.action, 'ssh')

- name: Download package
working-directory: ./openwrt
run: |
make defconfig
make download -j8
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
- name: Compile the firmware
run: |
chmod -R 755 openwrt
cd openwrt
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 || make -j1 V=s
echo "compile_status=success" >> $GITHUB_ENV
- name: Package armsr as openwrt
if: ${{ env.compile_status }} == 'success' && !cancelled()
uses: unifreq/openwrt_packit@master
env:
OPENWRT_ARMVIRT: openwrt/bin/targets/*/*/*.tar.gz
KERNEL_REPO_URL: breakingbadboy/OpenWrt
KERNEL_VERSION_NAME: 6.1.y
PACKAGE_SOC: diy
GZIP_IMGS: .xz
SCRIPT_DIY_PATH: N1/mk_s905d_n1.sh
WHOAMI: nantayo
SW_FLOWOFFLOAD: 0
SFE_FLOW: 0

- name: Upload firmware to release
uses: softprops/action-gh-release@master
if: ${{ env.PACKAGED_STATUS == 'success' }} && !cancelled()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: OpenWrt_${{ env.PACKAGED_OUTPUTDATE }}
files: ${{ env.PACKAGED_OUTPUTPATH }}/*.img.xz
body: |
首次使用建议全新刷写
* 基本信息
IP: 192.168.2.2
账户: root
密码: password
- name: Delete old releases
uses: dev-drprasad/delete-older-releases@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
keep_latest: 2
delete_tags : true
80 changes: 80 additions & 0 deletions N1/.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
CONFIG_TARGET_armsr=y
CONFIG_TARGET_armsr_armv8=y
CONFIG_TARGET_armsr_armv8_DEVICE_generic=y
CONFIG_TARGET_ROOTFS_INITRAMFS=n
CONFIG_TARGET_ROOTFS_CPIOGZ=n
CONFIG_TARGET_ROOTFS_EXT4FS=n
CONFIG_TARGET_ROOTFS_SQUASHFS=n

# luci
CONFIG_PACKAGE_luci-app-amlogic=y
CONFIG_PACKAGE_luci-app-dockerman=y
CONFIG_PACKAGE_luci-app-filetransfer=n
CONFIG_PACKAGE_luci-app-passwall=y
CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Libev_Client=n
CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Libev_Server=n
CONFIG_PACKAGE_luci-app-samba4=y

# kmod
CONFIG_PACKAGE_kmod-amazon-ena=n
CONFIG_PACKAGE_kmod-atlantic=n
CONFIG_PACKAGE_kmod-bcmgenet=n
CONFIG_PACKAGE_kmod-dwmac-imx=n
CONFIG_PACKAGE_kmod-dwmac-rockchip=n
CONFIG_PACKAGE_kmod-dwmac-sun8i=n
CONFIG_PACKAGE_kmod-e1000e=n
CONFIG_PACKAGE_kmod-fsl-dpaa1-net=n
CONFIG_PACKAGE_kmod-fsl-dpaa2-net=n
CONFIG_PACKAGE_kmod-fsl-enetc-net=n
CONFIG_PACKAGE_kmod-fsl-fec=n
CONFIG_PACKAGE_kmod-fsl-xgmac-mdio=n
CONFIG_PACKAGE_kmod-gpio-pca953x=n
CONFIG_PACKAGE_kmod-i2c-mux-pca954x=n
CONFIG_PACKAGE_kmod-macsec=n
CONFIG_PACKAGE_kmod-mdio-bcm-unimac=n
CONFIG_PACKAGE_kmod-mvneta=n
CONFIG_PACKAGE_kmod-mvpp2=n
CONFIG_PACKAGE_kmod-net-selftests=n
CONFIG_PACKAGE_kmod-octeontx2-net=n
CONFIG_PACKAGE_kmod-phy-aquantia=n
CONFIG_PACKAGE_kmod-phy-broadcom=n
CONFIG_PACKAGE_kmod-phy-marvell=n
CONFIG_PACKAGE_kmod-phy-marvell-10g=n
CONFIG_PACKAGE_kmod-phy-realtek=n
CONFIG_PACKAGE_kmod-phy-smsc=n
CONFIG_PACKAGE_kmod-ppp=n
CONFIG_PACKAGE_kmod-ptp=n
CONFIG_PACKAGE_kmod-renesas-net-avb=n
CONFIG_PACKAGE_kmod-rtc-rx8025=n
CONFIG_PACKAGE_kmod-sfp=n
CONFIG_PACKAGE_kmod-stmmac-core=n
CONFIG_PACKAGE_kmod-thunderx-net=n
CONFIG_PACKAGE_kmod-usb2=y
CONFIG_PACKAGE_kmod-vmxnet3=n
CONFIG_PACKAGE_kmod-wdt-sp805=n

# other packages
CONFIG_PACKAGE_autocore=y
CONFIG_PACKAGE_fstrim=y
CONFIG_PACKAGE_partx-utils=n
CONFIG_PACKAGE_ppp=n
CONFIG_PACKAGE_shellsync=n
CONFIG_PACKAGE_zoneinfo-asia=y

# necessary
CONFIG_BTRFS_PROGS_ZSTD=y
CONFIG_PACKAGE_bsdtar=y
CONFIG_PACKAGE_btrfs-progs=y
CONFIG_PACKAGE_chattr=y
CONFIG_PACKAGE_f2fs-tools=y
CONFIG_PACKAGE_gawk=y
CONFIG_PACKAGE_getopt=y
CONFIG_PACKAGE_lsattr=y
CONFIG_PACKAGE_perlbase-file=y
CONFIG_PACKAGE_perlbase-getopt=y
CONFIG_PACKAGE_perlbase-unicode=y
CONFIG_PACKAGE_perl-http-date=y
CONFIG_PACKAGE_pigz=y
CONFIG_PACKAGE_tar=y
CONFIG_PACKAGE_xfs-fsck=y
CONFIG_PACKAGE_xfs-mkfs=y
14 changes: 14 additions & 0 deletions N1/diy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Default IP
sed -i 's/192.168.1.1/192.168.2.2/g' package/base-files/files/bin/config_generate

# Add packages
git clone https://github.com/ophub/luci-app-amlogic --depth=1 package/amlogic
git clone https://github.com/xiaorouji/openwrt-passwall --depth=1 package/passwall

# Update packages
cp -fr package/amlogic/luci-app-amlogic package/passwall/luci-app-passwall feeds/luci/applications/

# Clean packages
rm -rf package/amlogic package/passwall
15 changes: 15 additions & 0 deletions N1/files/etc/config/amlogic
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
config amlogic 'config'
option enable '1'
option amlogic_firmware_repo 'https://github.com/nantayo/N1-OpenWrt'
option amlogic_firmware_tag 'OpenWrt'
option amlogic_firmware_suffix '.img.xz'
option amlogic_kernel_path 'https://github.com/breakingbadboy/OpenWrt'
option amlogic_kernel_branch '6.1'
option amlogic_firmware_config '1'
option amlogic_write_bootloader '1'
option amlogic_shared_fstype 'ext4'

config settings 'armcpu'
option governor0 'performance'
option minfreq0 '1512000'
option maxfreq0 '1512000'
25 changes: 25 additions & 0 deletions N1/files/etc/config/network
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config interface 'docker'
option device 'docker0'
option proto 'none'
option auto '0'

config interface 'lan'
option proto 'static'
option netmask '255.255.255.0'
option device 'eth0'
option ipaddr '192.168.2.2'
option gateway '192.168.2.1'
option delegate '0'

config device
option type 'bridge'
option name 'docker0'

config globals 'globals'
option packet_steering '1'
2 changes: 2 additions & 0 deletions N1/files/etc/crontabs/root
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0 4 * * * fstrim -a
0 3 * * 1 reboot
Loading

0 comments on commit c13f446

Please sign in to comment.