Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Chuck <[email protected]>
  • Loading branch information
fanck0605 committed Feb 18, 2021
0 parents commit fea1b38
Show file tree
Hide file tree
Showing 29 changed files with 2,022 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#
# This is free software, license use GPLv3.
#
# Copyright (c) 2020, Chuck <[email protected]>
#

name: openwrt-master

on:
push:
branches:
- openwrt-master
schedule:
- cron: '00 18 * * *'
watch:
types: [started]

jobs:

build:

runs-on: ubuntu-18.04
if: github.event.repository.owner.id == github.event.sender.id

steps:

- name: Checkout Project
uses: actions/checkout@v2
with:
ref: openwrt-master

- name: Initialize Environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
docker image prune -a -f
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo -E apt update
sudo -E apt install build-essential ccache ecj fastjar file g++ gawk gettext git java-propose-classpath libelf-dev libncurses5-dev libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget python3-distutils python3-setuptools rsync subversion swig time xsltproc zlib1g-dev
wget -O- https://raw.githubusercontent.com/friendlyarm/build-env-on-ubuntu-bionic/master/install.sh | bash
sudo -E apt -y autoremove --purge
sudo -E apt clean
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
- name: Build OpenWrt
run: |
./build.sh
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: OpenWrt
path: OpenWrt_*_NanoPi-R2S.tar.gz
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.idea/
/openwrt/
/OpenWrt_*_NanoPi-R2S.tar.gz
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 基于原生 OpenWrt 的 NanoPi R2s 固件

## 温情提醒

- WAN 和 LAN 默认是**互换**的,请注意网线接法。

- 刷机请**不要**保留配置,以免产生未知的问题!

## 说明

- ipv4: 192.168.2.1
- username: root
- password: password
117 changes: 117 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/bin/bash
#
# This is free software, license use GPLv3.
#
# Copyright (c) 2020, Chuck <[email protected]>
#

set -eu

rm -rf openwrt
git clone -b master https://github.com/openwrt/openwrt.git openwrt

# customize patches
pushd openwrt
git am -3 ../patches/*.patch
popd

# initialize feeds
feed_list=$(ls -l patches | awk '/^d/ { print $NF }')
pushd openwrt
# clone feeds
./scripts/feeds update -a
# patching
pushd feeds
for feed in $feed_list ; do
[ -d $feed ] && {
pushd $feed
git am -3 ../../../patches/$feed/*.patch
popd
}
done
popd
popd

# addition packages
pushd openwrt/package
# luci-app-helloworld
svn co https://github.com/fw876/helloworld/trunk/luci-app-ssr-plus lean/luci-app-ssr-plus
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/shadowsocksr-libev lean/shadowsocksr-libev
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/pdnsd-alt lean/pdnsd-alt
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/microsocks lean/microsocks
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/dns2socks lean/dns2socks
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/simple-obfs lean/simple-obfs
svn co https://github.com/fw876/helloworld/trunk/tcping lean/tcping
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/v2ray-plugin lean/v2ray-plugin
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/trojan lean/trojan
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/ipt2socks lean/ipt2socks
svn co https://github.com/fw876/helloworld/trunk/naiveproxy lean/naiveproxy
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/redsocks2 lean/redsocks2
# luci-app-openclash
svn co https://github.com/vernesong/OpenClash/trunk/luci-app-openclash lean/luci-app-openclash
# luci-app-filebrowser
svn co https://github.com/immortalwrt/immortalwrt/branches/master/package/ctcgfw/luci-app-filebrowser lean/luci-app-filebrowser
svn co https://github.com/immortalwrt/immortalwrt/branches/master/package/ctcgfw/filebrowser lean/filebrowser
# luci-app-arpbind
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/luci-app-arpbind lean/luci-app-arpbind
# coremark
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/coremark lean/coremark
# luci-app-xlnetacc
svn co https://github.com/immortalwrt/immortalwrt/branches/master/package/lean/luci-app-xlnetacc lean/luci-app-xlnetacc
# luci-app-oled
git clone --depth 1 https://github.com/NateLol/luci-app-oled.git lean/luci-app-oled
# luci-app-unblockmusic
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/luci-app-unblockmusic lean/luci-app-unblockmusic
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/UnblockNeteaseMusic lean/UnblockNeteaseMusic
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/UnblockNeteaseMusicGo lean/UnblockNeteaseMusicGo
# luci-app-autoreboot
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/luci-app-autoreboot lean/luci-app-autoreboot
# luci-app-vsftpd
svn co https://github.com/immortalwrt/immortalwrt/branches/master/package/lean/luci-app-vsftpd lean/luci-app-vsftpd
svn co https://github.com/immortalwrt/immortalwrt/branches/master/package/lean/vsftpd-alt lean/vsftpd-alt
# luci-app-netdata
svn co https://github.com/coolsnowwolf/lede/trunk/package/lean/luci-app-netdata lean/luci-app-netdata
# ddns-scripts
svn co https://github.com/immortalwrt/immortalwrt/branches/master/package/lean/ddns-scripts_aliyun lean/ddns-scripts_aliyun
svn co https://github.com/immortalwrt/immortalwrt/branches/master/package/lean/ddns-scripts_dnspod lean/ddns-scripts_dnspod
popd

# zh_cn to zh_Hans
pushd openwrt/package
../../scripts/convert_translation.sh
popd

# create acl files
pushd openwrt
../scripts/create_acl_for_luci.sh -a
popd

#install packages
pushd openwrt
./scripts/feeds install -a
popd

# customize configs
pushd openwrt
cat ../config.seed > .config
make defconfig
popd

# build openwrt
pushd openwrt
make download -j8
make -j$(($(nproc) + 1)) || make -j1 V=s
popd

# package output files
archive_tag=OpenWrt_$(date +%Y%m%d)_NanoPi-R2S
pushd openwrt/bin/targets/*/*
# repack openwrt*.img.gz
set +e
gunzip openwrt*.img.gz
set -e
gzip openwrt*.img
sha256sum -b $(ls -l | awk '/^-/ { print $NF }' | grep -v sha256sums) >sha256sums
tar zcf $archive_tag.tar.gz $(ls -l | awk '/^-/ { print $NF }')
popd
mv openwrt/bin/targets/*/*/$archive_tag.tar.gz .
81 changes: 81 additions & 0 deletions config.seed
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
CONFIG_TARGET_rockchip=y
CONFIG_TARGET_rockchip_armv8=y
CONFIG_TARGET_rockchip_armv8_DEVICE_friendlyarm_nanopi-r2s=y
CONFIG_TARGET_ROOTFS_PARTSIZE=256

CONFIG_LUCI_LANG_en=y
CONFIG_LUCI_LANG_zh_Hans=y
CONFIG_LUCI_LANG_zh_Hant=y

CONFIG_OPENSSL_OPTIMIZE_SPEED=y

CONFIG_PACKAGE_kmod-fs-ext4=y
CONFIG_PACKAGE_kmod-fs-f2fs=y
CONFIG_PACKAGE_kmod-fs-ntfs=y
CONFIG_PACKAGE_kmod-fs-vfat=y
CONFIG_PACKAGE_kmod-tcp-bbr=y
CONFIG_PACKAGE_kmod-tun=y
CONFIG_PACKAGE_kmod-usb-net-rndis=y
CONFIG_PACKAGE_kmod-usb-net-rtl8150=y
CONFIG_PACKAGE_kmod-usb-ohci-pci=y
CONFIG_PACKAGE_kmod-usb-storage-extras=y
CONFIG_PACKAGE_kmod-usb-storage-uas=y
CONFIG_PACKAGE_kmod-usb-uhci=y
CONFIG_PACKAGE_kmod-usb2-pci=y
CONFIG_PACKAGE_kmod-usb3=y

CONFIG_PACKAGE_bash=y
CONFIG_PACKAGE_bc=y
CONFIG_PACKAGE_bind-dig=y
CONFIG_PACKAGE_bind-host=y
CONFIG_PACKAGE_block-mount=y
CONFIG_PACKAGE_coremark=y
CONFIG_PACKAGE_coreutils-nohup=y
CONFIG_PACKAGE_curl=y
CONFIG_PACKAGE_ddns-scripts=y
CONFIG_PACKAGE_ddns-scripts-cloudflare=y
CONFIG_PACKAGE_ddns-scripts-noip=y
CONFIG_PACKAGE_ddns-scripts_aliyun=y
CONFIG_PACKAGE_ddns-scripts_dnspod=y
# CONFIG_PACKAGE_dnsmasq is not set
CONFIG_PACKAGE_dnsmasq-full=y
CONFIG_PACKAGE_ethtool=y
CONFIG_PACKAGE_f2fs-tools=y
CONFIG_PACKAGE_fdisk=y
CONFIG_PACKAGE_gzip=y
CONFIG_PACKAGE_htop=y
CONFIG_PACKAGE_iftop=y
CONFIG_PACKAGE_ip6tables-mod-nat=y
CONFIG_PACKAGE_losetup=y
CONFIG_PACKAGE_nano=y
CONFIG_PACKAGE_openssh-sftp-server=y
CONFIG_PACKAGE_pv=y
CONFIG_PACKAGE_python3=y
CONFIG_PACKAGE_stress=y
CONFIG_PACKAGE_triggerhappy=y
CONFIG_PACKAGE_unzip=y
CONFIG_PACKAGE_usb-modeswitch=y
CONFIG_PACKAGE_usbutils=y
CONFIG_PACKAGE_vim-fuller=y
CONFIG_PACKAGE_wget-ssl=y
CONFIG_PACKAGE_wpad-openssl=y
CONFIG_PACKAGE_zstd=y

CONFIG_PACKAGE_luci=y
CONFIG_PACKAGE_luci-app-arpbind=y
CONFIG_PACKAGE_luci-app-autoreboot=y
CONFIG_PACKAGE_luci-app-ddns=y
CONFIG_PACKAGE_luci-app-filebrowser=y
CONFIG_PACKAGE_luci-app-frpc=y
CONFIG_PACKAGE_luci-app-netdata=y
CONFIG_PACKAGE_luci-app-oled=y
CONFIG_PACKAGE_luci-app-openclash=y
CONFIG_PACKAGE_luci-app-samba4=y
CONFIG_PACKAGE_luci-app-ssr-plus=y
CONFIG_PACKAGE_luci-app-ttyd=y
CONFIG_PACKAGE_luci-app-unblockmusic=y
CONFIG_PACKAGE_luci-app-upnp=y
CONFIG_PACKAGE_luci-app-vsftpd=y
CONFIG_PACKAGE_luci-app-wol=y
CONFIG_PACKAGE_luci-app-xlnetacc=y
CONFIG_PACKAGE_luci-compat=y
35 changes: 35 additions & 0 deletions patches/0001-base-files-set-default-ipaddr-to-192.168.2.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chuck <[email protected]>
Date: Sat, 4 Jul 2020 12:07:43 +0800
Subject: [PATCH] base-files: set default ipaddr to 192.168.2.1

Signed-off-by: Chuck <[email protected]>
---
package/base-files/files/bin/config_generate | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
index ee3958e733..cf656f7be5 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -89,7 +89,7 @@ generate_static_network() {
fi
}

-addr_offset=2
+addr_offset=3
generate_network() {
local ifname macaddr protocol type ipaddr netmask vlan
local bridge=$2
@@ -140,7 +140,7 @@ generate_network() {
static)
local ipad
case "$1" in
- lan) ipad=${ipaddr:-"192.168.1.1"} ;;
+ lan) ipad=${ipaddr:-"192.168.2.1"} ;;
*) ipad=${ipaddr:-"192.168.$((addr_offset++)).1"} ;;
esac

--
2.25.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chuck <[email protected]>
Date: Fri, 8 May 2020 17:39:43 +0800
Subject: [PATCH] toolchain: optimize for performance instead of size

Signed-off-by: Chuck <[email protected]>
---
include/target.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/target.mk b/include/target.mk
index 7526224972..bca38bcf3b 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -191,7 +191,7 @@ LINUX_RECONF_DIFF = $(SCRIPT_DIR)/kconfig.pl - '>' $(call __linux_confcmd,$(filt
ifeq ($(DUMP),1)
BuildTarget=$(BuildTargets/DumpCurrent)

- CPU_CFLAGS = -Os -pipe
+ CPU_CFLAGS = -O2 -pipe
ifneq ($(findstring mips,$(ARCH)),)
ifneq ($(findstring mips64,$(ARCH)),)
CPU_TYPE ?= mips64
--
2.25.1

26 changes: 26 additions & 0 deletions patches/0003-rockchip-swap-wan-and-lan-for-NanoPi-R2S.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chuck <[email protected]>
Date: Sat, 11 Jul 2020 13:29:45 +0800
Subject: [PATCH] rockchip: swap wan and lan for NanoPi R2S

Signed-off-by: Chuck <[email protected]>
---
target/linux/rockchip/armv8/base-files/etc/board.d/02_network | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network
index 48133c81a1..befded1059 100755
--- a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network
+++ b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network
@@ -9,7 +9,7 @@ rockchip_setup_interfaces()

case "$board" in
friendlyarm,nanopi-r2s)
- ucidef_set_interfaces_lan_wan 'eth1' 'eth0'
+ ucidef_set_interfaces_lan_wan 'eth0' 'eth1'
;;
*)
ucidef_set_interface_lan 'eth0'
--
2.25.1

0 comments on commit fea1b38

Please sign in to comment.