From ed8b277f276f122161019542ae278307bb267a52 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Wed, 5 May 2021 17:24:17 +0800 Subject: [PATCH 1/8] Revert "kernel: video: add multimedia-input driver" However, this commit still has some issues. --- package/kernel/linux/modules/video.mk | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index 65d1ed877e..9acc19d470 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -221,24 +221,6 @@ endef $(eval $(call KernelPackage,fb-tft-ili9486)) -define KernelPackage/multimedia-input - SUBMENU:=$(VIDEO_MENU) - TITLE:=Multimedia input support - KCONFIG:=CONFIG_RC_CORE \ - CONFIG_LIRC=y \ - CONFIG_RC_DECODERS=y \ - CONFIG_RC_DEVICES=y - FILES:=$(LINUX_DIR)/drivers/media/rc/rc-core.ko - AUTOLOAD:=$(call AutoProbe,rc-core) -endef - -define KernelPackage/multimedia-input/description - Enable multimedia input. -endef - -$(eval $(call KernelPackage,multimedia-input)) - - define KernelPackage/drm SUBMENU:=$(VIDEO_MENU) TITLE:=Direct Rendering Manager (DRM) support From 40172238214a94e725a1c6900ef44ea11cc8b989 Mon Sep 17 00:00:00 2001 From: Sven Roederer Date: Fri, 7 May 2021 21:35:20 +0200 Subject: [PATCH 2/8] imagebuilder: unset BINARY_FOLDER and DOWNLOAD_FOLDER in final archive Using these config-options to customize the folders used at build-time makes these folder settings appear in generated archive. This causes the imagebuilder to be not portable, as it's going to use the build-time folders on the new systems. Errors look like: mkdir: cannot create directory '/mnt/build': Permission denied Makefile:116: recipe for target '_call_image' failed make[2]: *** [_call_image] Error 1 Makefile:241: recipe for target 'image' failed make[1]: *** [image] Error 2 The build-time settings of these folders are passed into the archives via .config file. The expected behavior is that after unpacking the imagebuilder acts like these settings have their defaults, using intree folders. So unset the build-time settings. Signed-off-by: Sven Roederer --- target/imagebuilder/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile index 7e117dd8fe..499a64e339 100644 --- a/target/imagebuilder/Makefile +++ b/target/imagebuilder/Makefile @@ -29,6 +29,8 @@ $(BIN_DIR)/$(IB_NAME).tar.xz: clean mkdir -p $(IB_KDIR) $(IB_LDIR) $(PKG_BUILD_DIR)/staging_dir/host/lib \ $(PKG_BUILD_DIR)/target $(PKG_BUILD_DIR)/scripts $(IB_DTSDIR) -cp $(TOPDIR)/.config $(PKG_BUILD_DIR)/.config + $(SED) 's/^CONFIG_BINARY_FOLDER=.*/# CONFIG_BINARY_FOLDER is not set/' $(PKG_BUILD_DIR)/.config + $(SED) 's/^CONFIG_DOWNLOAD_FOLDER=.*/# CONFIG_DOWNLOAD_FOLDER is not set/' $(PKG_BUILD_DIR)/.config $(CP) -L \ $(INCLUDE_DIR) $(SCRIPT_DIR) \ $(TOPDIR)/rules.mk \ From 751fe7ed5b57eff4093eb03b8ff600ee04bce610 Mon Sep 17 00:00:00 2001 From: Sven Roederer Date: Fri, 7 May 2021 21:35:21 +0200 Subject: [PATCH 3/8] sdk: unset BINARY_FOLDER and DOWNLOAD_FOLDER in final archives Using these config-options to customize the folders used at build-time makes these folder settings appear in generated archive. This causes the SDK to be not portable, as it's going to use the build-time folders on the new systems. The errors vary from passing the build, disk out-of-space to permission denied. The build-time settings of these folders are passed into the archive via Config.build. The expected behavior is that the SDK acts after unpacking like these settings have their defaults, using intree folders. So just filter these folders out when running convert-config.pl to create Config.build. This addresses the same issue that's fixed in the previous commit for the imagebuilder. Signed-off-by: Sven Roederer --- target/sdk/convert-config.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target/sdk/convert-config.pl b/target/sdk/convert-config.pl index f73744af09..08189df95c 100755 --- a/target/sdk/convert-config.pl +++ b/target/sdk/convert-config.pl @@ -9,7 +9,13 @@ while (<>) { chomp; next if /^CONFIG_SIGNED_PACKAGES/; - if (/^CONFIG_([^=]+)=(.*)$/) { + if (/^CONFIG_((BINARY)|(DOWNLOAD))_FOLDER=(.*)$/) { + # We don't want to preserve the build setting of + # BINARY_FOLDER and DOWNLOAD_FOLDER. + $var = "$1_FOLDER"; + $val = '""'; + $type = "string"; + } elsif (/^CONFIG_([^=]+)=(.*)$/) { $var = $1; $val = $2; From 942f1d2aed7794ee003ba474153be4fa9ee9ac61 Mon Sep 17 00:00:00 2001 From: Thomas Richard Date: Tue, 20 Apr 2021 16:49:02 +0200 Subject: [PATCH 4/8] uqmi: fix network registration loop With some debug in qmi.sh using following patch, some errors are visible in the registration step @@ -29,6 +29,7 @@ proto_qmi_init_config() { } proto_qmi_setup() { + set -x local interface="$1" local dataformat connstat plmn_mode mcc mnc local device apn auth username password pincode delay modes pdptype @@ -224,6 +225,8 @@ proto_qmi_setup() { fi done + registration=$(uqmi -s -d "$device" --get-serving-system) + [ -n "$modes" ] && uqmi -s -d "$device" --set-network-modes "$modes" > /dev/null 2>&1 echo "Starting network $interface" During the boot of the system, modem could not start automatically its network registration. netifd: wan (9235): + echo 'Waiting for network registration' netifd: wan (9235): Waiting for network registration netifd: wan (9235): + local 'registration_timeout=0' netifd: wan (9235): + uqmi -s -d /dev/cdc-wdm1 --get-serving-system netifd: wan (9235): + grep '"searching"' netifd: wan (9235): + uqmi -s -d /dev/cdc-wdm1 --get-serving-system netifd: wan (9235): + registration='{"registration":"not_registered","plmn_mcc":208,"plmn_mnc":20,"plmn_description":"","roaming":true}' netifd: wan (9235): + '[' -n ] netifd: wan (9235): + echo 'Starting network wan' As the while loop checks only "searching" pattern, uqmi.sh script quits searching loop and continues whereas the modem is not registered Other issue, after X seconds modem stops searching. netifd: wan (9213): + uqmi -s -d /dev/cdc-wdm0 --get-serving-system netifd: wan (9213): + grep '"searching"' netifd: wan (9213): + '[' -e /dev/cdc-wdm0 ] netifd: wan (9213): + '[' 3 -lt 0 -o 0 '=' 0 ] netifd: wan (9213): + let registration_timeout++ netifd: wan (9213): + sleep 1 netifd: wan (9213): + uqmi -s -d /dev/cdc-wdm0 --get-serving-system netifd: wan (9213): + grep '"searching"' netifd: wan (9213): + uqmi -s -d /dev/cdc-wdm0 --get-serving-system netifd: wan (9213): + registration='{"registration":"not_registered"}' netifd: wan (9213): + '[' -n ] netifd: wan (9213): + echo 'Starting network wan' netifd: wan (9213): Starting network wan If registration_timeout is not expired, registration can be restarted Signed-off-by: Thomas Richard Tested-by: Florian Eckert --- package/network/utils/uqmi/Makefile | 2 +- .../utils/uqmi/files/lib/netifd/proto/qmi.sh | 35 ++++++++++++++----- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/package/network/utils/uqmi/Makefile b/package/network/utils/uqmi/Makefile index c892c3f8e8..68958a3729 100644 --- a/package/network/utils/uqmi/Makefile +++ b/package/network/utils/uqmi/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uqmi -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uqmi.git diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh index 13a4fc9611..762076dde7 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -195,19 +195,36 @@ proto_qmi_setup() { uqmi -s -d "$device" --sync > /dev/null 2>&1 + uqmi -s -d "$device" --network-register > /dev/null 2>&1 + echo "Waiting for network registration" + sleep 1 local registration_timeout=0 - while uqmi -s -d "$device" --get-serving-system | grep '"searching"' > /dev/null; do - [ -e "$device" ] || return 1 - if [ "$registration_timeout" -lt "$timeout" -o "$timeout" = "0" ]; then - let registration_timeout++ - sleep 1; + local registration_state="" + while true; do + registration_state=$(uqmi -s -d "$device" --get-serving-system 2>/dev/null | jsonfilter -e "@.registration" 2>/dev/null) + + [ "$registration_state" = "registered" ] && break + + if [ "$registration_state" = "searching" ] || [ "$registration_state" = "not_registered" ]; then + if [ "$registration_timeout" -lt "$timeout" ] || [ "$timeout" = "0" ]; then + [ "$registration_state" = "searching" ] || { + echo "Device stopped network registration. Restart network registration" + uqmi -s -d "$device" --network-register > /dev/null 2>&1 + } + let registration_timeout++ + sleep 1 + continue + fi + echo "Network registration failed, registration timeout reached" else - echo "Network registration failed" - proto_notify_error "$interface" NETWORK_REGISTRATION_FAILED - proto_block_restart "$interface" - return 1 + # registration_state is 'registration_denied' or 'unknown' or '' + echo "Network registration failed (reason: '$registration_state')" fi + + proto_notify_error "$interface" NETWORK_REGISTRATION_FAILED + proto_block_restart "$interface" + return 1 done [ -n "$modes" ] && uqmi -s -d "$device" --set-network-modes "$modes" > /dev/null 2>&1 From 0c2eccb0b26842c2557194015cbf8ef1a1d8289b Mon Sep 17 00:00:00 2001 From: Bas Mevissen Date: Tue, 20 Apr 2021 01:08:19 +0200 Subject: [PATCH 5/8] Extend checks on build prerequisites for building OpenWRT core OpenWRT requires a number of Perl modules to be installed. It wasn't checking on all of them. This patch adds checks for Perl FindBin, File::Copy, File::Compare and Thread::Queue modules. Failing to install these, will have the build break at some point. By adding these to the prereq-build.mk script, they are checked on forehand. Tested on a Fedora 33 and 34 (beta) that was freshly installed. Fedora appears to break up Perl modules into small packages that need to be installed for the build to succeed. Signed-off-by: Bas Mevissen --- include/prereq-build.mk | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 323e3ba1e6..cff31526d5 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -65,11 +65,22 @@ $(eval $(call TestHostCommand,perl-data-dumper, \ Please install the Perl Data::Dumper module, \ perl -MData::Dumper -e 1)) +$(eval $(call TestHostCommand,perl-findbin, \ + Please install the Perl FindBin module, \ + perl -MFindBin -e 1)) + +$(eval $(call TestHostCommand,perl-file-copy, \ + Please install the Perl File::Copy module, \ + perl -MFile::Copy -e 1)) + +$(eval $(call TestHostCommand,perl-file-compare, \ + Please install the Perl File::Compare module, \ + perl -MFile::Compare -e 1)) + $(eval $(call TestHostCommand,perl-thread-queue, \ Please install the Perl Thread::Queue module, \ perl -MThread::Queue -e 1)) - $(eval $(call SetupHostCommand,tar,Please install GNU 'tar', \ gtar --version 2>&1 | grep GNU, \ gnutar --version 2>&1 | grep GNU, \ From 6a3f101bc000257301d7d8651867c31f1de756ad Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sun, 9 May 2021 20:01:58 +0800 Subject: [PATCH 6/8] kernel: sysctl: increase max conns limit to 65536 Signed-off-by: Tianling Shen --- package/kernel/linux/files/sysctl-nf-conntrack.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/files/sysctl-nf-conntrack.conf b/package/kernel/linux/files/sysctl-nf-conntrack.conf index 2af8cfb8cb..c962257997 100644 --- a/package/kernel/linux/files/sysctl-nf-conntrack.conf +++ b/package/kernel/linux/files/sysctl-nf-conntrack.conf @@ -3,7 +3,7 @@ net.netfilter.nf_conntrack_acct=1 net.netfilter.nf_conntrack_checksum=0 -net.netfilter.nf_conntrack_max=65535 +net.netfilter.nf_conntrack_max=65536 net.netfilter.nf_conntrack_tcp_timeout_established=7440 net.netfilter.nf_conntrack_udp_timeout=60 net.netfilter.nf_conntrack_udp_timeout_stream=180 From ff599c9d56f08f688f0e6c9c89b28afd15ac6727 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sun, 9 May 2021 21:47:56 +0800 Subject: [PATCH 7/8] luci-app-cpufreq: add default tweak for firstboot Signed-off-by: Tianling Shen --- package/lean/luci-app-cpufreq/Makefile | 9 +++--- .../luasrc/model/cbi/cpufreq.lua | 15 ++++----- .../lean/luci-app-cpufreq/po/zh-cn/cpufreq.po | 12 +++---- .../luci-app-cpufreq/root/etc/init.d/cpufreq | 2 +- .../root/etc/uci-defaults/cpufreq | 32 +++++++++++++++++++ 5 files changed, 50 insertions(+), 20 deletions(-) diff --git a/package/lean/luci-app-cpufreq/Makefile b/package/lean/luci-app-cpufreq/Makefile index f7a1440565..b85e91d22f 100644 --- a/package/lean/luci-app-cpufreq/Makefile +++ b/package/lean/luci-app-cpufreq/Makefile @@ -1,16 +1,15 @@ - -# Copyright (C) 2016 Openwrt.org -# -# This is free software, licensed under the Apache License, Version 2.0 . +# SPDX-License-Identifier: GPL-3.0-only # +# Copyright (C) 2021 ImmortalWrt.org include $(TOPDIR)/rules.mk LUCI_TITLE:=LuCI for CPU Freq Setting LUCI_DEPENDS:=@(arm||aarch64) + PKG_NAME:=luci-app-cpufreq PKG_VERSION:=1 -PKG_RELEASE:=6 +PKG_RELEASE:=$(COMMITCOUNT) include $(TOPDIR)/feeds/luci/luci.mk diff --git a/package/lean/luci-app-cpufreq/luasrc/model/cbi/cpufreq.lua b/package/lean/luci-app-cpufreq/luasrc/model/cbi/cpufreq.lua index bee3b6006c..2b12a4db45 100644 --- a/package/lean/luci-app-cpufreq/luasrc/model/cbi/cpufreq.lua +++ b/package/lean/luci-app-cpufreq/luasrc/model/cbi/cpufreq.lua @@ -50,20 +50,19 @@ for _, policy_num in ipairs(string.split(policy_nums, " ")) do if e ~= "" then maxfreq:value(e) end end + sdfactor = s:taboption(policy_num, Value, "sdfactor" .. policy_num, translate("CPU Switching Sampling rate")) + sdfactor.datatype="range(1,100000)" + sdfactor.description = translate("The sampling rate determines how frequently the governor checks to tune the CPU (ms)") + sdfactor.placeholder = 10 + sdfactor.default = 10 + sdfactor:depends("governor", "ondemand") + upthreshold = s:taboption(policy_num, Value, "upthreshold" .. policy_num, translate("CPU Switching Threshold")) upthreshold.datatype="range(1,99)" upthreshold.description = translate("Kernel make a decision on whether it should increase the frequency (%)") upthreshold.placeholder = 50 upthreshold.default = 50 upthreshold:depends("governor", "ondemand") - - factor = s:taboption(policy_num, Value, "factor" .. policy_num, translate("CPU Switching Sampling rate")) - factor.datatype="range(1,100000)" - factor.description = translate("The sampling rate determines how frequently the governor checks to tune the CPU (ms)") - factor.placeholder = 10 - factor.default = 10 - factor:depends("governor", "ondemand") - end return mp diff --git a/package/lean/luci-app-cpufreq/po/zh-cn/cpufreq.po b/package/lean/luci-app-cpufreq/po/zh-cn/cpufreq.po index c476b7a999..b0688abae8 100644 --- a/package/lean/luci-app-cpufreq/po/zh-cn/cpufreq.po +++ b/package/lean/luci-app-cpufreq/po/zh-cn/cpufreq.po @@ -32,14 +32,14 @@ msgstr "待机 CPU 最小频率" msgid "Max Turbo Boost CPU Freq" msgstr "最大 Turbo Boost CPU 频率" -msgid "CPU Switching Threshold" -msgstr "CPU 切换频率触发阈值" - -msgid "Kernel make a decision on whether it should increase the frequency (%)" -msgstr "当 CPU 占用率超过 (%) 的情况下触发内核切换频率" - msgid "CPU Switching Sampling rate" msgstr "CPU 切换周期" msgid "The sampling rate determines how frequently the governor checks to tune the CPU (ms)" msgstr "CPU 检查切换的周期 (ms)。注意:过于频繁的切换频率会引起网络延迟抖动" + +msgid "CPU Switching Threshold" +msgstr "CPU 切换频率触发阈值" + +msgid "Kernel make a decision on whether it should increase the frequency (%)" +msgstr "当 CPU 占用率超过 (%) 的情况下触发内核切换频率" diff --git a/package/lean/luci-app-cpufreq/root/etc/init.d/cpufreq b/package/lean/luci-app-cpufreq/root/etc/init.d/cpufreq index 2df64d10a2..3da3089bd6 100755 --- a/package/lean/luci-app-cpufreq/root/etc/init.d/cpufreq +++ b/package/lean/luci-app-cpufreq/root/etc/init.d/cpufreq @@ -20,8 +20,8 @@ start() config_get_cpufreq "minfreq$i" > "/sys/devices/system/cpu/cpufreq/policy$i/scaling_min_freq" config_get_cpufreq "maxfreq$i" > "/sys/devices/system/cpu/cpufreq/policy$i/scaling_max_freq" if [ "$(config_get_cpufreq "governor$i")" = "ondemand" ]; then + config_get_cpufreq "sdfactor$i" > "/sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor" config_get_cpufreq "upthreshold$i" > "/sys/devices/system/cpu/cpufreq/ondemand/up_threshold" - config_get_cpufreq "factor$i" > "/sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor" fi done } diff --git a/package/lean/luci-app-cpufreq/root/etc/uci-defaults/cpufreq b/package/lean/luci-app-cpufreq/root/etc/uci-defaults/cpufreq index 8443be5799..15be1dce4f 100755 --- a/package/lean/luci-app-cpufreq/root/etc/uci-defaults/cpufreq +++ b/package/lean/luci-app-cpufreq/root/etc/uci-defaults/cpufreq @@ -1,5 +1,37 @@ #!/bin/sh +uci_write_config() { + uci set cpufreq.cpufreq.governor$1="$2" + uci set cpufreq.cpufreq.minfreq$1="$3" + uci set cpufreq.cpufreq.maxfreq$1="$4" + [ -n "$5" ] && uci set cpufreq.cpufreq.sdfactor$1="$5" + [ -n "$6" ] && uci set cpufreq.cpufreq.upthreshold$1="$6" + uci commit cpufreq +} + +CPU_POLICYS="$(find '/sys/devices/system/cpu/cpufreq/policy'* -maxdepth 0 | grep -Eo '[0-9]+')" +source "/etc/openwrt_release" +case "$DISTRIB_TARGET" in + "bcm27xx/bcm2710") + uci_write_config 0 ondemand 600000 1200000 10 50 + ;; + "ipq40xx") + uci_write_config 0 ondemand 300000 716000 10 50 + ;; + "ipq806x") + uci_write_config 0 ondemand 600000 716000 10 50 + echo "$CPU_POLICYS" | grep -q "1" && uci_write_config 1 ondemand 600000 716000 10 50 + ;; + "rockchip/armv8") + if echo "$CPU_POLICYS" | grep -q "4"; then + uci_write_config 0 schedutil 600000 1608000 + uci_write_config 4 schedutil 600000 2016000 + else + uci_write_config 0 schedutil 816000 1512000 + fi + ;; +esac + uci -q batch <<-EOF >/dev/null delete ucitrack.@cpufreq[-1] add ucitrack cpufreq From 0c4a35392b60ab0a1913a9408460db342690aa7e Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sun, 9 May 2021 21:56:25 +0800 Subject: [PATCH 8/8] luci-app-cpufreq: enable uci silent mode Signed-off-by: Tianling Shen --- .../luci-app-cpufreq/root/etc/uci-defaults/cpufreq | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package/lean/luci-app-cpufreq/root/etc/uci-defaults/cpufreq b/package/lean/luci-app-cpufreq/root/etc/uci-defaults/cpufreq index 15be1dce4f..520af00799 100755 --- a/package/lean/luci-app-cpufreq/root/etc/uci-defaults/cpufreq +++ b/package/lean/luci-app-cpufreq/root/etc/uci-defaults/cpufreq @@ -1,12 +1,12 @@ #!/bin/sh uci_write_config() { - uci set cpufreq.cpufreq.governor$1="$2" - uci set cpufreq.cpufreq.minfreq$1="$3" - uci set cpufreq.cpufreq.maxfreq$1="$4" - [ -n "$5" ] && uci set cpufreq.cpufreq.sdfactor$1="$5" - [ -n "$6" ] && uci set cpufreq.cpufreq.upthreshold$1="$6" - uci commit cpufreq + uci -q set cpufreq.cpufreq.governor$1="$2" + uci -q set cpufreq.cpufreq.minfreq$1="$3" + uci -q set cpufreq.cpufreq.maxfreq$1="$4" + [ -n "$5" ] && uci -q set cpufreq.cpufreq.sdfactor$1="$5" + [ -n "$6" ] && uci -q set cpufreq.cpufreq.upthreshold$1="$6" + uci -q commit cpufreq } CPU_POLICYS="$(find '/sys/devices/system/cpu/cpufreq/policy'* -maxdepth 0 | grep -Eo '[0-9]+')"