x86_64: 添加 cpuset script
This commit is contained in:
parent
7506d6e671
commit
b06a4464f1
|
@ -0,0 +1,160 @@
|
|||
#!/bin/bash
|
||||
|
||||
get_thread() {
|
||||
cat /proc/cpuinfo 2> /dev/null | grep MHz | wc -l
|
||||
}
|
||||
|
||||
get_governor() {
|
||||
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2> /dev/null
|
||||
}
|
||||
|
||||
set_governor() {
|
||||
for i in $(seq $(get_thread))
|
||||
do
|
||||
i=$(( $i - 1 ))
|
||||
echo $1 > /sys/devices/system/cpu/cpufreq/policy${i}/scaling_governor 2> /dev/null
|
||||
[[ $? != 0 ]] && return 1
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
list_available_governor() {
|
||||
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors 2> /dev/null
|
||||
}
|
||||
|
||||
list_available_freq() {
|
||||
cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_${1}_freq 2> /dev/null
|
||||
}
|
||||
|
||||
check_governor() {
|
||||
for i in $(list_available_governor)
|
||||
do
|
||||
[[ $1 == $i ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
list_available_freq() {
|
||||
cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_${1}_freq 2> /dev/null
|
||||
}
|
||||
|
||||
get_freq() {
|
||||
case $1 in
|
||||
cur)
|
||||
cat /sys/devices/system/cpu/cpufreq/policy${1}/scaling_cur_freq 2> /dev/null
|
||||
;;
|
||||
min | max)
|
||||
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_${1}_freq 2> /dev/null
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
set_freq() {
|
||||
for i in $(seq $(get_thread))
|
||||
do
|
||||
i=$(( $i - 1 ))
|
||||
echo $2 > /sys/devices/system/cpu/cpufreq/policy${i}/scaling_${1}_freq 2> /dev/null
|
||||
[[ $? != 0 ]] && return 1
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
help() {
|
||||
case $1 in
|
||||
governor)
|
||||
case $2 in
|
||||
set)
|
||||
echo "Usage: $0 governor set < $(list_available_governor)>"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 governor [ls] [show] [set]"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
freq)
|
||||
case $2 in
|
||||
set)
|
||||
echo "Usage: $0 freq set [min] [max] <number[$(( $(list_available_freq min) / 100000 ))-$(( $(list_available_freq max) / 100000 ))]>"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 freq [ls] [set] [show]"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [governor] [freq]"
|
||||
;;
|
||||
esac
|
||||
exit
|
||||
}
|
||||
|
||||
case $1 in
|
||||
governor)
|
||||
case $2 in
|
||||
ls)
|
||||
echo "Available governor: $(list_available_governor)"
|
||||
;;
|
||||
show)
|
||||
for i in $(seq $(get_thread))
|
||||
do
|
||||
i=$(( $i - 1 ))
|
||||
echo CPU$i $(get_governor $i) $(get_freq cur $i)
|
||||
done
|
||||
;;
|
||||
set)
|
||||
if [[ $(check_governor $3; echo $?) == 0 ]]
|
||||
then
|
||||
set_governor $3 || echo "Failed to set CPU governor to $3 ..."
|
||||
else
|
||||
help $1 $2
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
help $1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
freq)
|
||||
case $2 in
|
||||
ls)
|
||||
echo "Available Min frequency: $(list_available_freq min)"
|
||||
echo "Available Max frequency: $(list_available_freq max)"
|
||||
;;
|
||||
show)
|
||||
case $3 in
|
||||
min | max)
|
||||
get_freq $3
|
||||
;;
|
||||
*)
|
||||
get_freq min
|
||||
get_freq max
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
set)
|
||||
case $3 in
|
||||
min | max)
|
||||
if [[ $4 =~ [0-9] && $4 != 0 && $4 -lt 99 ]] 2> /dev/null
|
||||
then
|
||||
set_freq $3 ${4}00000 || echo "Failed to set CPU frequency to $4 ..."
|
||||
else
|
||||
echo "Unknown freq number: [$4]"
|
||||
fi
|
||||
;;
|
||||
reset)
|
||||
set_freq min $(list_available_freq min)
|
||||
set_freq max $(list_available_freq max)
|
||||
;;
|
||||
*)
|
||||
help $1 $2
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
help $1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
help
|
||||
;;
|
||||
esac
|
|
@ -13,7 +13,7 @@ Firmware_Diy_Core() {
|
|||
Short_Fw_Date=true
|
||||
x86_Full_Images=false
|
||||
Fw_Format=false
|
||||
Regex_Skip="packages|buildinfo|sha256sums|manifest|kernel|rootfs|factory|itb|profile"
|
||||
Regex_Skip="packages|buildinfo|sha256sums|manifest|kernel|rootfs|factory|itb|profile|ext4"
|
||||
|
||||
AutoBuild_Features=true
|
||||
}
|
||||
|
@ -69,14 +69,15 @@ EOF
|
|||
sed -i "s?/bin/login?/usr/libexec/login.sh?g" ${FEEDS_PKG}/ttyd/files/ttyd.config
|
||||
sed -i 's/luci-theme-bootstrap/luci-theme-argon-mod/g' feeds/luci/collections/luci/Makefile
|
||||
sed -i '/uci commit luci/i\uci set luci.main.mediaurlbase="/luci-static/argon-mod"' $(PKG_Finder d package default-settings)/files/zzz-default-settings
|
||||
# AddPackage git lean luci-theme-argon jerrykuku 18.06
|
||||
|
||||
for i in smartdns eqos mentohust minieap unblockneteasemusic
|
||||
do
|
||||
AddPackage svn apps luci-app-${i} immortalwrt/luci/branches/openwrt-18.06/applications
|
||||
sed -i 's/..\/..\//\$\(TOPDIR\)\/feeds\/luci\//g' ${WORK}/package/apps/luci-app-${i}/Makefile
|
||||
done ; unset i
|
||||
|
||||
AddPackage svn apps minieap immortalwrt/packages/branches/openwrt-18.06/net
|
||||
AddPackage git lean luci-app-argon-config jerrykuku master
|
||||
AddPackage svn other luci-app-smartdns immortalwrt/luci/branches/openwrt-18.06/applications
|
||||
sed -i 's/..\/..\//\$\(TOPDIR\)\/feeds\/luci\//g' $(PKG_Finder d package luci-app-smartdns)/Makefile
|
||||
AddPackage svn other luci-app-eqos immortalwrt/luci/branches/openwrt-18.06/applications
|
||||
sed -i 's/..\/..\//\$\(TOPDIR\)\/feeds\/luci\//g' $(PKG_Finder d package luci-app-eqos)/Makefile
|
||||
# AddPackage svn other luci-app-socat immortalwrt/luci/branches/openwrt-18.06/applications
|
||||
# sed -i 's/..\/..\//\$\(TOPDIR\)\/feeds\/luci\//g' $(PKG_Finder d package luci-app-socat)/Makefile
|
||||
AddPackage git other OpenClash vernesong master
|
||||
AddPackage git other luci-app-ikoolproxy iwrt main
|
||||
AddPackage git other helloworld fw876 master
|
||||
|
@ -85,7 +86,7 @@ EOF
|
|||
for x in $(ls -1 ${CustomFiles}/Patches/luci-app-shadowsocksr)
|
||||
do
|
||||
patch < ${CustomFiles}/Patches/luci-app-shadowsocksr/${x} -p1 -d ${WORK}
|
||||
done
|
||||
done ; unset x
|
||||
|
||||
patch < ${CustomFiles}/Patches/fix_ntfs3_conflict_with_antfs.patch -p1 -d ${WORK}
|
||||
patch < ${CustomFiles}/Patches/fix_aria2_auto_create_download_path.patch -p1 -d ${WORK}
|
||||
|
@ -103,12 +104,13 @@ EOF
|
|||
patch < ${CustomFiles}/d-team_newifi-d2_mt76_dualband.patch -p1 -d ${WORK}
|
||||
;;
|
||||
x86_64)
|
||||
Copy ${CustomFiles}/Depends/cpuset ${BASE_FILES}/bin
|
||||
AddPackage git passwall-depends openwrt-passwall xiaorouji packages
|
||||
AddPackage git passwall-luci openwrt-passwall xiaorouji luci
|
||||
rm -rf packages/lean/autocore
|
||||
AddPackage git lean autocore-modify Hyy2001X master
|
||||
sed -i -- 's:/bin/ash:'/bin/bash':g' ${BASE_FILES}/etc/passwd
|
||||
patch < ${CustomFiles}/Patches/upgrade_intel_igpu_drv.patch -p1 -d ${WORK}
|
||||
# patch < ${CustomFiles}/Patches/upgrade_intel_igpu_drv.patch -p1 -d ${WORK}
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue