Merge Mainline

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2021-10-27 12:18:41 +08:00
commit f4effdee24
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
59 changed files with 754 additions and 1644 deletions

View File

@ -194,20 +194,6 @@ menu "Global build settings"
make the system libraries incompatible with most of the packages that are
not selected during the build process.
choice
prompt "Preferred standard C++ library"
default USE_LIBSTDCXX if USE_GLIBC
default USE_UCLIBCXX
help
Select the preferred standard C++ library for all packages that support this.
config USE_UCLIBCXX
bool "uClibc++"
config USE_LIBSTDCXX
bool "libstdc++"
endchoice
comment "Hardening build options"
config PKG_CHECK_FORMAT_SECURITY

View File

@ -18,6 +18,7 @@ endif
CMAKE_BINARY_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR))
CMAKE_SOURCE_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR))
HOST_CMAKE_SOURCE_DIR = $(HOST_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR))
HOST_CMAKE_BINARY_DIR = $(HOST_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR))
MAKE_PATH = $(firstword $(CMAKE_BINARY_SUBDIR) .)
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
@ -56,15 +57,15 @@ ifeq ($(HOST_USE_NINJA),1)
CMAKE_HOST_OPTIONS += -DCMAKE_GENERATOR="Ninja"
define Host/Compile/Default
+$(NINJA) -C $(HOST_BUILD_DIR) $(1)
+$(NINJA) -C $(HOST_CMAKE_BINARY_DIR) $(1)
endef
define Host/Install/Default
+$(NINJA) -C $(HOST_BUILD_DIR) install
+$(NINJA) -C $(HOST_CMAKE_BINARY_DIR) install
endef
define Host/Uninstall/Default
+$(NINJA) -C $(HOST_BUILD_DIR) uninstall
+$(NINJA) -C $(HOST_CMAKE_BINARY_DIR) uninstall
endef
endif
@ -133,7 +134,8 @@ endef
Build/InstallDev = $(if $(CMAKE_INSTALL),$(Build/InstallDev/cmake))
define Host/Configure/Default
(cd $(HOST_BUILD_DIR); \
mkdir -p "$(HOST_CMAKE_BINARY_DIR)"
(cd $(HOST_CMAKE_BINARY_DIR); \
CFLAGS="$(HOST_CFLAGS)" \
CXXFLAGS="$(HOST_CFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \

View File

@ -56,7 +56,7 @@ MESON_CPU:="$(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))"
endif
define Meson
$(2) $(STAGING_DIR_HOST)/bin/meson $(1)
$(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(STAGING_DIR_HOST)/bin/meson $(1)
endef
define Meson/CreateNativeFile

View File

@ -1,16 +1,2 @@
ifndef DUMP
ifdef __package_mk
$(error uclibc++.mk must be included before package.mk)
endif
endif
PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX
CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBSTDCXX:libstdcpp
ifneq ($(CONFIG_USE_UCLIBCXX),)
ifneq ($(CONFIG_CCACHE),)
TARGET_CXX_NOCACHE=g++-uc
else
TARGET_CXX=g++-uc
endif
endif
$(warn uclibc++.mk is deprecated. Please remove it and CXX_DEPENDS)
CXX_DEPENDS = +libstdcpp

View File

@ -148,37 +148,38 @@ define Package/base-files/install
$(VERSION_SED_SCRIPT) \
$(1)/etc/banner \
$(1)/etc/device_info \
$(1)/etc/openwrt_release \
$(1)/etc/openwrt_version \
$(1)/usr/lib/os-release
$(VERSION_SED_SCRIPT) \
$(1)/etc/openwrt_release \
$(1)/etc/device_info \
$(1)/usr/lib/os-release
$(SED) "s#%PATH%#$(TARGET_INIT_PATH)#g" \
$(1)/sbin/hotplug-call \
$(1)/etc/preinit \
$(1)/etc/profile
mkdir -p $(1)/CONTROL
mkdir -p $(1)/dev
mkdir -p $(1)/etc/config
mkdir -p $(1)/etc/crontabs
mkdir -p $(1)/etc/rc.d
mkdir -p $(1)/overlay
mkdir -p $(1)/lib/firmware
$(if $(LIB_SUFFIX),-$(LN) lib $(1)/lib$(LIB_SUFFIX))
mkdir -p $(1)/mnt
mkdir -p $(1)/proc
mkdir -p $(1)/tmp
mkdir -p $(1)/usr/lib
$(if $(LIB_SUFFIX),-$(LN) lib $(1)/usr/lib$(LIB_SUFFIX))
mkdir -p $(1)/usr/bin
mkdir -p $(1)/sys
mkdir -p $(1)/www
mkdir -p $(1)/root
mkdir -p \
$(1)/CONTROL \
$(1)/dev \
$(1)/etc/config \
$(1)/etc/crontabs \
$(1)/etc/rc.d \
$(1)/overlay \
$(1)/lib/firmware \
$(1)/mnt \
$(1)/proc \
$(1)/tmp \
$(1)/usr/lib \
$(1)/usr/bin \
$(1)/sys \
$(1)/www \
$(1)/root
$(LN) /proc/mounts $(1)/etc/mtab
$(if $(LIB_SUFFIX),-$(LN) lib $(1)/lib$(LIB_SUFFIX))
$(if $(LIB_SUFFIX),-$(LN) lib $(1)/usr/lib$(LIB_SUFFIX))
ifneq ($(CONFIG_TARGET_ROOTFS_PERSIST_VAR),y)
rm -f $(1)/var
$(LN) tmp $(1)/var
@ -186,7 +187,6 @@ else
mkdir -p $(1)/var
$(LN) /tmp/run $(1)/var/run
endif
mkdir -p $(1)/etc
$(LN) /tmp/resolv.conf /tmp/TZ /tmp/localtime $(1)/etc/
chmod 0600 $(1)/etc/shadow

View File

@ -21,9 +21,10 @@ boot() {
[ -f /proc/mounts ] || /sbin/mount_root
[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
mkdir -p /var/run
mkdir -p /var/log
mkdir -p /var/lock
chmod 1777 /var/lock
mkdir -p /var/log
mkdir -p /var/run
mkdir -p /var/state
mkdir -p /var/tmp
mkdir -p /tmp/.uci

View File

@ -201,7 +201,7 @@
+};
--- /dev/null
+++ b/configs/nanopi_r1s_h5_defconfig
@@ -0,0 +1,13 @@
@@ -0,0 +1,14 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_SPL=y
@ -209,9 +209,10 @@
+CONFIG_DRAM_CLK=672
+CONFIG_DRAM_ZQ=3881977
+# CONFIG_DRAM_ODT_EN is not set
+CONFIG_MACPWR="PD6"
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-nanopi-r1s-h5"
+CONFIG_SUN8I_EMAC=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_OHCI_HCD=y

View File

@ -1,12 +1,7 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2020 Lean <coolsnowwolf@gmail.com>
#
# Copyright (C) 2021 ImmortalWrt
# <https://immortalwrt.org>
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
@ -17,56 +12,50 @@ PKG_RELEASE:=$(COMMITCOUNT)
include $(INCLUDE_DIR)/package.mk
define Package/autocore-arm
TITLE:=Arm auto core loadbalance script.
TITLE:=Arm auto core loadbalance script
MAINTAINER:=CN_SZTL
DEPENDS:=@(arm||aarch64) \
+TARGET_bcm27xx:bcm27xx-userland \
+TARGET_bcm53xx:nvram
+TARGET_bcm53xx:nvram \
+ethtool
VARIANT:=arm
endef
define Package/autocore-x86
TITLE:=x86/x64 auto core loadbalance script.
TITLE:=x86/x64 auto core loadbalance script
MAINTAINER:=Lean
DEPENDS:=@TARGET_x86 +bc +lm-sensors +ethtool
DEPENDS:=@TARGET_x86 +lm-sensors +ethtool
VARIANT:=x86
endef
define Package/autocore-arm/description
A luci autoconfig hotplug script.
endef
define Package/autocore-x86/description
A usb autoconfig hotplug script.
endef
define Build/Compile
true
endef
define Package/autocore/install/Default
$(INSTALL_DIR) $(1)/etc
$(CP) ./files/generic/index.htm $(1)/etc/
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/generic/090-cover-index_htm $(1)/etc/uci-defaults/
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) ./files/generic/cpuinfo $(1)/sbin/
$(INSTALL_BIN) ./files/generic/ethinfo $(1)/sbin/
endef
define Package/autocore-arm/install
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DATA) ./files/arm/index.htm $(1)/etc/index.htm
$(call Package/autocore/install/Default,$(1))
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/arm/090-cover-index_htm $(1)/etc/uci-defaults/090-cover-index_htm
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) ./files/arm/sbin/cpuinfo $(1)/sbin/cpuinfo
ifneq (, $(findstring $(BOARD), ipq40xx ipq806x))
$(INSTALL_BIN) ./files/arm/sbin/tempinfo $(1)/sbin/tempinfo
$(INSTALL_BIN) ./files/arm/tempinfo $(1)/sbin/
endif
endef
define Package/autocore-x86/install
$(call Package/autocore/install/Default,$(1))
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/autocore
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DATA) ./files/x86/index.htm $(1)/etc/index.htm
$(INSTALL_DIR) $(1)/sbin
$(CP) ./files/x86/sbin/* $(1)/sbin
$(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/
endef
$(eval $(call BuildPackage,autocore-arm))

View File

@ -1,819 +0,0 @@
<%#
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
Licensed to the public under the Apache License 2.0.
-%>
<%
local fs = require "nixio.fs"
local util = require "luci.util"
local stat = require "luci.tools.status"
local ver = require "luci.version"
local has_ipv6 = fs.access("/usr/sbin/ip6tables")
local has_dhcp = fs.access("/etc/config/dhcp")
local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0)
local has_temp = fs.access("/sbin/tempinfo")
local sysinfo = luci.util.ubus("system", "info") or { }
local boardinfo = luci.util.ubus("system", "board") or { }
local unameinfo = nixio.uname() or { }
local meminfo = sysinfo.memory or {
total = 0,
free = 0,
buffered = 0,
shared = 0
}
local mem_cached = luci.sys.exec("sed -e '/^Cached: /!d; s#Cached: *##; s# kB##g' /proc/meminfo")
local swapinfo = sysinfo.swap or {
total = 0,
free = 0
}
local has_dsl = fs.access("/etc/init.d/dsl_control")
if luci.http.formvalue("status") == "1" then
local ntm = require "luci.model.network".init()
local wan = ntm:get_wannet()
local wan6 = ntm:get_wan6net()
local conn_count = tonumber(
fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0
local conn_max = tonumber(luci.sys.exec(
"sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max"
):match("%d+")) or 4096
local user_info = luci.sys.exec("cat /proc/net/arp | grep 'br-lan' | grep '0x2' | wc -l")
local cpu_usage = luci.sys.exec("top -n1 | awk '/^CPU/ {printf(\"%d%\", 100 - $8)}'") or "6%"
local cpu_info = luci.sys.exec("/sbin/cpuinfo") or "ARM Processor"
local rv = {
cpuinfo = cpu_info,
cpuusage = cpu_usage,
userinfo = user_info,
uptime = sysinfo.uptime or 0,
localtime = os.date(),
loadavg = sysinfo.load or { 0, 0, 0 },
memory = meminfo,
memcached = mem_cached,
swap = swapinfo,
connmax = conn_max,
conncount = conn_count,
leases = stat.dhcp_leases(),
leases6 = stat.dhcp6_leases(),
wifinets = stat.wifi_networks()
}
if wan then
rv.wan = {
ipaddr = wan:ipaddr(),
gwaddr = wan:gwaddr(),
netmask = wan:netmask(),
dns = wan:dnsaddrs(),
expires = wan:expires(),
uptime = wan:uptime(),
proto = wan:proto(),
ifname = wan:ifname(),
link = wan:adminlink()
}
end
if wan6 then
rv.wan6 = {
ip6addr = wan6:ip6addr(),
gw6addr = wan6:gw6addr(),
dns = wan6:dns6addrs(),
ip6prefix = wan6:ip6prefix(),
uptime = wan6:uptime(),
proto = wan6:proto(),
ifname = wan6:ifname(),
link = wan6:adminlink()
}
end
if has_dsl then
local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat")
local dsl_func = loadstring(dsl_stat)
if dsl_func then
rv.dsl = dsl_func()
end
end
luci.http.prepare_content("application/json")
luci.http.write_json(rv)
return
elseif luci.http.formvalue("hosts") == "1" then
luci.http.prepare_content("application/json")
luci.http.write_json(luci.sys.net.host_hints())
return
end
-%>
<%+header%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
function progressbar(v, m)
{
var vn = parseInt(v) || 0;
var mn = parseInt(m) || 100;
var pc = Math.floor((100 / mn) * vn);
return String.format(
'<div style="width:200px; position:relative; border:1px solid #999999">' +
'<div style="background-color:#CCCCCC; width:%d%%; height:15px">' +
'<div style="position:absolute; left:0; top:0; text-align:center; width:100%%; color:#000000">' +
'<small>%s / %s (%d%%)</small>' +
'</div>' +
'</div>' +
'</div>', pc, v, m, pc
);
}
function wifirate(bss, rx) {
var p = rx ? 'rx_' : 'tx_',
s = '%.1f <%:Mbit/s%>, %d<%:MHz%>'
.format(bss[p+'rate'] / 1000, bss[p+'mhz']),
ht = bss[p+'ht'], vht = bss[p+'vht'],
mhz = bss[p+'mhz'], nss = bss[p+'nss'],
mcs = bss[p+'mcs'], sgi = bss[p+'short_gi'];
if (ht || vht) {
if (vht) s += ', VHT-MCS %d'.format(mcs);
if (nss) s += ', VHT-NSS %d'.format(nss);
if (ht) s += ', MCS %s'.format(mcs);
if (sgi) s += ', <%:Short GI%>';
}
return s;
}
function duid2mac(duid) {
// DUID-LLT / Ethernet
if (duid.length === 28 && duid.substr(0, 8) === '00010001')
return duid.substr(16).replace(/(..)(?=..)/g, '$1:').toUpperCase();
// DUID-LL / Ethernet
if (duid.length === 20 && duid.substr(0, 8) === '00030001')
return duid.substr(8).replace(/(..)(?=..)/g, '$1:').toUpperCase();
return null;
}
var npoll = 1;
var hosts = <%=luci.http.write_json(luci.sys.net.host_hints())%>;
function updateHosts() {
XHR.get('<%=REQUEST_URI%>', { hosts: 1 }, function(x, data) {
hosts = data;
});
}
XHR.poll(5, '<%=REQUEST_URI%>', { status: 1 },
function(x, info)
{
if (!(npoll++ % 5))
updateHosts();
var si = document.getElementById('wan4_i');
var ss = document.getElementById('wan4_s');
var ifc = info.wan;
if (ifc && ifc.ifname && ifc.proto != 'none')
{
var s = String.format(
'<strong><%:Type%>: </strong>%s<br />' +
'<strong><%:Address%>: </strong>%s<br />' +
'<strong><%:Netmask%>: </strong>%s<br />' +
'<strong><%:Gateway%>: </strong>%s<br />',
ifc.proto,
(ifc.ipaddr) ? ifc.ipaddr : '0.0.0.0',
(ifc.netmask && ifc.netmask != ifc.ipaddr) ? ifc.netmask : '255.255.255.255',
(ifc.gwaddr) ? ifc.gwaddr : '0.0.0.0'
);
for (var i = 0; i < ifc.dns.length; i++)
{
s += String.format(
'<strong><%:DNS%> %d: </strong>%s<br />',
i + 1, ifc.dns[i]
);
}
if (ifc.expires > -1)
{
s += String.format(
'<strong><%:Expires%>: </strong>%t<br />',
ifc.expires
);
}
if (ifc.uptime > 0)
{
s += String.format(
'<strong><%:Connected%>: </strong>%t<br />',
ifc.uptime
);
}
ss.innerHTML = String.format('<small>%s</small>', s);
si.innerHTML = String.format(
'<img src="<%=resource%>/icons/ethernet.png" />' +
'<br /><small><a href="%s">%s</a></small>',
ifc.link, ifc.ifname
);
}
else
{
si.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
ss.innerHTML = '<em><%:Not connected%></em>';
}
<% if has_ipv6 then %>
var si6 = document.getElementById('wan6_i');
var ss6 = document.getElementById('wan6_s');
var ifc6 = info.wan6;
if (ifc6 && ifc6.ifname && ifc6.proto != 'none')
{
var s = String.format(
'<strong><%:Type%>: </strong>%s%s<br />',
ifc6.proto, (ifc6.ip6prefix) ? '-pd' : ''
);
if (!ifc6.ip6prefix)
{
s += String.format(
'<strong><%:Address%>: </strong>%s<br />',
(ifc6.ip6addr) ? ifc6.ip6addr : '::'
);
}
else
{
s += String.format(
'<strong><%:Prefix Delegated%>: </strong>%s<br />',
ifc6.ip6prefix
);
if (ifc6.ip6addr)
{
s += String.format(
'<strong><%:Address%>: </strong>%s<br />',
ifc6.ip6addr
);
}
}
s += String.format(
'<strong><%:Gateway%>: </strong>%s<br />',
(ifc6.gw6addr) ? ifc6.gw6addr : '::'
);
for (var i = 0; i < ifc6.dns.length; i++)
{
s += String.format(
'<strong><%:DNS%> %d: </strong>%s<br />',
i + 1, ifc6.dns[i]
);
}
if (ifc6.uptime > 0)
{
s += String.format(
'<strong><%:Connected%>: </strong>%t<br />',
ifc6.uptime
);
}
ss6.innerHTML = String.format('<small>%s</small>', s);
si6.innerHTML = String.format(
'<img src="<%=resource%>/icons/ethernet.png" />' +
'<br /><small><a href="%s">%s</a></small>',
ifc6.link, ifc6.ifname
);
}
else
{
si6.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
ss6.innerHTML = '<em><%:Not connected%></em>';
}
<% end %>
<% if has_dsl then %>
var dsl_i = document.getElementById('dsl_i');
var dsl_s = document.getElementById('dsl_s');
var s = String.format(
'<strong><%:Status%>: </strong>%s<br />' +
'<strong><%:Line State%>: </strong>%s [0x%x]<br />' +
'<strong><%:Line Mode%>: </strong>%s<br />' +
'<strong><%:Annex%>: </strong>%s<br />' +
'<strong><%:Profile%>: </strong>%s<br />' +
'<strong><%:Data Rate%>: </strong>%s/s / %s/s<br />' +
'<strong><%:Max. Attainable Data Rate (ATTNDR)%>: </strong>%s/s / %s/s<br />' +
'<strong><%:Latency%>: </strong>%s / %s<br />' +
'<strong><%:Line Attenuation (LATN)%>: </strong>%s dB / %s dB<br />' +
'<strong><%:Signal Attenuation (SATN)%>: </strong>%s dB / %s dB<br />' +
'<strong><%:Noise Margin (SNR)%>: </strong>%s dB / %s dB<br />' +
'<strong><%:Aggregate Transmit Power(ACTATP)%>: </strong>%s dB / %s dB<br />' +
'<strong><%:Forward Error Correction Seconds (FECS)%>: </strong>%s / %s<br />' +
'<strong><%:Errored seconds (ES)%>: </strong>%s / %s<br />' +
'<strong><%:Severely Errored Seconds (SES)%>: </strong>%s / %s<br />' +
'<strong><%:Loss of Signal Seconds (LOSS)%>: </strong>%s / %s<br />' +
'<strong><%:Unavailable Seconds (UAS)%>: </strong>%s / %s<br />' +
'<strong><%:Header Error Code Errors (HEC)%>: </strong>%s / %s<br />' +
'<strong><%:Non Pre-emtive CRC errors (CRC_P)%>: </strong>%s / %s<br />' +
'<strong><%:Pre-emtive CRC errors (CRCP_P)%>: </strong>%s / %s<br />' +
'<strong><%:Line Uptime%>: </strong>%s<br />' +
'<strong><%:ATU-C System Vendor ID%>: </strong>%s<br />' +
'<strong><%:Power Management Mode%>: </strong>%s<br />',
info.dsl.line_state, info.dsl.line_state_detail,
info.dsl.line_state_num,
info.dsl.line_mode_s,
info.dsl.annex_s,
info.dsl.profile_s,
info.dsl.data_rate_down_s, info.dsl.data_rate_up_s,
info.dsl.max_data_rate_down_s, info.dsl.max_data_rate_up_s,
info.dsl.latency_num_down, info.dsl.latency_num_up,
info.dsl.line_attenuation_down, info.dsl.line_attenuation_up,
info.dsl.signal_attenuation_down, info.dsl.signal_attenuation_up,
info.dsl.noise_margin_down, info.dsl.noise_margin_up,
info.dsl.actatp_down, info.dsl.actatp_up,
info.dsl.errors_fec_near, info.dsl.errors_fec_far,
info.dsl.errors_es_near, info.dsl.errors_es_far,
info.dsl.errors_ses_near, info.dsl.errors_ses_far,
info.dsl.errors_loss_near, info.dsl.errors_loss_far,
info.dsl.errors_uas_near, info.dsl.errors_uas_far,
info.dsl.errors_hec_near, info.dsl.errors_hec_far,
info.dsl.errors_crc_p_near, info.dsl.errors_crc_p_far,
info.dsl.errors_crcp_p_near, info.dsl.errors_crcp_p_far,
info.dsl.line_uptime_s,
info.dsl.atuc_vendor_id,
info.dsl.power_mode_s
);
dsl_s.innerHTML = String.format('<small>%s</small>', s);
dsl_i.innerHTML = String.format(
'<img src="<%=resource%>/icons/ethernet.png" />' +
'<br /><small>DSL</small>'
);
<% end %>
<% if has_dhcp then %>
var ls = document.getElementById('lease_status_table');
if (ls)
{
/* clear all rows */
while( ls.rows.length > 1 )
ls.rows[0].parentNode.deleteRow(1);
for( var i = 0; i < info.leases.length; i++ )
{
var timestr;
if (info.leases[i].expires === false)
timestr = '<em><%:unlimited%></em>';
else if (info.leases[i].expires <= 0)
timestr = '<em><%:expired%></em>';
else
timestr = String.format('%t', info.leases[i].expires);
var tr = ls.rows[0].parentNode.insertRow(-1);
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
tr.insertCell(-1).innerHTML = info.leases[i].hostname ? info.leases[i].hostname : '?';
tr.insertCell(-1).innerHTML = info.leases[i].ipaddr;
tr.insertCell(-1).innerHTML = info.leases[i].macaddr;
tr.insertCell(-1).innerHTML = timestr;
}
if( ls.rows.length == 1 )
{
var tr = ls.rows[0].parentNode.insertRow(-1);
tr.className = 'cbi-section-table-row';
var td = tr.insertCell(-1);
td.colSpan = 4;
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
}
}
var ls6 = document.getElementById('lease6_status_table');
if (ls6 && info.leases6)
{
ls6.parentNode.style.display = 'block';
/* clear all rows */
while( ls6.rows.length > 1 )
ls6.rows[0].parentNode.deleteRow(1);
for( var i = 0; i < info.leases6.length; i++ )
{
var timestr;
if (info.leases6[i].expires === false)
timestr = '<em><%:unlimited%></em>';
else if (info.leases6[i].expires <= 0)
timestr = '<em><%:expired%></em>';
else
timestr = String.format('%t', info.leases6[i].expires);
var tr = ls6.rows[0].parentNode.insertRow(-1);
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
var host = hosts[duid2mac(info.leases6[i].duid)];
if (!info.leases6[i].hostname)
tr.insertCell(-1).innerHTML =
(host && (host.name || host.ipv4 || host.ipv6))
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">? (%h)</div>'.format(host.name || host.ipv4 || host.ipv6)
: '?';
else
tr.insertCell(-1).innerHTML =
(host && host.name && info.leases6[i].hostname != host.name)
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">%h (%h)</div>'.format(info.leases6[i].hostname, host.name)
: info.leases6[i].hostname;
tr.insertCell(-1).innerHTML = info.leases6[i].ip6addr;
tr.insertCell(-1).innerHTML = info.leases6[i].duid;
tr.insertCell(-1).innerHTML = timestr;
}
if( ls6.rows.length == 1 )
{
var tr = ls6.rows[0].parentNode.insertRow(-1);
tr.className = 'cbi-section-table-row';
var td = tr.insertCell(-1);
td.colSpan = 4;
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
}
}
<% end %>
<% if has_wifi then %>
var assoclist = [ ];
var ws = document.getElementById('wifi_status_table');
if (ws)
{
var wsbody = ws.rows[0].parentNode;
while (ws.rows.length > 0)
wsbody.deleteRow(0);
for (var didx = 0; didx < info.wifinets.length; didx++)
{
var dev = info.wifinets[didx];
var tr = wsbody.insertRow(-1);
var td;
td = tr.insertCell(-1);
td.width = "33%";
td.innerHTML = dev.name;
td.style.verticalAlign = "top";
td = tr.insertCell(-1);
var s = '';
for (var nidx = 0; nidx < dev.networks.length; nidx++)
{
var net = dev.networks[nidx];
var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel && !net.disabled);
var icon;
if (!is_assoc)
icon = "<%=resource%>/icons/signal-none.png";
else if (net.quality == 0)
icon = "<%=resource%>/icons/signal-0.png";
else if (net.quality < 25)
icon = "<%=resource%>/icons/signal-0-25.png";
else if (net.quality < 50)
icon = "<%=resource%>/icons/signal-25-50.png";
else if (net.quality < 75)
icon = "<%=resource%>/icons/signal-50-75.png";
else
icon = "<%=resource%>/icons/signal-75-100.png";
s += String.format(
'<table><tr><td style="text-align:center; width:32px; padding:3px">' +
'<img src="%s" title="<%:Signal%>: %d dBm / <%:Noise%>: %d dBm" />' +
'<br /><small>%d%%</small>' +
'</td><td style="text-align:left; padding:3px"><small>' +
'<strong><%:SSID%>:</strong> <a href="%s">%h</a><br />' +
'<strong><%:Mode%>:</strong> %s<br />' +
'<strong><%:Channel%>:</strong> %d (%.3f <%:GHz%>)<br />' +
'<strong><%:Bitrate%>:</strong> %s <%:Mbit/s%><br />',
icon, net.signal, net.noise,
net.quality,
net.link, net.ssid || '?',
net.mode,
net.channel, net.frequency,
net.bitrate || '?'
);
if (is_assoc)
{
s += String.format(
'<strong><%:BSSID%>:</strong> %s<br />' +
'<strong><%:Encryption%>:</strong> %s',
net.bssid || '?',
net.encryption
);
}
else
{
s += '<em><%:Wireless is disabled or not associated%></em>';
}
s += '</small></td></tr></table>';
for (var bssid in net.assoclist)
{
var bss = net.assoclist[bssid];
bss.bssid = bssid;
bss.link = net.link;
bss.name = net.name;
bss.ifname = net.ifname;
bss.radio = dev.name;
assoclist.push(bss);
}
}
if (!s)
s = '<em><%:No information available%></em>';
td.innerHTML = s;
}
}
var ac = document.getElementById('wifi_assoc_table');
if (ac)
{
/* clear all rows */
while( ac.rows.length > 1 )
ac.rows[0].parentNode.deleteRow(1);
assoclist.sort(function(a, b) {
return (a.name == b.name)
? (a.bssid < b.bssid)
: (a.name > b.name )
;
});
for( var i = 0; i < assoclist.length; i++ )
{
var tr = ac.rows[0].parentNode.insertRow(-1);
tr.className = 'cbi-section-table-row cbi-rowstyle-' + (1 + (i % 2));
var icon;
var q = (-1 * (assoclist[i].noise - assoclist[i].signal)) / 5;
if (q < 1)
icon = "<%=resource%>/icons/signal-0.png";
else if (q < 2)
icon = "<%=resource%>/icons/signal-0-25.png";
else if (q < 3)
icon = "<%=resource%>/icons/signal-25-50.png";
else if (q < 4)
icon = "<%=resource%>/icons/signal-50-75.png";
else
icon = "<%=resource%>/icons/signal-75-100.png";
tr.insertCell(-1).innerHTML = String.format(
'<span class="ifacebadge" title="%q"><img src="<%=resource%>/icons/wifi.png" /> %h</span>',
assoclist[i].radio, assoclist[i].ifname
);
tr.insertCell(-1).innerHTML = String.format(
'<a href="%s">%s</a>',
assoclist[i].link,
'%h'.format(assoclist[i].name).nobr()
);
tr.insertCell(-1).innerHTML = assoclist[i].bssid;
var host = hosts[assoclist[i].bssid];
if (host)
tr.insertCell(-1).innerHTML = String.format(
'<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis">%s</div>',
((host.name && (host.ipv4 || host.ipv6))
? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6)
: '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr()
);
else
tr.insertCell(-1).innerHTML = '?';
tr.insertCell(-1).innerHTML = String.format(
'<span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%> / <%:SNR%>: %d"><img src="%s" /> %d / %d <%:dBm%></span>',
assoclist[i].signal, assoclist[i].noise, assoclist[i].signal - assoclist[i].noise,
icon,
assoclist[i].signal, assoclist[i].noise
);
tr.insertCell(-1).innerHTML = wifirate(assoclist[i], true).nobr() + '<br />' + wifirate(assoclist[i], false).nobr();
}
if (ac.rows.length == 1)
{
var tr = ac.rows[0].parentNode.insertRow(-1);
tr.className = 'cbi-section-table-row';
var td = tr.insertCell(-1);
td.colSpan = 7;
td.innerHTML = '<br /><em><%:No information available%></em>';
}
}
<% end %>
var e;
if (e = document.getElementById('localtime'))
e.innerHTML = info.localtime;
if (e = document.getElementById('uptime'))
e.innerHTML = String.format('%t', info.uptime);
if (e = document.getElementById('userinfo'))
e.innerHTML = info.userinfo;
if (e = document.getElementById('cpuusage'))
e.innerHTML = info.cpuusage;
if (e = document.getElementById('cpuinfo'))
e.innerHTML = info.cpuinfo;
if (e = document.getElementById('loadavg'))
e.innerHTML = String.format(
'%.02f, %.02f, %.02f',
info.loadavg[0] / 65535.0,
info.loadavg[1] / 65535.0,
info.loadavg[2] / 65535.0
);
if (e = document.getElementById('memtotal'))
e.innerHTML = progressbar(
Math.floor(((info.memory.free + info.memory.buffered) / 1048576) + (info.memcached / 1024)) + " <%:MB%>",
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
);
if (e = document.getElementById('membuff'))
e.innerHTML = progressbar(
Math.floor(info.memory.buffered / 1048576) + " <%:MB%>",
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
);
if (e = document.getElementById('swaptotal'))
e.innerHTML = progressbar(
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
);
if (e = document.getElementById('swapfree'))
e.innerHTML = progressbar(
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
);
if (e = document.getElementById('conns'))
e.innerHTML = progressbar(info.conncount, info.connmax);
}
);
//]]></script>
<h2 name="content"><%:Status%></h2>
<fieldset class="cbi-section">
<legend><%:System%></legend>
<table width="100%" cellspacing="10">
<tr><td width="33%"><%:Hostname%></td><td><%=luci.sys.hostname() or "?"%></td></tr>
<tr><td width="33%"><%:Model%></td><td><%=pcdata(boardinfo.model or "?")%> <%=luci.sys.exec("cat /etc/bench.log") or ""%></td></tr>
<tr><td width="33%"><%:Architecture%></td><td id="cpuinfo">-</td></tr>
<% if has_temp then %>
<tr><td width="33%"><%:Temperature%></td><td><%=luci.sys.exec("/sbin/tempinfo") or "?"%></td></tr>
<% end %>
<tr><td width="33%"><%:Firmware Version%></td><td>
<%=pcdata(ver.distname)%> <%=pcdata(ver.distversion)%> /
<%=pcdata(ver.luciname)%> (<%=pcdata(ver.luciversion)%>)
</td></tr>
<tr><td width="33%"><%:Kernel Version%></td><td><%=unameinfo.release or "?"%></td></tr>
<tr><td width="33%"><%:Local Time%></td><td id="localtime">-</td></tr>
<tr><td width="33%"><%:Uptime%></td><td id="uptime">-</td></tr>
<tr><td width="33%"><%:Load Average%></td><td id="loadavg">-</td></tr>
<tr><td width="33%"><%:CPU usage (%)%></td><td id="cpuusage">-</td></tr>
</table>
</fieldset>
<fieldset class="cbi-section">
<legend><%:Memory%></legend>
<table width="100%" cellspacing="10">
<tr><td width="33%"><%:Total Available%></td><td id="memtotal">-</td></tr>
<tr><td width="33%"><%:Buffered%></td><td id="membuff">-</td></tr>
</table>
</fieldset>
<% if swapinfo.total > 0 then %>
<fieldset class="cbi-section">
<legend><%:Swap%></legend>
<table width="100%" cellspacing="10">
<tr><td width="33%"><%:Total Available%></td><td id="swaptotal">-</td></tr>
<tr><td width="33%"><%:Free%></td><td id="swapfree">-</td></tr>
</table>
</fieldset>
<% end %>
<fieldset class="cbi-section">
<legend><%:Network%></legend>
<table width="100%" cellspacing="10">
<tr><td width="33%" style="vertical-align:top"><%:IPv4 WAN Status%></td><td>
<table><tr>
<td id="wan4_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
<td id="wan4_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
</tr></table>
</td></tr>
<% if has_ipv6 then %>
<tr><td width="33%" style="vertical-align:top"><%:IPv6 WAN Status%></td><td>
<table><tr>
<td id="wan6_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
<td id="wan6_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
</tr></table>
</td></tr>
<% end %>
<tr><td width="33%"><%:Online Users%></td><td id="userinfo">0</td></tr>
<tr><td width="33%"><%:Active Connections%></td><td id="conns">-</td></tr>
</table>
</fieldset>
<% if has_dhcp then %>
<fieldset class="cbi-section">
<legend><%:DHCP Leases%></legend>
<table class="cbi-section-table" id="lease_status_table">
<tr class="cbi-section-table-titles">
<th class="cbi-section-table-cell"><%:Hostname%></th>
<th class="cbi-section-table-cell"><%:IPv4-Address%></th>
<th class="cbi-section-table-cell"><%:MAC-Address%></th>
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
</tr>
<tr class="cbi-section-table-row">
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
</tr>
</table>
</fieldset>
<% if has_ipv6 then %>
<fieldset class="cbi-section" style="display:none">
<legend><%:DHCPv6 Leases%></legend>
<table class="cbi-section-table" id="lease6_status_table">
<tr class="cbi-section-table-titles">
<th class="cbi-section-table-cell"><%:Host%></th>
<th class="cbi-section-table-cell"><%:IPv6-Address%></th>
<th class="cbi-section-table-cell"><%:DUID%></th>
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
</tr>
<tr class="cbi-section-table-row">
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
</tr>
</table>
</fieldset>
<% end %>
<% end %>
<% if has_dsl then %>
<fieldset class="cbi-section">
<legend><%:DSL%></legend>
<table width="100%" cellspacing="10">
<tr><td width="33%" style="vertical-align:top"><%:DSL Status%></td><td>
<table><tr>
<td id="dsl_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
<td id="dsl_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
</tr></table>
</td></tr>
</table>
</fieldset>
<% end %>
<% if has_wifi then %>
<fieldset class="cbi-section">
<legend><%:Wireless%></legend>
<table id="wifi_status_table" width="100%" cellspacing="10">
<tr><td><em><%:Collecting data...%></em></td></tr>
</table>
</fieldset>
<% end %>
<%+footer%>

View File

@ -1,9 +1,14 @@
#!/bin/sh
mt76_path="/sys/kernel/debug/ieee80211/phy0/mt76/temperature"
if [ -e "${mt76_path}" ]; then
mt76_temp=" $(awk -F ': ' '{print $2}' "${mt76_path}")°C"
fi
wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' /sys/class/ieee80211/phy*/device/hwmon/hwmon*/temp1_input | awk '$1=$1')"
if grep -q "ipq40xx" "/etc/openwrt_release"; then
echo -n "WiFi: ${wifi_temp}"
echo -n "WiFi:${mt76_temp} ${wifi_temp}"
else
cpu_temp="$(awk '{printf("%.1f°C", $0 / 1000)}' /sys/class/thermal/thermal_zone0/temp)"
echo -n "CPU: ${cpu_temp}, WiFi: ${wifi_temp}"

View File

@ -1,24 +1,32 @@
#!/bin/sh
cpu_arch="$(cat "/proc/cpuinfo" | grep "model name" | sed -n "1p" | awk -F ': ' '{print $2}')"
cpu_arch="$(grep "model name" "/proc/cpuinfo" | head -n1 | awk -F ': ' '{print $2}' | xargs)"
[ -z "${cpu_arch}" ] && cpu_arch="?"
cpu_cores="$(cat "/proc/cpuinfo" | grep "processor" | wc -l)"
if grep -q "x86" "/etc/openwrt_release"; then
cpu_cores="$(grep "core id" "/proc/cpuinfo" | sort -u | wc -l)C $(grep -c "processor" "/proc/cpuinfo")T"
else
cpu_cores="$(grep -c "processor" "/proc/cpuinfo")"
fi
if grep -q "bcm27xx" "/etc/openwrt_release"; then
cpu_freq="$(expr $(vcgencmd measure_clock arm | awk -F '=' '{print $2}') / 1000000)Mhz"
elif grep -q "bcm53xx" "/etc/openwrt_release"; then
cpu_freq="$(nvram get clkfreq | awk -F ',' '{print $1}')MHz"
elif grep -q "mvebu" "/etc/openwrt_release"; then
cpu_freq="$(cat "/proc/cpuinfo" | grep "BogoMIPS" | sed -n "1p" | awk -F ': ' '{print $2}')MHz"
cpu_freq="$(grep "BogoMIPS" "/proc/cpuinfo" | sed -n "1p" | awk -F ': ' '{print $2}')MHz"
elif grep -q "x86" "/etc/openwrt_release"; then
cpu_freq="$(grep "MHz" "/proc/cpuinfo" | head -n1 | awk -F ': ' '{print $2}')MHz"
elif [ -e "/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq" ]; then
cpu_freq="$(expr $(cat "/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq") / 1000)MHz"
fi
if [ -e "/sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq" ]; then
if ! grep -q "x86" "/etc/openwrt_release" && [ -e "/sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq" ]; then
big_cpu_freq="$(expr $(cat "/sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq") / 1000)MHz "
fi
if grep -q "bcm27xx" "/etc/openwrt_release"; then
cpu_temp="$(vcgencmd measure_temp | awk -F '=' '{print $2}' | awk -F "'" '{print $1}')°C"
elif grep -q "x86" "/etc/openwrt_release"; then
cpu_temp="$(sensors 2>"/dev/null" | grep "Core 0" | cut -c12-)"
else
[ -e "/sys/class/thermal/thermal_zone0/temp" ] && \
cpu_temp="$(awk '{printf("%.1f°C", $0 / 1000)}' /sys/class/thermal/thermal_zone0/temp)"

View File

@ -0,0 +1,25 @@
#!/bin/sh
for i in $(ip address | grep -E 'eth[0-9]+' | awk -F ': ' '{print $2}' | xargs)
do
device_info="$(ethtool "$i")" || continue
if echo -e "$device_info" | grep -Eq 'Link detected.*yes'; then
link_stat=1
else
link_stat=0
fi
link_speed="$(echo -e "$device_info" | grep 'Speed' | awk -F ': ' '{print $2}' | tr -d 'Unknown!')"
[ -n "$link_speed" ] || link_speed=" - "
if echo -e "$device_info" | grep -Eq 'Duplex.*Full'; then
link_mode=1
else
link_mode=0
fi
json_body="${json_body:+$json_body,}{\"name\": \"$i\", \"status\": $link_stat, \"speed\": \"$link_speed\", \"duplex\": $link_mode}"
done
echo "[$json_body]"

View File

@ -9,10 +9,19 @@
local util = require "luci.util"
local stat = require "luci.tools.status"
local ver = require "luci.version"
local uci = require("luci.model.uci").cursor()
local has_ipv6 = fs.access("/usr/sbin/ip6tables")
local has_dhcp = fs.access("/etc/config/dhcp")
local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0)
local has_temp = fs.access("/sbin/tempinfo")
local has_switch = false
uci:foreach("network", "switch",
function(s)
has_switch = true
return false
end)
local sysinfo = luci.util.ubus("system", "info") or { }
local boardinfo = luci.util.ubus("system", "board") or { }
@ -24,7 +33,7 @@
buffered = 0,
shared = 0
}
local mem_cached = luci.sys.exec("sed -e '/^Cached: /!d; s#Cached: *##; s# kB##g' /proc/meminfo")
local swapinfo = sysinfo.swap or {
@ -46,19 +55,21 @@
"sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max"
):match("%d+")) or 4096
local cpu_info = luci.sys.exec("cpuinfo")
local user_info = luci.sys.exec("cat /proc/net/arp | grep 'br-lan' | grep '0x2' | wc -l") or "0"
local eth_info = luci.sys.exec("ethinfo")
local user_info = luci.sys.exec("cat /proc/net/arp | grep '0x2' | wc -l") or 0
local cpu_usage = luci.sys.exec("top -n1 | awk '/^CPU/ {printf(\"%d%\", 100 - $8)}'") or "6%"
local cpu_info = luci.sys.exec("/sbin/cpuinfo") or "?"
if not has_switch then
local eth_info = luci.sys.exec("ethinfo")
else
local eth_info = ""
end
local rv = {
cpuusage = cpu_usage,
cpuinfo = cpu_info,
cpuusage = cpu_usage,
ethinfo = eth_info,
userinfo = user_info,
userinfo = user_info,
uptime = sysinfo.uptime or 0,
localtime = os.date(),
loadavg = sysinfo.load or { 0, 0, 0 },
@ -121,7 +132,7 @@
<%+header%>
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-19.167.54478-71e2af4"></script>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
function progressbar(v, m)
{
@ -179,7 +190,7 @@
});
}
XHR.poll(1, '<%=REQUEST_URI%>', { status: 1 },
XHR.poll(5, '<%=REQUEST_URI%>', { status: 1 },
function(x, info)
{
if (!(npoll++ % 5))
@ -638,7 +649,7 @@
var e;
if (e = document.getElementById('ethinfo')) {
if (e = document.getElementById('ethinfo')) {
var ports = eval('(' + info.ethinfo + ')');
var tmp = "";
for (var i in ports)
@ -660,13 +671,13 @@
if (e = document.getElementById('userinfo'))
e.innerHTML = info.userinfo;
if (e = document.getElementById('cpuinfo'))
e.innerHTML = info.cpuinfo;
if (e = document.getElementById('cpuusage'))
e.innerHTML = info.cpuusage;
if (e = document.getElementById('cpuinfo'))
e.innerHTML = info.cpuinfo;
if (e = document.getElementById('loadavg'))
e.innerHTML = String.format(
'%.02f, %.02f, %.02f',
@ -713,8 +724,11 @@
<table width="100%" cellspacing="10">
<tr><td width="33%"><%:Hostname%></td><td><%=luci.sys.hostname() or "?"%></td></tr>
<tr><td width="33%"><%:Model%></td><td><%=pcdata(boardinfo.model or "?")%> <%=luci.sys.exec("cat /etc/bench.log") or " "%></td></tr>
<tr><td width="33%"><%:CPU Info%></td><td id="cpuinfo">-</td></tr>
<tr><td width="33%"><%:Model%></td><td><%=pcdata(boardinfo.model or "?")%> <%=luci.sys.exec("cat /etc/bench.log") or ""%></td></tr>
<tr><td width="33%"><%:Architecture%></td><td id="cpuinfo">-</td></tr>
<% if has_temp then %>
<tr><td width="33%"><%:Temperature%></td><td><%=luci.sys.exec("/sbin/tempinfo") or "?"%></td></tr>
<% end %>
<tr><td width="33%"><%:Firmware Version%></td><td>
<%=pcdata(ver.distname)%> <%=pcdata(ver.distversion)%> /
<%=pcdata(ver.luciname)%> (<%=pcdata(ver.luciversion)%>)
@ -747,12 +761,14 @@
</fieldset>
<% end %>
<% if not has_switch then %>
<fieldset class="cbi-section">
<legend><%:Interfaces%></legend>
<table width="100%" cellspacing="10" id="ethinfo">
</table>
</fieldset>
<% end %>
<fieldset class="cbi-section">
<legend><%:Network%></legend>

View File

@ -3,50 +3,37 @@
START=99
start()
{
start() {
rfc=4096
cc=$(grep -c processor /proc/cpuinfo)
rsfe=$(echo $cc*$rfc | bc)
sysctl -w net.core.rps_sock_flow_entries=$rsfe >/dev/null
for fileRps in $(ls /sys/class/net/eth*/queues/rx-*/rps_cpus)
threads="$(grep -c "processor" "/proc/cpuinfo")"
sysctl -w net.core.rps_sock_flow_entries="$(expr "$rfc" \* "$threads")" >"/dev/null" 2>&1
for fileRps in /sys/class/net/eth*/queues/rx-*/rps_cpus
do
echo $cc > $fileRps
echo "$threads" > "$fileRps" >"/dev/null" 2>&1
done
for fileRfc in $(ls /sys/class/net/eth*/queues/rx-*/rps_flow_cnt)
for fileRfc in /sys/class/net/eth*/queues/rx-*/rps_flow_cnt
do
echo $rfc > $fileRfc
echo "$rfc" > "$fileRfc" >"/dev/null" 2>&1
done
uci set network.@globals[0].packet_steering=1
uci set network.@globals[0].packet_steering="1"
uci commit network
a=$(cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq)
b=$(echo -n ' : ')
c=$(cat /proc/cpuinfo | grep 'core id' | sort -u | wc -l)
d=$(echo -n ' Core ')
e=$(cat /proc/cpuinfo | grep 'processor' | wc -l)
f=$(echo -n ' Thread ')
g=${a}${b}${c}${d}${e}${f}
mkdir -p /tmp/sysinfo
echo $g > /tmp/sysinfo/model
a=$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -v "@" | grep -v "\.")
b=$(echo "$a" | wc -l)
for i in $(seq 1 $b)
for i in $(ip address | grep -E 'eth[0-9]+' | awk -F ': ' '{print $2}' | xargs)
do
c=$(echo "$a" | sed -n ${i}p)
ethtool -K $c rx-checksum on >/dev/null 2>&1
ethtool -K $c tx-checksum-ip-generic on >/dev/null 2>&1 || (
ethtool -K $c tx-checksum-ipv4 on >/dev/null 2>&1
ethtool -K $c tx-checksum-ipv6 on >/dev/null 2>&1)
ethtool -K $c tx-scatter-gather on >/dev/null 2>&1
ethtool -K $c gso on >/dev/null 2>&1
ethtool -K $c tso on >/dev/null 2>&1
ethtool -K $c ufo on >/dev/null 2>&1
(
ethtool -K "$i" rx-checksum on
ethtool -K "$i" tx-checksum-ip-generic on || {
ethtool -K "$i" tx-checksum-ipv4 on
ethtool -K "$i" tx-checksum-ipv6 on
}
ethtool -K "$i" tx-scatter-gather on
ethtool -K "$i" gso on
ethtool -K "$i" tso on
ethtool -K "$i" ufo on
) >"/dev/null" 2>&1
done
[ -f /etc/index.htm ] && mv /etc/index.htm /usr/lib/lua/luci/view/admin_status/index.htm
}

View File

@ -1,5 +0,0 @@
#!/bin/sh
MHz=`grep 'MHz' /proc/cpuinfo | cut -c11- |sed -n '1p'`
TEMP=`sensors 2>/dev/null | grep 'Core 0' | cut -c12-`
echo "$MHz MHz $TEMP "

View File

@ -1,39 +0,0 @@
#!/bin/sh
a=$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -v "@" | grep -v "\.")
b=$(echo "$a" | wc -l)
rm -f /tmp/state/ethinfo
echo -n "[" > /tmp/state/ethinfo
for i in $(seq 1 $b)
do
h=$(echo '{"name":' )
c=$(echo "$a" | sed -n ${i}p)
d=$(ethtool $c)
e=$(echo "$d" | grep "Link detected" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g')
if [ $e = yes ]; then
l=1
else
l=0
fi
f=$(echo "$d" | grep "Speed" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g' | tr -d "Unknown!")
[ -z "$f" ] && f=" - "
g=$(echo "$d" | grep "Duplex" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g')
if [ "$g" == "Full" ]; then
x=1
else
x=0
fi
echo -n "$h \"$c\", \"status\": $l, \"speed\": \"$f\", \"duplex\": $x}," >> /tmp/state/ethinfo
done
sed -i 's/.$//' /tmp/state/ethinfo
echo -n "]" >> /tmp/state/ethinfo
cat /tmp/state/ethinfo

View File

@ -1,8 +0,0 @@
#!/bin/sh
if [ $(busybox ps -w | grep getcpu | grep -v grep | wc -l) -le 2 ]; then
AT=$(cat /proc/stat | grep "^cpu " | awk '{print $2+$3+$4+$5+$6+$7+$8 " " $2+$3+$4+$7+$8}')
sleep 1
BT=$(cat /proc/stat | grep "^cpu " | awk '{print $2+$3+$4+$5+$6+$7+$8 " " $2+$3+$4+$7+$8}')
printf "%.01f%%" $(echo $AT $BT | awk '{print (($4-$2)/($3-$1))*100}') >/tmp/cpuusage
fi

View File

@ -34,7 +34,7 @@ ALLWIFIBOARDS:= \
ezviz_cs-w3-wd1200g-eup \
glinet_gl-s1300 \
hiwifi_c526a \
hugo_ac1200 \
leguang_ca100 \
linksys_ea8300 \
mobipromo_cm520-79f \
nec_wg2600hp3 \
@ -115,7 +115,7 @@ $(eval $(call generate-ipq-wifi-package,engenius_emr3500,EnGenius EMR3500))
$(eval $(call generate-ipq-wifi-package,ezviz_cs-w3-wd1200g-eup,EZVIZ CS-W3-WD1200G EUP))
$(eval $(call generate-ipq-wifi-package,glinet_gl-s1300,GL.iNet GL-S1300))
$(eval $(call generate-ipq-wifi-package,hiwifi_c526a,HiWiFi C526A))
$(eval $(call generate-ipq-wifi-package,hugo_ac1200,Hugo AC1200))
$(eval $(call generate-ipq-wifi-package,leguang_ca100,LEGUANG CA100))
$(eval $(call generate-ipq-wifi-package,linksys_ea8300,Linksys EA8300))
$(eval $(call generate-ipq-wifi-package,mobipromo_cm520-79f,MobiPromo CM520-79F))
$(eval $(call generate-ipq-wifi-package,nec_wg2600hp3,NEC Platforms WG2600HP3))

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=ncurses
PKG_VERSION:=6.2
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
@ -128,6 +128,8 @@ ifneq ($(HOST_OS),FreeBSD)
r/rxvt-unicode \
s/screen \
s/screen-256color \
t/tmux \
t/tmux-256color \
v/vt100 \
v/vt102 \
x/xterm \

View File

@ -1,105 +0,0 @@
#
# Copyright (C) 2006-2012 OpenWrt.org
# Copyright (c) 2016 LEDE project
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=uclibc++
PKG_VERSION:=0.2.5
PKG_RELEASE:=3
PKG_SOURCE:=uClibc++-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://cxx.uclibc.org/src/
PKG_HASH:=596fb9ed7295564ce4c70ae6076a18f92e72f70310d70c98520bbca85c77895a
PKG_BUILD_DIR:=$(BUILD_DIR)/uClibc++-$(PKG_VERSION)
PKG_LICENSE:=LGPL-2.1-or-later
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
include $(INCLUDE_DIR)/package.mk
define Package/uclibcxx
NAME:=uclibc++
SECTION:=libs
CATEGORY:=Libraries
TITLE:=C++ library for embedded systems
URL:=https://cxx.uclibc.org/
endef
UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
-e 's/i.86/i386/' \
-e 's/sparc.*/sparc/' \
-e 's/m68k.*/m68k/' \
-e 's/ppc/powerpc/g' \
-e 's/v850.*/v850/g' \
-e 's/sh64/sh/' \
-e 's/sh[234].*/sh/' \
-e 's/mips.*/mips/' \
-e 's/mipsel.*/mips/' \
)
TARGET_CFLAGS += $(FPIC) -nostdinc++ -std=c++11
TARGET_LDFLAGS += -Wl,--gc-sections
ifneq ($(CONFIG_CCACHE),)
TARGET_CXX=$(TARGET_CXX_NOCACHE)
endif
ifeq ($(CONFIG_USE_MUSL),y)
SSP_LIB=-lssp_nonshared
endif
ifeq (${V}, s)
MAKE_VARS+= \
V=1
else ifeq (${V}, sc)
MAKE_VARS+= \
V=2
endif
MAKE_FLAGS:= \
$(TARGET_CONFIGURE_OPTS) \
CPU_CFLAGS="$(TARGET_CFLAGS)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
GEN_LIBS="-lc $(LIBGCC_S) $(SSP_LIB)" \
check_as_needed=
# check_as_needed overrides dependency on libgcc_s
define Build/Configure
if [ -f ./files/config.$(UCLIBC_TARGET_ARCH) ]; then \
cp ./files/config.$(UCLIBC_TARGET_ARCH) $(PKG_BUILD_DIR)/.config; \
else \
cp ./files/config.default $(PKG_BUILD_DIR)/.config; \
fi
endef
define Build/InstallDev
$(INSTALL_DIR) $(2)/bin $(1)/usr/include/uClibc++ $(1)/usr/lib
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/
$(CP) $(PKG_INSTALL_DIR)/include/* $(1)/usr/include/uClibc++/
$(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++*.{a,so}* $(1)/usr/lib/
$(SED) 's!\(^\|[[:space:]]\)-[IL]$(TOOLCHAIN_DIR)/[^[:space:]]*!!g' $(TOOLCHAIN_DIR)/bin/g++-uc
$(SED) 's|-I/include/|-I$$$${STAGING_DIR:-$(STAGING_DIR)}/usr/include/uClibc++/|g' $(TOOLCHAIN_DIR)/bin/g++-uc
$(SED) 's|-L/lib/|-L$$$${STAGING_DIR:-$(STAGING_DIR)}/lib/|g' $(TOOLCHAIN_DIR)/bin/g++-uc
# add another wrapper which links against both uClibc++ and libstdc++
$(INSTALL_BIN) $(TOOLCHAIN_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/g++-uc+std
$(SED) 's|^WRAPPER_INCLUDEDIR=.*||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
$(SED) 's|-luClibc++|-Wl,-Bdynamic,-luClibc++,-Bstatic,-lstdc++,-Bdynamic|g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
$(SED) 's|-nostdinc++||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
endef
define Package/uclibcxx/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++.so.* $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++-*.so $(1)/usr/lib/
endef
$(eval $(call BuildPackage,uclibcxx))

View File

@ -1,58 +0,0 @@
#
# Automatically generated make config: don't edit
#
#
# Target Features and Options
#
UCLIBCXX_HAS_FLOATS=y
# UCLIBCXX_HAS_LONG_DOUBLE is not set
# UCLIBCXX_HAS_TLS is not set
UCLIBCXX_WARNINGS=""
BUILD_EXTRA_LIBRARIES=""
HAVE_DOT_CONFIG=y
#
# String and I/O Stream Support
#
UCLIBCXX_HAS_WCHAR=y
UCLIBCXX_IOSTREAM_BUFSIZE=32
UCLIBCXX_HAS_LFS=y
UCLIBCXX_SUPPORT_CDIR=y
UCLIBCXX_SUPPORT_CIN=y
UCLIBCXX_SUPPORT_COUT=y
UCLIBCXX_SUPPORT_CERR=y
UCLIBCXX_SUPPORT_CLOG=y
# UCLIBCXX_SUPPORT_WCIN is not set
# UCLIBCXX_SUPPORT_WCOUT is not set
# UCLIBCXX_SUPPORT_WCERR is not set
# UCLIBCXX_SUPPORT_WCLOG is not set
#
# STL and Code Expansion
#
UCLIBCXX_STL_BUFFER_SIZE=32
UCLIBCXX_CODE_EXPANSION=y
UCLIBCXX_EXPAND_CONSTRUCTORS_DESTRUCTORS=y
UCLIBCXX_EXPAND_STRING_CHAR=y
UCLIBCXX_EXPAND_VECTOR_BASIC=y
UCLIBCXX_EXPAND_IOS_CHAR=y
UCLIBCXX_EXPAND_STREAMBUF_CHAR=y
UCLIBCXX_EXPAND_ISTREAM_CHAR=y
UCLIBCXX_EXPAND_OSTREAM_CHAR=y
UCLIBCXX_EXPAND_FSTREAM_CHAR=y
UCLIBCXX_EXPAND_SSTREAM_CHAR=y
#
# Library Installation Options
#
UCLIBCXX_RUNTIME_PREFIX=""
UCLIBCXX_RUNTIME_INCLUDE_SUBDIR="/include"
UCLIBCXX_RUNTIME_LIB_SUBDIR="/lib"
UCLIBCXX_RUNTIME_BIN_SUBDIR="/bin"
UCLIBCXX_EXCEPTION_SUPPORT=y
IMPORT_LIBSUP=y
# IMPORT_LIBGCC_EH is not set
BUILD_STATIC_LIB=y
# BUILD_ONLY_STATIC_LIB is not set
# DODEBUG is not set

View File

@ -1,10 +0,0 @@
--- a/Rules.mak
+++ b/Rules.mak
@@ -232,7 +232,6 @@ endif
GEN_CXXFLAGS:=-nostdinc++
GEN_CXXFLAGS+=$(if $(CXXFLAG_-fvisibility-inlines-hidden),-DGCC_HASCLASSVISIBILITY)
CXXFLAGS:=$(CFLAGS)
-CFLAGS += -ansi
LIBGCC:=$(shell $(CC) -print-libgcc-file-name)
LIBGCC_DIR:=$(dir $(LIBGCC))

View File

@ -1,35 +0,0 @@
From 8245f62c1e7aba150f666b3c3a1dda646dee6d4b Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Fri, 27 Sep 2019 13:12:44 -0700
Subject: [PATCH] cstdio: Add undef for four functions
When compiling with uClibc-ng, these functions get defined as macros and
become unavailable for std.
Fixes programs that use the std versions of these functions.
This matches libstdcpp behavior.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
include/cstdio | 9 +++++++++
1 file changed, 9 insertions(+)
--- a/include/cstdio
+++ b/include/cstdio
@@ -21,6 +21,15 @@
#ifndef __HEADER_CSTDIO
#define __HEADER_CSTDIO 1
+#undef clearerr
+#undef feof
+#undef ferror
+#undef fgetc
+#undef fputc
+#undef getc
+#undef getchar
+#undef putc
+#undef putchar
namespace std{
using ::FILE;

View File

@ -1,10 +0,0 @@
--- a/Rules.mak
+++ b/Rules.mak
@@ -185,7 +185,6 @@ export UCLIBCXX_RUNTIME_PREFIX UCLIBCXX_
WRAPPER = $(top_builddir)bin/g++-uc
OPTIMIZATION:=
-PICFLAG:=-fPIC
# use '-Os' optimization if available, else use -O2, allow Config to override
$(eval $(call check-gcc-var,-Os))

View File

@ -1,143 +0,0 @@
From 8151579eb36d9366632242415ff3f5177fa5e1e2 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Thu, 3 Oct 2019 18:58:43 -0700
Subject: [PATCH] uClibc++: Make long long available to C++11
C++11 makes long long available. It is no longer a GNU extension.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
include/istream | 4 ++--
include/istream_helpers | 2 +-
include/ostream | 8 ++++----
include/ostream_helpers | 8 ++++----
tests/sstreamtest.cpp | 4 ++--
5 files changed, 13 insertions(+), 13 deletions(-)
--- a/include/istream
+++ b/include/istream
@@ -72,7 +72,7 @@ namespace std{
basic_istream<charT,traits>& operator>>(void*& p);
basic_istream<charT,traits>& operator>>(basic_streambuf<char_type,traits>* sb);
-#ifndef __STRICT_ANSI__
+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
basic_istream<charT,traits>& operator>>(long long& n);
basic_istream<charT,traits>& operator>>(unsigned long long& n);
#endif
@@ -455,7 +455,7 @@ namespace std{
return *this;
}
-#ifndef __STRICT_ANSI__
+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
template <class charT, class traits> _UCXXEXPORT basic_istream<charT,traits>&
basic_istream<charT,traits>::operator>>(long long& n)
{
--- a/include/istream_helpers
+++ b/include/istream_helpers
@@ -301,7 +301,7 @@ namespace std{
};
-#ifndef __STRICT_ANSI__
+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
template <class traits> class _UCXXEXPORT __istream_readin<traits, char, long long>{
public:
inline static void readin(basic_istream<char, traits >& stream, long long & var)
--- a/include/ostream
+++ b/include/ostream
@@ -85,7 +85,7 @@ namespace std {
basic_ostream<charT,traits>& operator<<(long double f);
basic_ostream<charT,traits>& operator<<(void* p);
basic_ostream<charT,traits>& operator<<(basic_streambuf<char_type,traits>* sb);
-#ifndef __STRICT_ANSI__
+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
basic_ostream<charT,traits>& operator<<(long long n);
basic_ostream<charT,traits>& operator<<(unsigned long long n);
#endif
@@ -221,7 +221,7 @@ namespace std {
return *this;
}
-#ifndef __STRICT_ANSI__
+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
template <class charT, class traits> _UCXXEXPORT basic_ostream<charT,traits>& basic_ostream<charT, traits>::operator<<(long long n)
{
sentry s(*this);
@@ -487,7 +487,7 @@ namespace std {
#endif
-#ifndef __STRICT_ANSI__
+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
//Support for output of long long data types
@@ -509,7 +509,7 @@ template<class Ch, class Tr> _UCXXEXPORT
}
-#endif //__STRICT_ANSI__
+#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
--- a/include/ostream_helpers
+++ b/include/ostream_helpers
@@ -142,7 +142,7 @@ namespace std{
}
};
-#ifndef __STRICT_ANSI__
+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
template <class traits> class _UCXXEXPORT __ostream_printout<traits, char, signed long long int>{
public:
@@ -237,7 +237,7 @@ namespace std{
};
-#endif //__STRICT_ANSI__
+#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
template <class traits> class _UCXXEXPORT __ostream_printout<traits, char, double>{
public:
@@ -357,7 +357,7 @@ namespace std{
}
};
-#ifndef __STRICT_ANSI__
+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
template <class traits> class _UCXXEXPORT __ostream_printout<traits, wchar_t, signed long long int>{
public:
@@ -428,7 +428,7 @@ namespace std{
};
-#endif //__STRICT_ANSI__
+#endif // !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
template <class traits> class _UCXXEXPORT __ostream_printout<traits, wchar_t, double>{
public:
--- a/tests/sstreamtest.cpp
+++ b/tests/sstreamtest.cpp
@@ -9,7 +9,7 @@ int main(){
int i;
std::string s;
char c;
-#ifndef __STRICT_ANSI__
+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
long long ll;
unsigned long long ull;
#endif
@@ -32,7 +32,7 @@ int main(){
-#ifndef __STRICT_ANSI__
+#if !defined(__STRICT_ANSI__) || (__cplusplus >= 201103L)
a.str("678 76 54");
a >> ll >> ull >> s;
std::cout << "ll (should be 678): " << ll << std::endl;

View File

@ -1,37 +0,0 @@
From 7f6dd860818512c0eb313320308b22ba7e2c7205 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Fri, 4 Oct 2019 20:06:53 -0700
Subject: [PATCH] istream_helpers: Fix sscanf typo
This caused readin not to work properly with long long types.
Found accidentally through a glibc warning
(declared with warn_unused_result).
Tested with gptfdisk on OpenWrt.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
include/istream_helpers | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/include/istream_helpers
+++ b/include/istream_helpers
@@ -317,7 +317,7 @@ namespace std{
sscanf(temp.c_str(), "%llo", (unsigned long long *)&var );
}else if(stream.flags() & ios_base::hex){
if(stream.flags() & ios_base::uppercase){
- scanf(temp.c_str(), "%llX", (unsigned long long *)&var );
+ sscanf(temp.c_str(), "%llX", (unsigned long long *)&var );
}else{
sscanf(temp.c_str(), "%llx", (unsigned long long *)&var);
}
@@ -344,7 +344,7 @@ namespace std{
sscanf(temp.c_str(), "%llo", &var );
}else if(stream.flags() & ios_base::hex){
if(stream.flags() & ios_base::uppercase){
- scanf(temp.c_str(), "%llX", &var );
+ sscanf(temp.c_str(), "%llX", &var );
}else{
sscanf(temp.c_str(), "%llx", &var);
}

View File

@ -49,7 +49,7 @@ config WOLFSSL_HAS_WPAS
config WOLFSSL_HAS_ECC25519
bool "Include ECC Curve 25519 support"
default n
default y
config WOLFSSL_HAS_OPENVPN
bool "Include OpenVPN support"

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=wolfssl
PKG_VERSION:=4.8.1-stable
PKG_RELEASE:=1
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION)
@ -57,11 +57,18 @@ define Package/libwolfssl/config
source "$(SOURCE)/Config.in"
endef
TARGET_CFLAGS += $(FPIC) -DFP_MAX_BITS=8192 -fomit-frame-pointer -flto
TARGET_CFLAGS += \
$(FPIC) \
-fomit-frame-pointer \
-flto \
-DFP_MAX_BITS=8192 \
-DWOLFSSL_ALT_CERT_CHAINS
TARGET_LDFLAGS += -flto
# --enable-stunnel needed for OpenSSL API compatibility bits
CONFIGURE_ARGS += \
--enable-reproducible-build \
--enable-lighty \
--enable-opensslall \
--enable-opensslextra \
@ -95,7 +102,7 @@ endif
ifeq ($(CONFIG_WOLFSSL_HAS_WPAS),y)
CONFIGURE_ARGS += \
--enable-wpas --enable-sha512 --enable-fortress --enable-fastmath
--enable-wpas --enable-fortress --enable-fastmath
endif
define Build/InstallDev

View File

@ -0,0 +1,22 @@
From f447e4c1fa4c932c0286fa0331966756e243db81 Mon Sep 17 00:00:00 2001
From: JacobBarthelmeh <jacob@wolfssl.com>
Date: Fri, 17 Sep 2021 15:06:13 -0700
Subject: [PATCH] update macro guard on SHA256 transform call
---
src/ssl.c | 3 ++-
tests/api.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
--- a/src/ssl.c
+++ b/src/ssl.c
@@ -17639,7 +17639,8 @@ size_t wolfSSL_get_client_random(const W
#if defined(OPENSSL_EXTRA)
#if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || \
- (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2)))
+ (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2))) && \
+ !defined(WOLFSSL_DEVCRYPTO_HASH) && !defined(WOLFSSL_AFALG_HASH)
/* Apply SHA256 transformation to the data */
int wolfSSL_SHA256_Transform(WOLFSSL_SHA256_CTX* sha256,
const unsigned char* data)

View File

@ -7,12 +7,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=nftables
PKG_VERSION:=0.9.6
PKG_RELEASE:=2
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
PKG_HASH:=68d6fdfe8ab02303e6b1f13968a4022da5b0120110eaee3233d806857937b66e
PKG_HASH:=58bf547daf967a2b88ecb4f425f126006ebde22711db806b25c1d6cf84fe45f4
PKG_MAINTAINER:=
PKG_LICENSE:=GPL-2.0

View File

@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=wireguard-tools
PKG_VERSION:=1.0.20210914
PKG_RELEASE:=1
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=wireguard-tools-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-tools/snapshot/

View File

@ -26,6 +26,7 @@ proto_wireguard_init_config() {
proto_wireguard_setup_peer() {
local peer_config="$1"
local disabled
local public_key
local preshared_key
local allowed_ips
@ -34,6 +35,7 @@ proto_wireguard_setup_peer() {
local endpoint_port
local persistent_keepalive
config_get_bool disabled "${peer_config}" "disabled" 0
config_get public_key "${peer_config}" "public_key"
config_get preshared_key "${peer_config}" "preshared_key"
config_get allowed_ips "${peer_config}" "allowed_ips"
@ -42,6 +44,11 @@ proto_wireguard_setup_peer() {
config_get endpoint_port "${peer_config}" "endpoint_port"
config_get persistent_keepalive "${peer_config}" "persistent_keepalive"
if [ "${disabled}" -eq 1 ]; then
# skip disabled peers
return 0
fi
if [ -z "$public_key" ]; then
echo "Skipping peer config $peer_config because public key is not defined."
return 0

View File

@ -17,6 +17,7 @@
check_peer_activity() {
local cfg=$1
local iface=$2
local disabled
local public_key
local endpoint_host
local endpoint_port
@ -24,9 +25,16 @@ check_peer_activity() {
local last_handshake
local idle_seconds
config_get_bool disabled "${cfg}" "disabled" 0
config_get public_key "${cfg}" "public_key"
config_get endpoint_host "${cfg}" "endpoint_host"
config_get endpoint_port "${cfg}" "endpoint_port"
if [ "${disabled}" -eq 1 ]; then
# skip disabled peers
return 0
fi
persistent_keepalive=$(wg show ${iface} persistent-keepalive | grep ${public_key} | awk '{print $2}')
# only process peers with endpoints and keepalive set

View File

@ -19,224 +19,263 @@ opt_dryrun = False
def parseVer_1234(match, filepath):
progname = match.group(1)
progversion = (int(match.group(2)) << 64) |\
(int(match.group(3)) << 48) |\
(int(match.group(4)) << 32) |\
(int(match.group(5)) << 16)
return (progname, progversion)
progname = match.group(1)
progversion = (
(int(match.group(2)) << 64)
| (int(match.group(3)) << 48)
| (int(match.group(4)) << 32)
| (int(match.group(5)) << 16)
)
return (progname, progversion)
def parseVer_123(match, filepath):
progname = match.group(1)
try:
patchlevel = match.group(5)
except IndexError as e:
patchlevel = None
if patchlevel:
patchlevel = ord(patchlevel[0])
else:
patchlevel = 0
progversion = (int(match.group(2)) << 64) |\
(int(match.group(3)) << 48) |\
(int(match.group(4)) << 32) |\
patchlevel
return (progname, progversion)
progname = match.group(1)
try:
patchlevel = match.group(5)
except IndexError as e:
patchlevel = None
if patchlevel:
patchlevel = ord(patchlevel[0])
else:
patchlevel = 0
progversion = (
(int(match.group(2)) << 64)
| (int(match.group(3)) << 48)
| (int(match.group(4)) << 32)
| patchlevel
)
return (progname, progversion)
def parseVer_12(match, filepath):
progname = match.group(1)
try:
patchlevel = match.group(4)
except IndexError as e:
patchlevel = None
if patchlevel:
patchlevel = ord(patchlevel[0])
else:
patchlevel = 0
progversion = (int(match.group(2)) << 64) |\
(int(match.group(3)) << 48) |\
patchlevel
return (progname, progversion)
progname = match.group(1)
try:
patchlevel = match.group(4)
except IndexError as e:
patchlevel = None
if patchlevel:
patchlevel = ord(patchlevel[0])
else:
patchlevel = 0
progversion = (int(match.group(2)) << 64) | (int(match.group(3)) << 48) | patchlevel
return (progname, progversion)
def parseVer_r(match, filepath):
progname = match.group(1)
progversion = (int(match.group(2)) << 64)
return (progname, progversion)
progname = match.group(1)
progversion = int(match.group(2)) << 64
return (progname, progversion)
def parseVer_ymd_GIT_SHASUM(match, filepath):
progname = match.group(1)
progversion = (
(int(match.group(2)) << 64)
| (int(match.group(3)) << 48)
| (int(match.group(4)) << 32)
)
return (progname, progversion)
def parseVer_ymd(match, filepath):
progname = match.group(1)
progversion = (int(match.group(2)) << 64) |\
(int(match.group(3)) << 48) |\
(int(match.group(4)) << 32)
return (progname, progversion)
progname = match.group(1)
progversion = (
(int(match.group(2)) << 64)
| (int(match.group(3)) << 48)
| (int(match.group(4)) << 32)
)
return (progname, progversion)
def parseVer_GIT(match, filepath):
progname = match.group(1)
st = os.stat(filepath)
progversion = int(st.st_mtime) << 64
return (progname, progversion)
progname = match.group(1)
st = os.stat(filepath)
progversion = int(st.st_mtime) << 64
return (progname, progversion)
extensions = (
".tar.gz",
".tar.bz2",
".tar.xz",
".orig.tar.gz",
".orig.tar.bz2",
".orig.tar.xz",
".zip",
".tgz",
".tbz",
".txz",
".tar.gz",
".tar.bz2",
".tar.xz",
".orig.tar.gz",
".orig.tar.bz2",
".orig.tar.xz",
".zip",
".tgz",
".tbz",
".txz",
)
versionRegex = (
(re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)\.(\d+)"), parseVer_1234), # xxx-1.2.3.4
(re.compile(r"(.+)[-_](\d\d\d\d)-?(\d\d)-?(\d\d)"), parseVer_ymd), # xxx-YYYY-MM-DD
(re.compile(r"(.+)[-_]([0-9a-fA-F]{40,40})"), parseVer_GIT), # xxx-GIT_SHASUM
(re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)(\w?)"), parseVer_123), # xxx-1.2.3a
(re.compile(r"(.+)[-_](\d+)_(\d+)_(\d+)"), parseVer_123), # xxx-1_2_3
(re.compile(r"(.+)[-_](\d+)\.(\d+)(\w?)"), parseVer_12), # xxx-1.2a
(re.compile(r"(.+)[-_]r?(\d+)"), parseVer_r), # xxx-r1111
(re.compile(r"(gcc[-_]\d+)\.(\d+)\.(\d+)"), parseVer_12), # gcc.1.2
(re.compile(r"(linux[-_]\d+\.\d+)\.(\d+)"), parseVer_r), # linux.1
(re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)\.(\d+)"), parseVer_1234), # xxx-1.2.3.4
(
re.compile(r"(.+)[-_](\d\d\d\d)-?(\d\d)-?(\d\d)-"),
parseVer_ymd_GIT_SHASUM,
), # xxx-YYYY-MM-DD-GIT_SHASUM
(re.compile(r"(.+)[-_](\d\d\d\d)-?(\d\d)-?(\d\d)"), parseVer_ymd), # xxx-YYYY-MM-DD
(re.compile(r"(.+)[-_]([0-9a-fA-F]{40,40})"), parseVer_GIT), # xxx-GIT_SHASUM
(re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)(\w?)"), parseVer_123), # xxx-1.2.3a
(re.compile(r"(.+)[-_](\d+)_(\d+)_(\d+)"), parseVer_123), # xxx-1_2_3
(re.compile(r"(.+)[-_](\d+)\.(\d+)(\w?)"), parseVer_12), # xxx-1.2a
(re.compile(r"(.+)[-_]r?(\d+)"), parseVer_r), # xxx-r1111
)
blacklist = [
("linux", re.compile(r"linux-\d.*")),
("gcc", re.compile(r"gcc-.*")),
("wl_apsta", re.compile(r"wl_apsta.*")),
(".fw", re.compile(r".*\.fw")),
(".arm", re.compile(r".*\.arm")),
(".bin", re.compile(r".*\.bin")),
("rt-firmware", re.compile(r"RT[\d\w]+_Firmware.*")),
("wl_apsta", re.compile(r"wl_apsta.*")),
(".fw", re.compile(r".*\.fw")),
(".arm", re.compile(r".*\.arm")),
(".bin", re.compile(r".*\.bin")),
("rt-firmware", re.compile(r"RT[\d\w]+_Firmware.*")),
]
class EntryParseError(Exception): pass
class EntryParseError(Exception):
pass
class Entry:
def __init__(self, directory, filename):
self.directory = directory
self.filename = filename
self.progname = ""
self.fileext = ""
def __init__(self, directory, filename):
self.directory = directory
self.filename = filename
self.progname = ""
self.fileext = ""
for ext in extensions:
if filename.endswith(ext):
filename = filename[0:0-len(ext)]
self.fileext = ext
break
else:
print(self.filename, "has an unknown file-extension")
raise EntryParseError("ext")
for (regex, parseVersion) in versionRegex:
match = regex.match(filename)
if match:
(self.progname, self.version) = parseVersion(
match, directory + "/" + filename + self.fileext)
break
else:
print(self.filename, "has an unknown version pattern")
raise EntryParseError("ver")
for ext in extensions:
if filename.endswith(ext):
filename = filename[0 : 0 - len(ext)]
self.fileext = ext
break
else:
print(self.filename, "has an unknown file-extension")
raise EntryParseError("ext")
for (regex, parseVersion) in versionRegex:
match = regex.match(filename)
if match:
(self.progname, self.version) = parseVersion(
match, directory + "/" + filename + self.fileext
)
break
else:
print(self.filename, "has an unknown version pattern")
raise EntryParseError("ver")
def getPath(self):
return (self.directory + "/" + self.filename).replace("//", "/")
def getPath(self):
return (self.directory + "/" + self.filename).replace("//", "/")
def deleteFile(self):
path = self.getPath()
print("Deleting", path)
if not opt_dryrun:
os.unlink(path)
def deleteFile(self):
path = self.getPath()
print("Deleting", path)
if not opt_dryrun:
os.unlink(path)
def __ge__(self, y):
return self.version >= y.version
def __ge__(self, y):
return self.version >= y.version
def usage():
print("OpenWrt download directory cleanup utility")
print("Usage: " + sys.argv[0] + " [OPTIONS] <path/to/dl>")
print("")
print(" -d|--dry-run Do a dry-run. Don't delete any files")
print(" -B|--show-blacklist Show the blacklist and exit")
print(" -w|--whitelist ITEM Remove ITEM from blacklist")
print("OpenWrt download directory cleanup utility")
print("Usage: " + sys.argv[0] + " [OPTIONS] <path/to/dl>")
print("")
print(" -d|--dry-run Do a dry-run. Don't delete any files")
print(" -B|--show-blacklist Show the blacklist and exit")
print(" -w|--whitelist ITEM Remove ITEM from blacklist")
def main(argv):
global opt_dryrun
global opt_dryrun
try:
(opts, args) = getopt.getopt(argv[1:],
"hdBw:",
[ "help", "dry-run", "show-blacklist", "whitelist=", ])
if len(args) != 1:
usage()
return 1
except getopt.GetoptError as e:
usage()
return 1
directory = args[0]
try:
(opts, args) = getopt.getopt(
argv[1:],
"hdBw:",
[
"help",
"dry-run",
"show-blacklist",
"whitelist=",
],
)
if len(args) != 1:
usage()
return 1
except getopt.GetoptError as e:
usage()
return 1
directory = args[0]
if not os.path.exists(directory):
print("Can't find dl path", directory)
return 1
if not os.path.exists(directory):
print("Can't find dl path", directory)
return 1
for (o, v) in opts:
if o in ("-h", "--help"):
usage()
return 0
if o in ("-d", "--dry-run"):
opt_dryrun = True
if o in ("-w", "--whitelist"):
for i in range(0, len(blacklist)):
(name, regex) = blacklist[i]
if name == v:
del blacklist[i]
break
else:
print("Whitelist error: Item", v,\
"is not in blacklist")
return 1
if o in ("-B", "--show-blacklist"):
for (name, regex) in blacklist:
sep = "\t\t"
if len(name) >= 8:
sep = "\t"
print("%s%s(%s)" % (name, sep, regex.pattern))
return 0
for (o, v) in opts:
if o in ("-h", "--help"):
usage()
return 0
if o in ("-d", "--dry-run"):
opt_dryrun = True
if o in ("-w", "--whitelist"):
for i in range(0, len(blacklist)):
(name, regex) = blacklist[i]
if name == v:
del blacklist[i]
break
else:
print("Whitelist error: Item", v, "is not in blacklist")
return 1
if o in ("-B", "--show-blacklist"):
for (name, regex) in blacklist:
sep = "\t\t"
if len(name) >= 8:
sep = "\t"
print("%s%s(%s)" % (name, sep, regex.pattern))
return 0
# Create a directory listing and parse the file names.
entries = []
for filename in os.listdir(directory):
if filename == "." or filename == "..":
continue
for (name, regex) in blacklist:
if regex.match(filename):
if opt_dryrun:
print(filename, "is blacklisted")
break
else:
try:
entries.append(Entry(directory, filename))
except EntryParseError as e:
pass
# Create a directory listing and parse the file names.
entries = []
for filename in os.listdir(directory):
if filename == "." or filename == "..":
continue
for (name, regex) in blacklist:
if regex.match(filename):
if opt_dryrun:
print(filename, "is blacklisted")
break
else:
try:
entries.append(Entry(directory, filename))
except EntryParseError as e:
pass
# Create a map of programs
progmap = {}
for entry in entries:
if entry.progname in progmap.keys():
progmap[entry.progname].append(entry)
else:
progmap[entry.progname] = [entry,]
# Create a map of programs
progmap = {}
for entry in entries:
if entry.progname in progmap.keys():
progmap[entry.progname].append(entry)
else:
progmap[entry.progname] = [
entry,
]
# Traverse the program map and delete everything but the last version
for prog in progmap:
lastVersion = None
versions = progmap[prog]
for version in versions:
if lastVersion is None or version >= lastVersion:
lastVersion = version
if lastVersion:
for version in versions:
if version is not lastVersion:
version.deleteFile()
if opt_dryrun:
print("Keeping", lastVersion.getPath())
# Traverse the program map and delete everything but the last version
for prog in progmap:
lastVersion = None
versions = progmap[prog]
for version in versions:
if lastVersion is None or version >= lastVersion:
lastVersion = version
if lastVersion:
for version in versions:
if version is not lastVersion:
version.deleteFile()
if opt_dryrun:
print("Keeping", lastVersion.getPath())
return 0
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv))
sys.exit(main(sys.argv))

View File

@ -17,10 +17,9 @@ rm -f "$OUTPUT"
head=16
sect=63
cyl=$(( (KERNELSIZE + ROOTFSSIZE) * 1024 * 1024 / (head * sect * 512)))
# create partition table
set $(ptgen -o "$OUTPUT" -h $head -s $sect ${GUID:+-g} -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m ${ALIGN:+-l $ALIGN} ${SIGNATURE:+-S 0x$SIGNATURE} ${GUID:+-G $GUID})
set $(ptgen -o "$OUTPUT" -h $head -s $sect ${GUID:+-g} -p "${KERNELSIZE}m" -p "${ROOTFSSIZE}m" ${ALIGN:+-l $ALIGN} ${SIGNATURE:+-S 0x$SIGNATURE} ${GUID:+-G $GUID})
KERNELOFFSET="$(($1 / 512))"
KERNELSIZE="$2"
@ -31,8 +30,8 @@ ROOTFSSIZE="$(($4 / 512))"
dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc
if [ -n "$GUID" ]; then
[ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$(($ROOTFSOFFSET + $ROOTFSSIZE))" conv=notrunc count="$sect"
mkfs.fat -n kernel -C "$OUTPUT.kernel" -S 512 "$(($KERNELSIZE / 1024))"
[ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$((ROOTFSOFFSET + ROOTFSSIZE))" conv=notrunc count="$sect"
mkfs.fat -n kernel -C "$OUTPUT.kernel" -S 512 "$((KERNELSIZE / 1024))"
mcopy -s -i "$OUTPUT.kernel" "$KERNELDIR"/* ::/
else
make_ext4fs -J -L kernel -l "$KERNELSIZE" "$OUTPUT.kernel" "$KERNELDIR"

View File

@ -286,6 +286,7 @@ sub parse_package_metadata($) {
};
/^Config:\s*(.*)\s*$/ and $pkg->{config} = "$1\n".get_multiline(*FILE, "\t");
/^Prereq-Check:/ and $pkg->{prereq} = 1;
/^Maintainer: \s*(.+)\s*$/ and $pkg->{maintainer} = [ split /, /, $1 ];
/^Require-User:\s*(.*?)\s*$/ and do {
my @ugspecs = split /\s+/, $1;

View File

@ -585,6 +585,40 @@ sub gen_usergroup_list() {
}
}
sub gen_package_manifest_json() {
my $json;
parse_package_metadata($ARGV[0]) or exit 1;
foreach my $name (sort {uc($a) cmp uc($b)} keys %package) {
my %depends;
my $pkg = $package{$name};
foreach my $dep (@{$pkg->{depends} || []}) {
if ($dep =~ m!^\+?(?:[^:]+:)?([^@]+)$!) {
$depends{$1}++;
}
}
my @depends = sort keys %depends;
my $pkg_deps = join ' ', map { qq/"$_",/ } @depends;
$pkg_deps =~ s/\,$//;
my $pkg_maintainer = join ' ', map { qq/"$_",/ } @{$pkg->{maintainer} || []};
$pkg_maintainer =~ s/\,$//;
$json = <<"END_JSON";
${json}{
"name":"$name",
"version":"$pkg->{version}",
"category":"$pkg->{category}",
"license":"$pkg->{license}",
"maintainer": [$pkg_maintainer],
"depends":[$pkg_deps]},
END_JSON
}
$json =~ s/[\n\r]//g;
$json =~ s/\,$//;
print "[$json]";
}
sub parse_command() {
GetOptions("ignore=s", \@ignore);
my $cmd = shift @ARGV;
@ -594,6 +628,7 @@ sub parse_command() {
/^kconfig/ and return gen_kconfig_overrides();
/^source$/ and return gen_package_source();
/^pkgaux$/ and return gen_package_auxiliary();
/^pkgmanifestjson$/ and return gen_package_manifest_json();
/^license$/ and return gen_package_license(0);
/^licensefull$/ and return gen_package_license(1);
/^usergroup$/ and return gen_usergroup_list();
@ -606,6 +641,7 @@ Available Commands:
$0 kconfig [file] [config] [patchver] Kernel config overrides
$0 source [file] Package source file information
$0 pkgaux [file] Package auxiliary variables in makefile format
$0 pkgmanifestjson [file] Package manifests in JSON format
$0 license [file] Package license information
$0 licensefull [file] Package license information (full list)
$0 usergroup [file] Package usergroup allocation list

View File

@ -7,6 +7,7 @@ FEATURES:=squashfs fpu ramdisk nand
CPU_TYPE:=cortex-a7
CPU_SUBTYPE:=neon-vfpv4
MAINTAINER:=John Crispin <john@phrozen.org>
SUBTARGETS:=generic
KERNEL_PATCHVER:=5.4

View File

@ -59,7 +59,7 @@ engenius,ens620ext)
ucidef_set_led_switch "lan1" "LAN1" "green:lan1" "switch0" "0x10"
ucidef_set_led_switch "lan2" "LAN2" "green:lan2" "switch0" "0x20"
;;
hugo,ac1200)
leguang,ca100)
ucidef_set_led_default "green" "GREEN" "green:ctrl1" "1"
ucidef_set_led_default "red" "RED" "red:ctrl2" "1"
ucidef_set_led_default "blue" "BLUE" "blue:ctrl3" "1"

View File

@ -81,7 +81,7 @@ ipq40xx_setup_interfaces()
ucidef_add_switch "switch0" \
"0t@eth0" "2:lan" "3:lan" "4:lan" "5:wan"
;;
hugo,ac1200)
leguang,ca100)
ucidef_add_switch "switch0" \
"0t@eth0" "5:wan" "3:lan"
;;

View File

@ -106,7 +106,7 @@ case "$FIRMWARE" in
compex,wpj428 |\
engenius,eap1300 |\
engenius,eap2200 |\
hugo,ac1200 |\
leguang,ca100 |\
openmesh,a42 |\
openmesh,a62 |\
qxwlan,e2600ac-c1 |\

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
* Copyright (c) 2019 Hugo Yuan <hugolxq@gmail.com>
*/
@ -8,8 +9,8 @@
#include <dt-bindings/soc/qcom,tcsr.h>
/ {
model = "Hugo AC1200";
compatible = "hugo,ac1200", "qcom,ipq4019";
model = "LEGUANG CA100";
compatible = "leguang,ca100", "qcom,ipq4019";
memory {
device_type = "memory";

View File

@ -0,0 +1 @@
BOARDNAME:=Generic

View File

@ -491,7 +491,6 @@ define Device/glinet_gl-b1300
DEVICE_MODEL := GL-B1300
BOARD_NAME := gl-b1300
DEVICE_DTS := qcom-ipq4029-gl-b1300
BOARD_NAME := gl-b1300
KERNEL_SIZE := 4096k
IMAGE_SIZE := 26624k
IMAGE/sysupgrade.bin := append-kernel |append-rootfs | pad-rootfs | append-metadata
@ -529,18 +528,17 @@ define Device/hiwifi_c526a-128m
endef
TARGET_DEVICES += hiwifi_c526a-128m
define Device/hugo_ac1200
define Device/leguang_ca100
$(call Device/FitImage)
DEVICE_VENDOR := Hugo
DEVICE_MODEL := AC1200
BOARD_NAME := hugo_ac1200
DEVICE_DTS := qcom-ipq4019-hugo-ac1200
DEVICE_VENDOR := LEGUANG
DEVICE_MODEL := CA100
DEVICE_DTS := qcom-ipq4019-ca100
KERNEL_SIZE := 4096k
IMAGE_SIZE := 31232k
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
DEVICE_PACKAGES := ipq-wifi-hugo_ac1200
DEVICE_PACKAGES := ipq-wifi-leguang_ca100
endef
TARGET_DEVICES += hugo_ac1200
TARGET_DEVICES += leguang_ca100
define Device/linksys_ea6350v3
# The Linksys EA6350v3 has a uboot bootloader that does not

View File

@ -40,10 +40,10 @@ Signed-off-by: John Crispin <john@phrozen.org>
+ qcom-ipq4019-a62.dtb \
+ qcom-ipq4019-c526a.dtb \
+ qcom-ipq4019-c526a-128m.dtb \
+ qcom-ipq4019-ca100.dtb \
+ qcom-ipq4019-cm520-79f.dtb \
+ qcom-ipq4019-ea8300.dtb \
+ qcom-ipq4019-eap2200.dtb \
+ qcom-ipq4019-hugo-ac1200.dtb \
+ qcom-ipq4019-fritzbox-7530.dtb \
+ qcom-ipq4019-fritzrepeater-1200.dtb \
+ qcom-ipq4019-fritzrepeater-3000.dtb \

View File

@ -9,6 +9,7 @@ FEATURES:=squashfs nand fpu ramdisk
CPU_TYPE:=cortex-a15
CPU_SUBTYPE:=neon-vfpv4
MAINTAINER:=John Crispin <john@phrozen.org>
SUBTARGETS:=generic
KERNEL_PATCHVER:=5.4
KERNEL_TESTING_PATCHVER:=5.10

View File

@ -0,0 +1 @@
BOARDNAME:=Generic

View File

@ -26,7 +26,7 @@ all: compile
TOOLCHAIN_PREFIX:=$(TOOLCHAIN_BUILD_DIR)/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX)
$(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2: clean
$(BIN_DIR)/$(TOOLCHAIN_NAME).tar.xz: clean
mkdir -p $(TOOLCHAIN_BUILD_DIR)
$(TAR) -cf - -C $(TOPDIR)/staging_dir/ \
$(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \
@ -59,13 +59,14 @@ $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2: clean
find $(TOOLCHAIN_BUILD_DIR) -name CVS | $(XARGS) rm -rf
mkdir -p $(BIN_DIR)
(cd $(BUILD_DIR); \
tar cfj $@ $(TOOLCHAIN_NAME); \
tar -I '$(STAGING_DIR_HOST)/bin/xz -7e -T$(if $(filter 1,$(NPROC)),2,0)' -cf $@ $(TOOLCHAIN_NAME) \
--mtime="$(shell date --date=@$(SOURCE_DATE_EPOCH))"; \
)
download:
prepare:
compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2
compile: $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.xz
install: compile
clean:
rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.bz2
rm -rf $(TOOLCHAIN_BUILD_DIR) $(BIN_DIR)/$(TOOLCHAIN_NAME).tar.xz

View File

@ -37,6 +37,13 @@ menuconfig TARGET_OPTIONS
Most people will answer N.
config BUILD_LLVM_BPF
bool "Build LLVM toolchain for eBPF" if DEVEL
help
If enabled, a LLVM toolchain for building eBPF binaries will be built.
If this is not enabled, eBPF packages can only be built if the host
has a suitable toolchain
menuconfig EXTERNAL_TOOLCHAIN
bool

View File

@ -0,0 +1,201 @@
From 1c611b40e6bfc8029bff7696814330b5bc0ee5c0 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 26 Jul 2021 05:59:55 -0700
Subject: [PATCH] bfd: Close the file descriptor if there is no archive fd
Close the file descriptor if there is no archive plugin file descriptor
to avoid running out of file descriptors on thin archives with many
archive members.
bfd/
PR ld/28138
* plugin.c (bfd_plugin_close_file_descriptor): Close the file
descriptor there is no archive plugin file descriptor.
ld/
PR ld/28138
* testsuite/ld-plugin/lto.exp: Run tmpdir/pr28138 only for
native build.
PR ld/28138
* testsuite/ld-plugin/lto.exp: Run ld/28138 tests.
* testsuite/ld-plugin/pr28138.c: New file.
* testsuite/ld-plugin/pr28138-1.c: Likewise.
* testsuite/ld-plugin/pr28138-2.c: Likewise.
* testsuite/ld-plugin/pr28138-3.c: Likewise.
* testsuite/ld-plugin/pr28138-4.c: Likewise.
* testsuite/ld-plugin/pr28138-5.c: Likewise.
* testsuite/ld-plugin/pr28138-6.c: Likewise.
* testsuite/ld-plugin/pr28138-7.c: Likewise.
(cherry picked from commit 5a98fb7513b559e20dfebdbaa2a471afda3b4742)
(cherry picked from commit 7dc37e1e1209c80e0bab784df6b6bac335e836f2)
---
bfd/plugin.c | 8 +++++++
ld/testsuite/ld-plugin/lto.exp | 34 ++++++++++++++++++++++++++++++
ld/testsuite/ld-plugin/pr28138-1.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138-2.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138-3.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138-4.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138-5.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138-6.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138-7.c | 6 ++++++
ld/testsuite/ld-plugin/pr28138.c | 20 ++++++++++++++++++
10 files changed, 104 insertions(+)
create mode 100644 ld/testsuite/ld-plugin/pr28138-1.c
create mode 100644 ld/testsuite/ld-plugin/pr28138-2.c
create mode 100644 ld/testsuite/ld-plugin/pr28138-3.c
create mode 100644 ld/testsuite/ld-plugin/pr28138-4.c
create mode 100644 ld/testsuite/ld-plugin/pr28138-5.c
create mode 100644 ld/testsuite/ld-plugin/pr28138-6.c
create mode 100644 ld/testsuite/ld-plugin/pr28138-7.c
create mode 100644 ld/testsuite/ld-plugin/pr28138.c
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -291,6 +291,14 @@ bfd_plugin_close_file_descriptor (bfd *a
&& !bfd_is_thin_archive (abfd->my_archive))
abfd = abfd->my_archive;
+ /* Close the file descriptor if there is no archive plugin file
+ descriptor. */
+ if (abfd->archive_plugin_fd == -1)
+ {
+ close (fd);
+ return;
+ }
+
abfd->archive_plugin_fd_open_count--;
/* Dup the archive plugin file descriptor for later use, which
will be closed by _bfd_archive_close_and_cleanup. */
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -687,6 +687,40 @@ if { [is_elf_format] && [check_lto_share
}
}
+run_cc_link_tests [list \
+ [list \
+ "Build pr28138.a" \
+ "-T" "" \
+ {pr28138-1.c pr28138-2.c pr28138-3.c pr28138-4.c pr28138-5.c \
+ pr28138-6.c pr28138-7.c} {} "pr28138.a" \
+ ] \
+ [list \
+ "Build pr28138.o" \
+ "" "" \
+ {pr28138.c} {} \
+ ] \
+]
+
+set exec_output [run_host_cmd "sh" \
+ "-c \"ulimit -n 20; \
+ $CC -Btmpdir/ld -o tmpdir/pr28138 \
+ tmpdir/pr28138.o tmpdir/pr28138.a\""]
+set exec_output [prune_warnings $exec_output]
+if [string match "" $exec_output] then {
+ if { [isnative] } {
+ set exec_output [run_host_cmd "tmpdir/pr28138" ""]
+ if [string match "PASS" $exec_output] then {
+ pass "PR ld/28138"
+ } else {
+ fail "PR ld/28138"
+ }
+ } else {
+ pass "PR ld/28138"
+ }
+} else {
+ fail "PR ld/28138"
+}
+
set testname "Build liblto-11.a"
remote_file host delete "tmpdir/liblto-11.a"
set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-1.c
@@ -0,0 +1,6 @@
+extern int a0(void);
+int
+a1(void)
+{
+ return 1 + a0();
+}
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-2.c
@@ -0,0 +1,6 @@
+extern int a1(void);
+int
+a2(void)
+{
+ return 1 + a1();
+}
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-3.c
@@ -0,0 +1,6 @@
+extern int a2(void);
+int
+a3(void)
+{
+ return 1 + a2();
+}
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-4.c
@@ -0,0 +1,6 @@
+extern int a3(void);
+int
+a4(void)
+{
+ return 1 + a3();
+}
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-5.c
@@ -0,0 +1,6 @@
+extern int a4(void);
+int
+a5(void)
+{
+ return 1 + a4();
+}
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-6.c
@@ -0,0 +1,6 @@
+extern int a5(void);
+int
+a6(void)
+{
+ return 1 + a5();
+}
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138-7.c
@@ -0,0 +1,6 @@
+extern int a6(void);
+int
+a7(void)
+{
+ return 1 + a6();
+}
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr28138.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+extern int a7(void);
+
+int
+a0(void)
+{
+ return 0;
+}
+
+int
+main()
+{
+ if (a7() == 7)
+ {
+ printf ("PASS\n");
+ return 0;
+ }
+ return 1;
+}

View File

@ -36,6 +36,7 @@ tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2
tools-$(CONFIG_TARGET_tegra) += cbootimage cbootimage-configs
tools-$(CONFIG_USES_MINOR) += kernel2minor
tools-$(CONFIG_USE_SPARSE) += sparse
tools-$(CONFIG_BUILD_LLVM_BPF) += llvm-bpf
# builddir dependencies
$(curdir)/autoconf/compile := $(curdir)/m4/compile
@ -57,6 +58,7 @@ $(curdir)/isl/compile := $(curdir)/gmp/compile
$(curdir)/libressl/compile := $(curdir)/pkgconf/compile
$(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile
$(curdir)/lzma-old/compile := $(curdir)/zlib/compile
$(curdir)/llvm-bpf/compile := $(curdir)/cmake/compile
$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
$(curdir)/meson/compile := $(curdir)/ninja/compile
$(curdir)/missing-macros/compile := $(curdir)/autoconf/compile

View File

@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/target.mk
PKG_NAME:=ccache
PKG_VERSION:=4.3
PKG_VERSION:=4.4.2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/ccache/ccache/releases/download/v$(PKG_VERSION)
PKG_HASH:=504a0f2184465c306826f035b4bc00bae7500308d6af4abbfb50e33a694989b4
PKG_HASH:=9200cafbaa5fd62c2600fccb40a18214e57747825e6cdcd76688b4b61c2dcba0
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/cmake.mk
@ -22,6 +22,7 @@ CMAKE_HOST_OPTIONS += \
-DCMAKE_CXX_COMPILER_LAUNCHER="" \
-DCMAKE_SKIP_RPATH=FALSE \
-DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOST}/lib" \
-DREDIS_STORAGE_BACKEND=OFF
ifneq (docs-$(CONFIG_BUILD_DOCUMENTATION),docs-y)
CMAKE_HOST_OPTIONS += -DENABLE_DOCUMENTATION=OFF

View File

@ -1,6 +1,6 @@
--- a/src/ccache.cpp
+++ b/src/ccache.cpp
@@ -1756,6 +1756,7 @@ calculate_result_name(Context& ctx,
@@ -1633,6 +1633,7 @@ calculate_result_and_manifest_key(Contex
"CPLUS_INCLUDE_PATH",
"OBJC_INCLUDE_PATH",
"OBJCPLUS_INCLUDE_PATH", // clang

View File

@ -19,7 +19,8 @@ include $(INCLUDE_DIR)/host-build.mk
HOST_CONFIGURE_VARS += \
ac_cv_header_sys_capability_h=no \
ac_cv_func_capset=no
ac_cv_func_capset=no \
CPP="$(HOSTCC) -E"
HOST_CONFIGURE_ARGS += \
--with-ipc=tcp

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=isl
PKG_VERSION:=0.24
PKG_SOURCE_URL:=http://isl.gforge.inria.fr
PKG_SOURCE_URL:=https://libisl.sourceforge.io/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_HASH:=043105cc544f416b48736fff8caf077fb0663a717d06b1113f16e391ac99ebad

36
tools/llvm-bpf/Makefile Normal file
View File

@ -0,0 +1,36 @@
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=llvm-project
PKG_VERSION:=13.0.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz
PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION)
PKG_HASH:=6075ad30f1ac0e15f07c1bf062c1e1268c241d674f11bd32cdf0e040c71f2bf3
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION).src
HOST_BUILD_PARALLEL:=1
CMAKE_BINARY_SUBDIR := build
CMAKE_SOURCE_SUBDIR := llvm
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/cmake.mk
CMAKE_HOST_OPTIONS += \
-DLLVM_ENABLE_BINDINGS=OFF \
-DLLVM_INCLUDE_DOCS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_TARGETS_TO_BUILD=BPF \
-DCLANG_BUILD_EXAMPLES=OFF
$(eval $(call HostBuild))

View File

@ -21,7 +21,7 @@ endef
define Host/Install
$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
$(HOST_BUILD_DIR)/packaging/create_zipapp.py $(HOST_BUILD_DIR) --interpreter $(STAGING_DIR_HOST)/bin/$(PYTHON) --outfile $(STAGING_DIR_HOST)/bin/meson
$(HOST_BUILD_DIR)/packaging/create_zipapp.py $(HOST_BUILD_DIR) --outfile $(STAGING_DIR_HOST)/bin/meson
$(INSTALL_DIR) $(STAGING_DIR_HOST)/lib/meson
$(INSTALL_CONF) files/openwrt-cross.txt.in $(STAGING_DIR_HOST)/lib/meson/
$(INSTALL_CONF) files/openwrt-native.txt.in $(STAGING_DIR_HOST)/lib/meson/