diff --git a/config/Config-images.in b/config/Config-images.in index 66b1d3e4b..6bad2340d 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -321,15 +321,14 @@ menu "Target Images" depends on USES_BOOT_PART default 8 if TARGET_apm821xx_sata default 128 if TARGET_armsr - default 64 if TARGET_bcm27xx + default 64 if TARGET_bcm27xx || TARGET_x86 || TARGET_loongarch64 default 32 if TARGET_rockchip default 16 config TARGET_ROOTFS_PARTSIZE int "Root filesystem partition size (in MiB)" depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS - default 232 if TARGET_loongarch64 - default 448 if TARGET_mediatek || TARGET_x86 + default 448 if TARGET_mediatek || TARGET_x86 || TARGET_loongarch64 default 160 help Select the root filesystem partition size. diff --git a/package/lean/autocore/Makefile b/package/lean/autocore/Makefile index 9bf0ced2b..c5a7f78a6 100644 --- a/package/lean/autocore/Makefile +++ b/package/lean/autocore/Makefile @@ -22,6 +22,13 @@ define Package/autocore-arm VARIANT:=arm endef +define Package/autocore-loongarch64 + TITLE:=Loongarch64 auto core loadbalance script. + MAINTAINER:=LEAN + DEPENDS:=@loongarch64 +bc +ethtool +pciutils + VARIANT:=loongarch64 +endef + define Package/autocore-x86 TITLE:=x86/x64 auto core loadbalance script. MAINTAINER:=Lean @@ -33,6 +40,10 @@ define Package/autocore-arm/description A luci autoconfig hotplug script. endef +define Package/autocore-loongarch64/description + A luci autoconfig hotplug script. +endef + define Package/autocore-x86/description A usb autoconfig hotplug script. endef @@ -57,6 +68,17 @@ endif $(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/ endef +define Package/autocore-autocore-loongarch64/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/60-autocore-reload-rpcd $(1)/etc/uci-defaults/ + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) ./files/arm/sbin/cpuinfo $(1)/sbin/cpuinfo + $(INSTALL_BIN) ./files/arm/sbin/tempinfo $(1)/sbin/tempinfo + $(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d + $(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/ +endef + define Package/autocore-x86/install $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/autocore @@ -71,4 +93,5 @@ define Package/autocore-x86/install endef $(eval $(call BuildPackage,autocore-arm)) +$(eval $(call BuildPackage,autocore-loongarch64)) $(eval $(call BuildPackage,autocore-x86)) diff --git a/package/lean/autocore/files/loongarch64/autocore b/package/lean/autocore/files/loongarch64/autocore new file mode 100755 index 000000000..158f1cec9 --- /dev/null +++ b/package/lean/autocore/files/loongarch64/autocore @@ -0,0 +1,20 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2025 lean + +START=99 + +start() +{ + a=$(cat /proc/cpuinfo | grep 'Model Name' | cut -f2 -d: | head -n 1) + b=$(echo -n ' : ') + c=$(cat /proc/cpuinfo | grep 'core' | sort -u | wc -l) + d=$(echo -n 'C') + e=$(cat /proc/cpuinfo | grep 'global_id' | sort -u | wc -l) + f=$(echo -n 'T ') + g=$(cat /proc/cpuinfo | grep 'CPU Family' | cut -f2 -d: | head -n 1) + + h=${g}' - '${a}${b}${c}${d}${e}${f} + + mkdir -p /tmp/sysinfo + echo $h > /tmp/sysinfo/model +} diff --git a/package/lean/autocore/files/loongarch64/sbin/cpuinfo b/package/lean/autocore/files/loongarch64/sbin/cpuinfo new file mode 100755 index 000000000..10324985c --- /dev/null +++ b/package/lean/autocore/files/loongarch64/sbin/cpuinfo @@ -0,0 +1,7 @@ +#!/bin/sh + +MHz=`grep 'MHz' /proc/cpuinfo | cut -c13- |sed -n '1p'` + +TEMP=`awk '{printf("%.1f¡ãC", $0 / 1000)}' "/sys/class/thermal/thermal_zone0/temp" 2>"/dev/null"` + +echo "$MHz MHz $TEMP " diff --git a/package/lean/autocore/files/loongarch64/sbin/tempinfo b/package/lean/autocore/files/loongarch64/sbin/tempinfo new file mode 100755 index 000000000..e0ca2dc13 --- /dev/null +++ b/package/lean/autocore/files/loongarch64/sbin/tempinfo @@ -0,0 +1,5 @@ +#!/bin/sh + +TEMP=`awk '{printf("%.1f¡ãC", $0 / 1000)}' "/sys/class/thermal/thermal_zone0/temp" 2>"/dev/null"` + +echo "$TEMP " diff --git a/target/linux/loongarch64/Makefile b/target/linux/loongarch64/Makefile index c128c6177..3ecf9d380 100644 --- a/target/linux/loongarch64/Makefile +++ b/target/linux/loongarch64/Makefile @@ -18,6 +18,7 @@ KERNELNAME:=vmlinuz.efi dtbs include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += \ - partx-utils blkid e2fsprogs grub2-efi-loongarch64 kmod-yt6801 + partx-utils blkid e2fsprogs grub2-efi-loongarch64 kmod-yt6801 \ + kmod-fs-ext4 kmod-fs-f2fs losetup mkf2fs f2fsck e2fsprogs autocore-loongarch64 $(eval $(call BuildTarget))