Explorar o código

Upgrade kernel to 5.10

garypang13 %!s(int64=4) %!d(string=hai) anos
pai
achega
326340b133

+ 10 - 10
README.md

@@ -2,19 +2,19 @@
 [1]: https://img.shields.io/badge/license-GPLV2-brightgreen.svg
 [2]: /LICENSE
 [3]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
-[4]: https://github.com/garypang13/Actions-OpenWrt/pulls
+[4]: https://github.com/garypang13/OpenWrt_x86-r2s-r4s-Rpi/pulls
 [5]: https://img.shields.io/badge/Issues-welcome-brightgreen.svg
-[6]: https://github.com/garypang13/Actions-OpenWrt/issues/new
+[6]: https://github.com/garypang13/OpenWrt_x86-r2s-r4s-Rpi/issues/new
 [7]: https://img.shields.io/github/v/release/hyird/Action-Openwrt
-[8]: https://github.com/garypang13/Actions-OpenWrt/releases
+[8]: https://github.com/garypang13/OpenWrt_x86-r2s-r4s-Rpi/releases
 [10]: https://img.shields.io/badge/Contact-telegram-blue
 [11]: https://t.me/opwrts
-[12]: https://github.com/garypang13/Actions-OpenWrt/workflows/Openwrt-AutoBuild/badge.svg
-[13]: https://github.com/garypang13/Actions-OpenWrt/actions
+[12]: https://github.com/garypang13/OpenWrt_x86-r2s-r4s-Rpi/actions/workflows/Openwrt-AutoBuild.yml/badge.svg
+[13]: https://github.com/garypang13/OpenWrt_x86-r2s-r4s-Rpi/actions
 
 [![license][1]][2]
-[![GitHub Stars](https://img.shields.io/github/stars/garypang13/Actions-OpenWrt.svg?style=flat-square&label=Stars)](https://github.com/garypang13/Actions-OpenWrt-Nginx/stargazers)
-[![GitHub Forks](https://img.shields.io/github/forks/garypang13/Actions-OpenWrt.svg?style=flat-square&label=Forks)](https://github.com/garypang13/Actions-OpenWrt-Nginx/fork)
+[![GitHub Stars](https://img.shields.io/github/stars/garypang13/OpenWrt_x86-r2s-r4s-Rpi.svg?style=flat-square&label=Stars)](https://github.com/garypang13/OpenWrt_x86-r2s-r4s-Rpi-Nginx/stargazers)
+[![GitHub Forks](https://img.shields.io/github/forks/garypang13/OpenWrt_x86-r2s-r4s-Rpi.svg?style=flat-square&label=Forks)](https://github.com/garypang13/OpenWrt_x86-r2s-r4s-Rpi-Nginx/fork)
 [![PRs Welcome][3]][4]
 [![Issue Welcome][5]][6]
 [![AutoBuild][12]][13]
@@ -22,7 +22,7 @@
 <a href="https://t.me/opwrts" target="_blank">Telegram</a>
 ### 特色:
 
-+ Cutting edge,openwrt官方openwrt-21.02分支版本, 内核升级到5.4. 与官方最新源码同步.
++ Cutting edge,openwrt官方openwrt-21.02分支版本, 内核升级到5.10. 与官方最新源码同步.
 
 + 原生极致纯净,固件默认只包含基础上网功能,后台在线选装插件,自建插件仓库囊括了市面上主流开源插件,系统升级不丢失插件和配置.
 
@@ -55,7 +55,7 @@
 
 云编译需要 [在此](https://github.com/settings/tokens) 创建个token,然后在此仓库Settings->Secrets中添加个名字为REPO_TOKEN的Secret,填入token值,否者无法触发编译
 
-在仓库Settings->Secrets中分别添加 PPPOE_USERNAME, PPPOE_PASSWD 可设置默认拨号账号密码.有 [安全隐患](https://github.com/garypang13/Actions-OpenWrt/issues/23)
+在仓库Settings->Secrets中分别添加 PPPOE_USERNAME, PPPOE_PASSWD 可设置默认拨号账号密码.有 [安全隐患](https://github.com/garypang13/OpenWrt_x86-r2s-r4s-Rpi/issues/23)
 
 Secrets中添加 SCKEY 可通过[Server酱](http://sc.ftqq.com) 推送编译结果到微信
 
@@ -116,7 +116,7 @@ Build OpenWrt using GitHub Actions
 - [Lean's OpenWrt](https://github.com/coolsnowwolf/lede)
 - [CTCGFW's Team](https://github.com/immortalwrt/immortalwrt)
 - [Lienol](https://github.com/Lienol/openwrt)
-- [P3TERX](https://github.com/P3TERX/Actions-OpenWrt/blob/master/LICENSE)
+- [P3TERX](https://github.com/P3TERX/OpenWrt_x86-r2s-r4s-Rpi/blob/master/LICENSE)
 - [upload-release-action](https://github.com/svenstaro/upload-release-action)
 - [Microsoft](https://www.microsoft.com)
 - [Microsoft Azure](https://azure.microsoft.com)

+ 0 - 4
devices/Rpi-4B/.config

@@ -19,10 +19,6 @@ CONFIG_PACKAGE_kmod-nf-ipvs=y
 CONFIG_PACKAGE_kmod-veth=y
 CONFIG_PACKAGE_kmod-dummy=y
 
-CONFIG_PACKAGE_luci-app-turboacc=y
-CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_flow-offload=y
-CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_shortcut-fe=n
-
 # 其他需要安装的软件包:
 CONFIG_PACKAGE_autocore=n
 CONFIG_PACKAGE_autocore-arm=y

+ 1 - 1
devices/Rpi-4B/default-settings

@@ -11,6 +11,6 @@ test $version -lt 2 && {
 uci set base_config.@status[0].version=$version
 uci commit base_config
 
-sed -i '1i src/gz openwrt_custom https://op.supes.top/packages/aarch64_cortex-a53' /etc/opkg/distfeeds.conf
+sed -i '1i src/gz openwrt_custom https://op.supes.top/packages/aarch64_cortex-a72' /etc/opkg/distfeeds.conf
 
 exit 0

+ 2 - 0
devices/common/.config

@@ -43,6 +43,8 @@ CONFIG_PACKAGE_luci-lib-ipkg=y
 CONFIG_PACKAGE_luci-lib-fs=y
 CONFIG_PACKAGE_luci-proto-relay=y
 CONFIG_PACKAGE_luci-app-turboacc=y
+CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_flow-offload=y
+CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_shortcut-fe=n
 CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_dnsforwarder=n
 CONFIG_LUCI_LANG_zh_Hans=y
 CONFIG_LUCI_LANG_en=y

+ 11 - 3
devices/common/diy.sh

@@ -6,17 +6,25 @@ rm -Rf feeds/packages/utils/cgroupfs-mount
 ./scripts/feeds update luci packages custom
 ./scripts/feeds install -a
 sed -i 's/Os/O2/g' include/target.mk
+rm -rf target/linux package/kernel include/{kernel-version.mk,kernel-defaults.mk}
+svn co https://github.com/openwrt/openwrt/trunk/target/linux target/linux ; rm -rf target/linux/.svn
+svn co https://github.com/openwrt/openwrt/trunk/package/kernel package/kernel ; rm -rf package/kernel/.svn
+wget -O include/kernel-version.mk https://raw.githubusercontent.com/openwrt/openwrt/master/include/kernel-version.mk
+wget -O include/kernel-defaults.mk https://raw.githubusercontent.com/openwrt/openwrt/master/include/kernel-defaults.mk
+sed -i '/libelf\/compile/d' tools/Makefile
+sed -i 's/ libelf//' tools/Makefile
+find package/*/ -maxdepth 1 -name ".svn" | xargs -i rm -rf {}
 rm -Rf tools/upx && svn co https://github.com/coolsnowwolf/lede/trunk/tools/upx tools/upx
 rm -Rf tools/ucl && svn co https://github.com/coolsnowwolf/lede/trunk/tools/ucl tools/ucl
 sed -i 's?zstd$?zstd ucl upx\n$(curdir)/upx/compile := $(curdir)/ucl/compile?g' tools/Makefile
-echo -e "\q" | svn co https://github.com/immortalwrt/immortalwrt/branches/master/target/linux/generic/hack-5.4 target/linux/generic/hack-5.4
-wget -O target/linux/generic/pending-5.4/601-add-kernel-imq-support.patch https://raw.githubusercontent.com/immortalwrt/immortalwrt/master/target/linux/generic/pending-5.4/601-add-kernel-imq-support.patch
+echo -e "\q" | svn co https://github.com/immortalwrt/immortalwrt/branches/master/target/linux/generic/hack-5.10 target/linux/generic/hack-5.10/
 rm -rf package/network/services/ppp package/libs/libnfnetlink
 svn co https://github.com/openwrt/openwrt/trunk/package/network/services/ppp package/network/services/ppp
 svn co https://github.com/openwrt/openwrt/trunk/package/libs/libnfnetlink package/libs/libnfnetlink
 rm -rf package/network/services/dnsmasq
 svn co https://github.com/immortalwrt/immortalwrt/branches/master/package/network/services/dnsmasq package/network/services/dnsmasq
 sed -i "s/'class': 'table'/'class': 'table memory'/g" package/*/*/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js
+sed -i 's/$(TARGET_DIR)) install/$(TARGET_DIR)) install --force-overwrite/' package/Makefile
 sed -i 's/+acme\( \|$\)/+acme +acme-dnsapi\1/g' package/*/*/luci-app-acme/Makefile
 sed -i '$a /etc/sysupgrade.conf' package/base-files/files/lib/upgrade/keep.d/base-files-essential
 sed -i '$a /etc/amule' package/base-files/files/lib/upgrade/keep.d/base-files-essential
@@ -41,7 +49,7 @@ sed -i 's/PKG_BUILD_DIR:=/PKG_BUILD_DIR?=/g' feeds/luci/luci.mk
 sed -i 's?admin/status/channel_analysis??' package/feeds/luci/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json
 sed -i '/killall -HUP/d' feeds/luci/luci.mk
 find package target -name inittab | xargs -i sed -i "s/askfirst/respawn/g" {}
-for ipk in $(find package/feeds/custom/* -maxdepth 0); do	
+for ipk in $(find package/feeds/custom/* -maxdepth 0); do
 	if [[ ! -d "$ipk/patches" && ! "$(grep "codeload.github.com" $ipk/Makefile)" ]]; then
 		find $ipk/ -maxdepth 1 ! -path *tcping* -name "Makefile" \
 		| xargs -i sed -i "s/PKG_SOURCE_VERSION:=[0-9a-z]\{15,\}/PKG_SOURCE_VERSION:=HEAD/g" {}

+ 0 - 17
devices/common/patches/dns_redirect.patch

@@ -11,20 +11,3 @@
  		s.taboption('general', form.Flag, 'domainneeded',
  			_('Domain required'),
  			_('Don\'t forward <abbr title="Domain Name System">DNS</abbr>-Requests without <abbr title="Domain Name System">DNS</abbr>-Name'));
-
---- a/package/network/services/dnsmasq/files/dnsmasq.init
-+++ b/package/network/services/dnsmasq/files/dnsmasq.init
-@@ -1122,7 +1122,12 @@ dnsmasq_start()
- 
- 	config_get_bool dns_redirect "$cfg" dns_redirect 0
- 	config_get dns_port "$cfg" port 53
--	[ "$dns_redirect" = 1 ] && iptables -t nat -A PREROUTING -m comment --comment "DNSMASQ" -p udp --dport 53 -j REDIRECT --to-ports $dns_port
-+	[ $dns_redirect = 1 ] && {
-+	 iptables -t nat -A PREROUTING -m comment --comment "DNSMASQ" -p udp --dport 53 -j REDIRECT --to-ports $dns_port
-+	 iptables -t nat -A PREROUTING -m comment --comment "DNSMASQ" -p tcp --dport 53 -j REDIRECT --to-ports $dns_port
-+	 ip6tables -t nat -A PREROUTING -m comment --comment "DNSMASQ" -p udp --dport 53 -j REDIRECT --to-ports $dns_port
-+	 ip6tables -t nat -A PREROUTING -m comment --comment "DNSMASQ" -p tcp --dport 53 -j REDIRECT --to-ports $dns_port
-+	}
- }
- 
- dnsmasq_stop()

+ 0 - 10
devices/common/patches/dnsmasq-add-filter-aaaa-option.patch

@@ -1,10 +0,0 @@
---- a/package/network/services/dnsmasq/files/dnsmasq.init
-+++ b/package/network/services/dnsmasq/files/dnsmasq.init
-@@ -865,6 +865,7 @@ dnsmasq_start()
- 	append_bool "$cfg" sequential_ip "--dhcp-sequential-ip"
- 	append_bool "$cfg" allservers "--all-servers"
- 	append_bool "$cfg" noping "--no-ping"
-+	append_bool "$cfg" filteraaaa "--filter-aaaa"
- 	append_bool "$cfg" rapidcommit "--dhcp-rapid-commit"
- 	append_bool "$cfg" scriptarp "--script-arp"
- 

+ 0 - 22
devices/common/patches/force-overwrite.patch

@@ -1,22 +0,0 @@
-From af680b488e33d0921eb55f333bdccf14928ed850 Mon Sep 17 00:00:00 2001
-From: garypang13 <[email protected]>
-Date: Wed, 28 Oct 2020 19:11:14 +0800
-Subject: [PATCH] Update Makefile
-
----
- package/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/package/Makefile b/package/Makefile
-index ec503dc5273d..99b51f70f2fb 100644
---- a/package/Makefile
-+++ b/package/Makefile
-@@ -66,7 +66,7 @@ $(curdir)/install: $(TMP_DIR)/.build $(curdir)/merge $(if $(CONFIG_TARGET_PER_DE
- 	- find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
- 	rm -rf $(TARGET_DIR) $(TARGET_DIR_ORIG)
- 	mkdir -p $(TARGET_DIR)/tmp
--	$(call opkg,$(TARGET_DIR)) install \
-+	$(call opkg,$(TARGET_DIR)) install --force-overwrite \
- 		$(call opkg_package_files,$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg))))
- 	@for file in $(PACKAGE_INSTALL_FILES); do \
- 		[ -s $$file.flags ] || continue; \

+ 0 - 25
devices/common/patches/ipvlan.patch

@@ -1,25 +0,0 @@
---- a/package/kernel/linux/modules/netdevices.mk
-+++ b/package/kernel/linux/modules/netdevices.mk
-@@ -885,6 +885,22 @@ endef
- $(eval $(call KernelPackage,macvlan))
- 
- 
-+define KernelPackage/ipvlan
-+  SUBMENU:=$(NETWORK_DEVICES_MENU)
-+  TITLE:=IP-VLAN support
-+  KCONFIG:=CONFIG_IPVLAN
-+  FILES:=$(LINUX_DIR)/drivers/net/ipvlan/ipvlan.ko
-+  AUTOLOAD:=$(call AutoProbe,ipvlan)
-+endef
-+
-+define KernelPackage/ipvlan/description
-+ A kernel module which allows one to create virtual interfaces that
-+ map packets to or from specific IP addresses to a particular interface
-+endef
-+
-+$(eval $(call KernelPackage,ipvlan))
-+
-+
- define KernelPackage/tulip
-   TITLE:=Tulip family network device support
-   DEPENDS:=@PCI_SUPPORT +kmod-mii

+ 1 - 12
devices/common/patches/min-ttl.patch

@@ -4,7 +4,7 @@
  		o.datatype = 'range(0,10000)';
  		o.placeholder = 150;
  
-+		o = s.taboption('advanced', form.Value, 'min_ttl',
++		o = s.taboption('advanced', form.Value, 'mini_ttl',
 +			_('Minimum TTL to send to clients'),
 +			_('Modify DNS entries minimum TTL (max is 86400, 0 is no modify)'));
 +		o.optional = true;
@@ -14,14 +14,3 @@
  		s.taboption('tftp', form.Flag, 'enable_tftp',
  			_('Enable TFTP server')).optional = true;
  
-
---- a/package/network/services/dnsmasq/files/dnsmasq.init
-+++ b/package/network/services/dnsmasq/files/dnsmasq.init
-@@ -875,6 +875,7 @@ dnsmasq_start()
- 
- 	append_parm "$cfg" logfacility "--log-facility"
- 
-+	append_parm "$cfg" min_ttl "--min-ttl"
- 	append_parm "$cfg" cachesize "--cache-size"
- 	append_parm "$cfg" dnsforwardmax "--dns-forward-max"
- 	append_parm "$cfg" port "--port"

+ 11 - 0
devices/common/patches/rule_MKHASH.patch

@@ -0,0 +1,11 @@
+--- a/rules.mk
++++ b/rules.mk
+@@ -266,6 +266,8 @@ TARGET_CXX:=$(TARGET_CROSS)g++
+ KPATCH:=$(SCRIPT_DIR)/patch-kernel.sh
+ SED:=$(STAGING_DIR_HOST)/bin/sed -i -e
+ ESED:=$(STAGING_DIR_HOST)/bin/sed -E -i -e
++MKHASH:=$(STAGING_DIR_HOST)/bin/mkhash
++export MKHASH
+ CP:=cp -fpR
+ LN:=ln -sf
+ XARGS:=xargs -r

+ 2 - 2
devices/common/patches/turboacc.patch

@@ -34,7 +34,7 @@
 -			start_dnsforwarder
 -		fi
 -		change_dns
--		nohup "/usr/share/dnscache/dnscache-while.sh" > "/var/log/dnscache.file" 2>&1 &
+-		/usr/share/dnscache/dnscache-while.sh > "/var/log/dnscache.file" 2>&1 &
 -	else
 -		stop_dnscache
 -		revert_dns
@@ -114,4 +114,4 @@
 -			dnscaching_state.innerHTML = status.dnscaching_state ? '<em><b><font color=green><%:RUNNING%></font></b></em>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
  		}
  	});
- //]]>
+ //]]>

+ 1 - 1
devices/common/settings.ini

@@ -2,7 +2,7 @@ REPO_URL="https://github.com/openwrt/openwrt"
 REPO_BRANCH="openwrt-21.02"
 CONFIG_FILE=".config"
 DIY_SH="diy.sh"
-FREE_UP_DISK="true"
+FREE_UP_DISK="false"
 UPLOAD_BIN_DIR_FOR_ARTIFACT="false"
 UPLOAD_FIRMWARE_FOR_ARTIFACT="true"
 UPLOAD_FIRMWARE_FOR_RELEASE="false"

+ 0 - 4
devices/nanopi-r2s/.config

@@ -20,10 +20,6 @@ CONFIG_PACKAGE_kmod-nf-ipvs=y
 CONFIG_PACKAGE_kmod-veth=y
 CONFIG_PACKAGE_kmod-dummy=y
 
-CONFIG_PACKAGE_luci-app-turboacc=y
-CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_flow-offload=y
-CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_shortcut-fe=n
-
 # 其他需要安装的软件包:
 CONFIG_PACKAGE_autocore=n
 CONFIG_PACKAGE_autocore-arm=y

+ 3 - 1
devices/nanopi-r2s/diy.sh

@@ -12,6 +12,8 @@ wget -O include/kernel-version.mk https://raw.githubusercontent.com/immortalwrt/
 rm -rf ./package/kernel/linux/modules/video.mk
 wget -P package/kernel/linux/modules/ https://github.com/immortalwrt/immortalwrt/raw/master/package/kernel/linux/modules/video.mk
 
+sed -i 's/5.4/5.10/g' target/linux/rockchip/Makefile
+
 sed -i 's,-mcpu=generic,-march=armv8-a+crypto+crc -mabi=lp64,g' include/target.mk
 
 sed -i "s,'eth1' 'eth0','eth0' 'eth1',g" target/linux/rockchip/armv8/base-files/etc/board.d/02_network
@@ -42,6 +44,6 @@ CONFIG_REALTEK_PHY=y
 CONFIG_CPU_FREQ_GOV_USERSPACE=y
 CONFIG_CPU_FREQ_GOV_ONDEMAND=y
 CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
-' >> ./target/linux/rockchip/armv8/config-5.4
+' >> ./target/linux/rockchip/armv8/config-5.10
 
 

+ 0 - 4
devices/nanopi-r4s/.config

@@ -20,10 +20,6 @@ CONFIG_PACKAGE_kmod-nf-ipvs=y
 CONFIG_PACKAGE_kmod-veth=y
 CONFIG_PACKAGE_kmod-dummy=y
 
-CONFIG_PACKAGE_luci-app-turboacc=y
-CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_flow-offload=y
-CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_shortcut-fe=n
-
 # 其他需要安装的软件包:
 CONFIG_PACKAGE_autocore=n
 CONFIG_PACKAGE_autocore-arm=y

+ 3 - 1
devices/nanopi-r4s/diy.sh

@@ -11,6 +11,8 @@ wget -O include/kernel-version.mk https://raw.githubusercontent.com/immortalwrt/
 rm -rf ./package/kernel/linux/modules/video.mk
 wget -P package/kernel/linux/modules/ https://github.com/immortalwrt/immortalwrt/raw/master/package/kernel/linux/modules/video.mk
 
+sed -i 's/5.4/5.10/g' target/linux/rockchip/Makefile
+
 sed -i 's,-mcpu=generic,-march=armv8-a+crypto+crc -mabi=lp64,g' include/target.mk
 sed -i 's,kmod-r8169,kmod-r8168,g' target/linux/rockchip/image/armv8.mk
 
@@ -40,6 +42,6 @@ CONFIG_CPU_FREQ_GOV_ONDEMAND=y
 CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
 CONFIG_CRYPTO_DEV_ROCKCHIP=y
 CONFIG_HW_RANDOM_ROCKCHIP=y
-' >> ./target/linux/rockchip/armv8/config-5.4
+' >> ./target/linux/rockchip/armv8/config-5.10
 
 

+ 0 - 4
devices/x86_64/.config

@@ -10,10 +10,6 @@ CONFIG_EFI_IMAGES=y
 CONFIG_VMDK_IMAGES=n
 CONFIG_TARGET_ROOTFS_TARGZ=n
 
-CONFIG_PACKAGE_luci-app-turboacc=y
-CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_flow-offload=n
-CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_shortcut-fe=y
-
 # 其他需要安装的软件包:
 CONFIG_PACKAGE_luci-proto-bonding=y
 CONFIG_PACKAGE_autocore-x86=y

+ 0 - 2
devices/x86_64/default-settings

@@ -1,7 +1,5 @@
 
 test $version -lt 2 && {
-	uci del turboacc.config.sw_flow
-	uci commit turboacc
 	uci set system.@system[0].zram_size_mb='100'
 	uci set system.@system[0].zram_comp_algo='lz4'
 	uci commit system

+ 3 - 1
devices/x86_64/diy.sh

@@ -1,8 +1,10 @@
 #!/bin/bash
 
+sed -i 's/5.4/5.10/g' target/linux/x86/Makefile
+
 echo '
 CONFIG_CRYPTO_CHACHA20_X86_64=y
 CONFIG_CRYPTO_POLY1305_X86_64=y
-' >> ./target/linux/x86/64/config-5.4
+' >> ./target/linux/x86/64/config-5.10
 
 sed -i "s/enabled '0'/enabled '1'/g" feeds/packages/utils/irqbalance/files/irqbalance.config

+ 7 - 6
onekey/compile.sh

@@ -82,17 +82,18 @@ case $CHOOSE in
 esac
 done
 
+
+
 git clone -b openwrt-21.02 --depth 1 https://github.com/openwrt/openwrt
 svn co https://github.com/garypang13/OpenWrt/trunk/devices openwrt/devices
 
-if [[ $firmware =~ (nanopi-r2s|nanopi-r4s) ]]; then
-		cd openwrt
-		wget -cO sdk.tar.xz https://mirrors.cloud.tencent.com/openwrt/releases/21.02-SNAPSHOT/targets/rockchip/armv8/openwrt-sdk-21.02-SNAPSHOT-rockchip-armv8_gcc-8.4.0_musl.Linux-x86_64.tar.xz
-elif [[ $firmware == "x86_64" ]]; then
-		cd openwrt
+cd openwrt
+
+if [[ $firmware == "x86_64" ]]; then
 		wget -cO sdk.tar.xz https://mirrors.cloud.tencent.com/openwrt/releases/21.02-SNAPSHOT/targets/x86/64/openwrt-sdk-21.02-SNAPSHOT-x86-64_gcc-8.4.0_musl.Linux-x86_64.tar.xz
+elif [[ $firmware =~ (nanopi-r2s|nanopi-r4s) ]]; then
+		wget -cO sdk.tar.xz https://mirrors.cloud.tencent.com/openwrt/releases/21.02-SNAPSHOT/targets/rockchip/armv8/openwrt-sdk-21.02-SNAPSHOT-rockchip-armv8_gcc-8.4.0_musl.Linux-x86_64.tar.xz
 elif [[ $firmware == "Rpi-4B" ]]; then
-		cd openwrt
 		wget -cO sdk.tar.xz https://mirrors.cloud.tencent.com/openwrt/releases/21.02-SNAPSHOT/targets/bcm27xx/bcm2711/openwrt-sdk-21.02-SNAPSHOT-bcm27xx-bcm2711_gcc-8.4.0_musl.Linux-x86_64.tar.xz
 fi