autocore: add loongarch64 target support

This commit is contained in:
coolsnowwolf 2025-11-06 13:50:23 +08:00
parent 3c3f691df9
commit 96e8d60f7f
6 changed files with 59 additions and 4 deletions

View File

@ -321,15 +321,14 @@ menu "Target Images"
depends on USES_BOOT_PART depends on USES_BOOT_PART
default 8 if TARGET_apm821xx_sata default 8 if TARGET_apm821xx_sata
default 128 if TARGET_armsr 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 32 if TARGET_rockchip
default 16 default 16
config TARGET_ROOTFS_PARTSIZE config TARGET_ROOTFS_PARTSIZE
int "Root filesystem partition size (in MiB)" int "Root filesystem partition size (in MiB)"
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS
default 232 if TARGET_loongarch64 default 448 if TARGET_mediatek || TARGET_x86 || TARGET_loongarch64
default 448 if TARGET_mediatek || TARGET_x86
default 160 default 160
help help
Select the root filesystem partition size. Select the root filesystem partition size.

View File

@ -22,6 +22,13 @@ define Package/autocore-arm
VARIANT:=arm VARIANT:=arm
endef 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 define Package/autocore-x86
TITLE:=x86/x64 auto core loadbalance script. TITLE:=x86/x64 auto core loadbalance script.
MAINTAINER:=Lean MAINTAINER:=Lean
@ -33,6 +40,10 @@ define Package/autocore-arm/description
A luci autoconfig hotplug script. A luci autoconfig hotplug script.
endef endef
define Package/autocore-loongarch64/description
A luci autoconfig hotplug script.
endef
define Package/autocore-x86/description define Package/autocore-x86/description
A usb autoconfig hotplug script. A usb autoconfig hotplug script.
endef endef
@ -57,6 +68,17 @@ endif
$(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/ $(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
endef 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 define Package/autocore-x86/install
$(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/autocore $(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/autocore
@ -71,4 +93,5 @@ define Package/autocore-x86/install
endef endef
$(eval $(call BuildPackage,autocore-arm)) $(eval $(call BuildPackage,autocore-arm))
$(eval $(call BuildPackage,autocore-loongarch64))
$(eval $(call BuildPackage,autocore-x86)) $(eval $(call BuildPackage,autocore-x86))

View File

@ -0,0 +1,20 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2025 lean <coolsnowwolf@gmail.com>
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
}

View File

@ -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 "

View File

@ -0,0 +1,5 @@
#!/bin/sh
TEMP=`awk '{printf("%.1f¡ãC", $0 / 1000)}' "/sys/class/thermal/thermal_zone0/temp" 2>"/dev/null"`
echo "$TEMP "

View File

@ -18,6 +18,7 @@ KERNELNAME:=vmlinuz.efi dtbs
include $(INCLUDE_DIR)/target.mk include $(INCLUDE_DIR)/target.mk
DEFAULT_PACKAGES += \ 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)) $(eval $(call BuildTarget))