From 2a66328a3e6ba10875665248465773411e22aeea Mon Sep 17 00:00:00 2001 From: sbwml Date: Sat, 8 Apr 2023 17:11:10 +0800 Subject: [PATCH] archive 2023-04-08 --- openwrt/22-config-musl-r5s | 33 -------------- openwrt/build.sh | 4 +- openwrt/patch/rtc/sysfixtime | 49 +++++++++++++++++++++ openwrt/scripts/01-prepare_base-mainline.sh | 9 ++-- 4 files changed, 56 insertions(+), 39 deletions(-) create mode 100644 openwrt/patch/rtc/sysfixtime diff --git a/openwrt/22-config-musl-r5s b/openwrt/22-config-musl-r5s index beba8b4b8..8a7f1a3bc 100644 --- a/openwrt/22-config-musl-r5s +++ b/openwrt/22-config-musl-r5s @@ -215,41 +215,8 @@ CONFIG_PACKAGE_rtl8822be-firmware=m CONFIG_PACKAGE_rtl8822ce-firmware=m # intel firmware -CONFIG_PACKAGE_e100-firmware=m -CONFIG_PACKAGE_ibt-firmware=m -CONFIG_PACKAGE_iwl3945-firmware=m -CONFIG_PACKAGE_iwl4965-firmware=m CONFIG_PACKAGE_iwlwifi-firmware-ax200=y CONFIG_PACKAGE_iwlwifi-firmware-ax210=y -CONFIG_PACKAGE_iwlwifi-firmware-iwl1000=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl100=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl105=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl135=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl2000=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl2030=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl3160=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl3168=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl5000=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl5150=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl6000g2=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl6000g2a=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl6000g2b=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl6050=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl7260=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl7265=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl7265d=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl8260c=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl8265=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl9000=m -CONFIG_PACKAGE_iwlwifi-firmware-iwl9260=m - -# iw/iwinfo -CONFIG_PACKAGE_iw=m -CONFIG_PACKAGE_iw-full=m -CONFIG_PACKAGE_iwinfo=m -CONFIG_PACKAGE_libiwinfo=m -CONFIG_PACKAGE_libiwinfo-data=m -CONFIG_PACKAGE_libiwinfo-lua=m ### Kernel driver CONFIG_PACKAGE_kmod-iwlwifi=y diff --git a/openwrt/build.sh b/openwrt/build.sh index 0afc6f3c2..47665374e 100644 --- a/openwrt/build.sh +++ b/openwrt/build.sh @@ -291,8 +291,6 @@ else rm -f $kmodpkg_name/Packages* # driver firmware cp -a bin/packages/aarch64_generic/base/*firmware*.ipk $kmodpkg_name/ - cp -a bin/packages/aarch64_generic/base/*iwinfo*.ipk $kmodpkg_name/ - \cp -a bin/packages/aarch64_generic/base/iw*.ipk $kmodpkg_name/ bash kmod-sign $kmodpkg_name tar zcf kmod-$kmodpkg_name.tar.gz $kmodpkg_name rm -rf $kmodpkg_name @@ -315,7 +313,7 @@ else # Backup download cache if [ "$isCN" = "CN" ] && [ "$1" = "stable" ] || [ "$1" = "rc" ]; then rm -rf dl/xray* dl/trojan* dl/v2ray* dl/adguardhome* dl/alist* dl/qbittorrent* dl/geo* dl/go-mod-cache - tar cf ../dl.gz dl + tar -cf ../dl.gz dl fi exit 0 else diff --git a/openwrt/patch/rtc/sysfixtime b/openwrt/patch/rtc/sysfixtime new file mode 100644 index 000000000..cfa034a81 --- /dev/null +++ b/openwrt/patch/rtc/sysfixtime @@ -0,0 +1,49 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2013-2014 OpenWrt.org + +START=00 +STOP=90 + +HWCLOCK=/sbin/hwclock + +if [ -e "/dev/rtc1" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -f /dev/rtc1 >/dev/null 2>&1; then + RTC_DEV=/dev/rtc1 +else + RTC_DEV=/dev/rtc0 +fi + +boot() { + hwclock_load + local maxtime="$(find_max_time)" + local curtime="$(date +%s)" + if [ $curtime -lt $maxtime ]; then + date -s @$maxtime + hwclock_save + fi +} + +start() { + hwclock_load +} + +stop() { + hwclock_save +} + +hwclock_load() { + [ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -s -u -f $RTC_DEV +} + +hwclock_save(){ + [ -e "$RTC_DEV" ] && [ -e "$HWCLOCK" ] && $HWCLOCK -w -u -f $RTC_DEV && \ + logger -t sysfixtime "saved '$(date)' to $RTC_DEV" +} + +find_max_time() { + local file newest + + for file in $( find /etc -type f ) ; do + [ -z "$newest" -o "$newest" -ot "$file" ] && newest=$file + done + [ "$newest" ] && date -r "$newest" +%s +} diff --git a/openwrt/scripts/01-prepare_base-mainline.sh b/openwrt/scripts/01-prepare_base-mainline.sh index 12f0521a1..fcf88d231 100644 --- a/openwrt/scripts/01-prepare_base-mainline.sh +++ b/openwrt/scripts/01-prepare_base-mainline.sh @@ -17,9 +17,6 @@ curl -s https://$mirror/openwrt/patch/KBUILD_BUILD_TIMESTAMP.patch | patch -p1 git clone https://github.com/sbwml/target_linux_generic mv target_linux_generic/target/linux/generic/* target/linux/generic/ sed -i '/CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE/d' target/linux/generic/config-6.1 target/linux/generic/config-6.3 -if [ "$soc" = "rk3399" ] || [ "$soc" = "rk3568" ] || [ "$soc" = "r5s" ]; then - sed -i 's/rtc0/rtc1/g' target/linux/generic/config-6.1 target/linux/generic/config-6.3 -fi rm -rf target_linux_generic # kernel modules @@ -162,6 +159,12 @@ curl -s https://$mirror/openwrt/patch/openwrt-6.1/fix-linux-6.3/cryptodev-linux/ # gpio-button-hotplug - fix linux 6.3 curl -s https://$mirror/openwrt/patch/openwrt-6.1/fix-linux-6.3/v6.3-fix-gpio-button-hotplug.patch | patch -p1 +# RTC +if [ "$soc" = "rk3399" ] || [ "$soc" = "rk3568" ] || [ "$soc" = "r5s" ]; then + curl -s https://$mirror/openwrt/patch/rtc/sysfixtime > package/base-files/files/etc/init.d/sysfixtime + chmod 755 package/base-files/files/etc/init.d/sysfixtime +fi + # ksmbd luci rm -rf feeds/luci/applications/luci-app-ksmbd cp -a ../master/luci/applications/luci-app-ksmbd feeds/luci/applications/luci-app-ksmbd