First Commit

This commit is contained in:
2025-11-17 07:19:53 -07:00
parent 93c1ee71ba
commit b3b8177a74
44 changed files with 560 additions and 0 deletions

12
debian/changelog vendored Normal file
View File

@@ -0,0 +1,12 @@
rakuos-settings (1.0.2-1-1rakuos8) unstable; urgency=medium
* Adding default grub
* Porting things over from cachyos-settings
-- Tohur <tohur@tohur.xyz> Wed, 12 Nov 2025 23:22:44 -0700
rakuos-settings (1.0.1-2-1rakuos1) unstable; urgency=medium
* Initial release of RakuOS settings package.
-- Joshua Webb <tohur@tohur.xyz> Thu, 06 Nov 2025 22:40:00 -0700

12
debian/control vendored Normal file
View File

@@ -0,0 +1,12 @@
Source: rakuos-settings
Section: metapackages
Priority: optional
Maintainer: RakuOS Team <tohur@tohur.xyz>
Build-Depends: debhelper-compat (= 13),
Standards-Version: 4.6.2
Package: rakuos-settings
Architecture: all
Replaces: systemd-zram-generator
Depends: ${misc:Depends}, systemd-zram-generator, libzstd1, rtkit
Description: Core OS config for RakuOS

10
debian/copyright vendored Normal file
View File

@@ -0,0 +1,10 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: RakuOS Branding
Upstream-Contact: Joshua Webb <contact@rakuos.org>
Source: https://rakuos.org/
Files: *
Copyright: 2025 Joshua Webb
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 or later.

2
debian/install vendored Normal file
View File

@@ -0,0 +1,2 @@
etc/* etc/
usr/* usr/

5
debian/postinst vendored Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
set -e
systemctl enable pci-latency.service

15
debian/rules vendored Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/make -f
# Simple dh (debhelper) build rules file
%:
dh $@
override_dh_fixperms:
dh_fixperms
chmod 755 debian/rakuos-settings/usr/bin/kerver
chmod u+x debian/rakuos-settings/usr/bin/kerver
chmod 755 debian/rakuos-settings/usr/bin/pci-latency
chmod u+x debian/rakuos-settings/usr/bin/pci-latency
chmod 755 debian/rakuos-settings/usr/bin/topmem
chmod u+x debian/rakuos-settings/usr/bin/topmem
chmod 755 debian/rakuos-settings/usr/bin/zink-run
chmod u+x debian/rakuos-settings/usr/bin/zink-run

1
debian/source/format vendored Normal file
View File

@@ -0,0 +1 @@
3.0 (native)

View File

@@ -0,0 +1 @@
APT::Default-Release "rakuos";

View File

@@ -0,0 +1,3 @@
DPkg::Post-Invoke {
"if [ -x /usr/sbin/update-grub ]; then /usr/sbin/update-grub || true; fi";
};

View File

@@ -0,0 +1 @@
@audio - rtprio 99

29
usr/bin/kerver Executable file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
cat << EOF
Check kernel version:
$(cat /proc/version && uname -a)
Check x86_64 support:
$(/lib64/ld-linux-x86-64.so.2 --help | grep "(supported, searched)")
Check CPU config:
$(zgrep -iE 'CONFIG_(GENERIC_CPU(=| is)|X86_64_VERSION|MZEN|MBULLDOZER|MPILEDRIVER|MSTREAMROLLER|MEXCAVATOR|MBOBCAT|MJAGUAR|MK10|MK8SSE3|MATOM|MGOLDMONTPLUS|MSKYLAKE2|MIVYBRIDGE|MICELAKE|MNATIVE_INTEL|MNATIVE_AMD|X86_NATIVE_CPU)' /proc/config.gz)
Current disk schedulers:
$(for disk in /sys/block/*/
do [ -f "$disk/queue/scheduler" ] \
&& echo "$(basename "$disk"): $(cat "$disk/queue/scheduler")"
done)
Check available schedulers:
$(journalctl --output cat -k | grep -i scheduler)
EOF

19
usr/bin/pci-latency Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env sh
# This script is designed to improve the performance and reduce audio latency
# for sound cards by setting the PCI latency timer to an optimal value of 80
# cycles. It also resets the default value of the latency timer for other PCI
# devices, which can help prevent devices with high default latency timers from
# causing gaps in sound.
# Check if the script is run with root privileges
if [ "$(id -u)" -ne 0 ]; then
echo "Error: This script must be run with root privileges." >&2
exit 1
fi
# Reset the latency timer for all PCI devices
setpci -v -s '*:*' latency_timer=20
setpci -v -s '0:0' latency_timer=0
# Set latency timer for all sound cards
setpci -v -d "*:*:04xx" latency_timer=80

219
usr/bin/topmem Executable file
View File

@@ -0,0 +1,219 @@
#!/usr/bin/env lua
local f, concat, sort = string.format, table.concat, table.sort
local found, uv = pcall(require, 'luv')
local function die(err, ...)
print(err:format(...))
os.exit(1)
end
if not found then
die("lua-luv dependency is missing, please install it from repositories")
end
local function printf(pattern, ...)
print(pattern:format(...))
end
-- Patterns
local pid_pattern = "[0-9]+"
local ksm_profit_pattern = "ksm_process_profit%s*([0-9]+)"
local vm_rss_pattern = "VmRSS:%s*([0-9]+)"
local vm_swap_pattern = "VmSwap:%s*([0-9]+)"
local function get_process_values(pid)
local path = concat({ "/proc", pid, "status" }, "/")
local file = io.open(path)
if not file then
return nil
end
local rss, swap
local line = file:read()
while line do
if rss == nil then
rss = line:match(vm_rss_pattern)
elseif swap == nil then
swap = line:match(vm_swap_pattern)
else
break
end
line = file:read()
end
file:close()
return tonumber(rss), tonumber(swap)
end
local function get_process_ksm_profit(pid)
local file = io.open(concat({ "/proc", pid, "ksm_stat" }, "/"))
if not file then
return 0
end
local stat = file:read("*a")
local profit = stat:match(ksm_profit_pattern)
file:close()
if not profit then
return 0
end
return tonumber(profit)
end
local function get_process_first_arg(pid)
local file = io.open(concat({ "/proc", pid, "cmdline" }, "/"))
if not file then
return nil
end
local cmdline = file:read("*all")
file:close()
return cmdline:match("([^%z]+)")
end
local function convert_hashmap_table(map)
local new_hashmap = {}
for key, value in pairs(map) do
new_hashmap[#new_hashmap + 1] = { value[1], value[2], value[3], key }
end
return new_hashmap
end
local function get_process_map(sort_by)
local map = {}
local processes = uv.fs_scandir("/proc")
local pid, ftype = uv.fs_scandir_next(processes)
while pid do
if pid:match(pid_pattern) then
if ftype == "directory" then
local rss, swap = get_process_values(pid)
local name = get_process_first_arg(pid)
local ksm_profit = get_process_ksm_profit(pid)
if name and rss then
if map[name] then
map[name][1] = map[name][1] + rss
map[name][2] = map[name][2] + swap
map[name][3] = map[name][3] + ksm_profit
else
map[name] = { rss, swap, ksm_profit }
end
end
end
end
pid, ftype = uv.fs_scandir_next(processes)
end
map = convert_hashmap_table(map)
sort(map, function(a, b) return (a[sort_by] > b[sort_by]) end)
return map
end
local function truncate(str)
if #str > 25 then
return str:sub(1, 25) .. "..."
else
return str
end
end
local function get_filename(path)
local lastSlash = path:find("/[^/]*$")
if lastSlash then
return path:sub(lastSlash + 1)
else
return path
end
end
local function print_top(size, sort_by)
local map = get_process_map(sort_by)
printf("%-9s %35s %-9s %-s", "MEMORY", "Top " .. size .. " processes ", "SWAP", "KSM")
for i = 1, size do
local entry = map[i]
if entry then
printf(
"%-9s %-35s %-9s %-s",
f("%.0f", entry[1] / 1024) .. "M",
truncate(get_filename(entry[4])),
f("%.0f", entry[2] / 1024) .. "M",
f("%.0f", entry[3] / 1024 / 1024) .. "M"
)
end
end
end
local function print_help()
print([[
Shows names of the top 10 (or N) processes by memory consumption
Usage: topmem [OPTIONS] [N]
Arguments:
[N] [default: 10]
Options:
-s, --sort <TYPE> Column to sort by [possible values: rss (default), swap, ksm]
-h, --help Show this message]]
)
os.exit(0)
end
local function main()
local sort_types = {
["rss"] = 1,
["swap"] = 2,
["ksm"] = 3
}
local sort_by = sort_types["rss"]
local size
local i = 1
while i < #arg + 1 do
if arg[i] == "--sort" or arg[i] == "-s" or arg[i]:match("--sort=*") then
local criteria
local shift = true
for value in string.gmatch(arg[i], "([^=]+)") do
if value ~= "--sort" and value ~= "-s" then
criteria = value
shift = false
break
end
end
criteria = criteria or arg[i + 1]
if not criteria then
die("Column to sort by is not specified")
end
if not sort_types[criteria] then
die("Wrong sorting criterion. Only available: rss, swap, ksm.")
else
sort_by = sort_types[criteria]
if shift then
i = i + 1
end
end
elseif arg[i] == "--help" or arg[i] == "-h" then
print_help()
else
local status, value = pcall(tonumber, arg[i])
if not status then
die("The argument must be a number")
else
size = value
end
end
i = i + 1
end
print_top(size or 10, sort_by)
end
main()

6
usr/bin/zink-run Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
export MESA_LOADER_DRIVER_OVERRIDE=zink
export GALLIUM_DRIVER=zink
export __GLX_VENDOR_LIBRARY_NAME=mesa
export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json
exec "$@"

View File

@@ -0,0 +1,2 @@
[main]
dns=systemd-resolved

View File

@@ -0,0 +1,4 @@
# Force using of the amdgpu driver for Southern Islands (GCN 1.0+) and Sea
# Islands (GCN 2.x) generations.
options amdgpu si_support=1 cik_support=1
options radeon si_support=0 cik_support=0

View File

@@ -0,0 +1,5 @@
# Blacklist the Intel TCO Watchdog/Timer module
blacklist iTCO_wdt
# Blacklist the AMD SP5100 TCO Watchdog/Timer module (Required for Ryzen cpus)
blacklist sp5100_tco

View File

@@ -0,0 +1,21 @@
#
# NVreg_UsePageAttributeTable=1 (Default 0) - Activating the better memory
# management method (PAT). The PAT method creates a partition type table at a
# specific address mapped inside the register and utilizes the memory
# architecture and instruction set more efficiently and faster. If your system
# can support this feature, it should improve CPU performance.
#
# NVreg_InitializeSystemMemoryAllocations=0 (Default 1) - Disables clearing
# system memory allocation before using it for the GPU. Potentially improves
# performance, but at the cost of increased security risks. Write "options
# nvidia NVreg_InitializeSystemMemoryAllocations=1" in
# /etc/modprobe.d/nvidia.conf, if you want to return the default value. Note:
# It is possible to use more memory (?)
#
# NVreg_DynamicPowerManagement=0x02 - Enables the use of dynamic power
# management for Turing generation mobile cards, allowing the dGPU to be
# powered down during idle time.
#
options nvidia NVreg_UsePageAttributeTable=1 \
NVreg_InitializeSystemMemoryAllocations=0 \
NVreg_DynamicPowerManagement=0x02

View File

@@ -0,0 +1,2 @@
# Load i2c-dev.ko at boot
i2c-dev

View File

@@ -0,0 +1,2 @@
# Load i2c-piix4.ko at boot
i2c-piix4

View File

@@ -0,0 +1 @@
ntsync

View File

@@ -0,0 +1,26 @@
### Use only if you want to change the default values!
### For more information look here: https://github.com/firelzrd/bore-scheduler#readme
### Additional settings for BORE Scheduler (Work only if the BORE scheduler is enabled!)
### So make sure that kernel.sched_bore has a value of 1
# sched_burst_cache_lifetime (range: 0 - 4294967295, default: 75000000)
#kernel.sched_burst_cache_lifetime = 75000000
# sched_burst_fork_atavistic (range: 0 - 3, default: 2)
#kernel.sched_burst_fork_atavistic = 2
# sched_burst_penalty_offset (range: 0 - 64, default: 22)
#kernel.sched_burst_penalty_offset = 22
# sched_burst_penalty_scale (range: 0 - 4095, default: 1280)
#kernel.sched_burst_penalty_scale = 1280
# sched_burst_smoothness (range: 1 - 255, default: 20)
#kernel.sched_burst_smoothness = 20
# sched_burst_exclude_kthreads (range: 0 - 1, default: 1)
#kernel.sched_burst_exclude_kthreads = 1
# sched_burst_parity_threshold (range: u8, default: 2)
#kernel.sched_burst_parity_threshold = 2

View File

@@ -0,0 +1,49 @@
# The sysctl swappiness parameter determines the kernel's preference for pushing anonymous pages or page cache to disk in memory-starved situations.
# A low value causes the kernel to prefer freeing up open files (page cache), a high value causes the kernel to try to use swap space,
# and a value of 100 means IO cost is assumed to be equal.
vm.swappiness = 100
# The value controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects (VFS cache).
# Lowering it from the default value of 100 makes the kernel less inclined to reclaim VFS cache (do not set it to 0, this may produce out-of-memory conditions)
vm.vfs_cache_pressure = 50
# Contains, as bytes, the number of pages at which a process which is
# generating disk writes will itself start writing out dirty data.
vm.dirty_bytes = 268435456
# page-cluster controls the number of pages up to which consecutive pages are read in from swap in a single attempt.
# This is the swap counterpart to page cache readahead. The mentioned consecutivity is not in terms of virtual/physical addresses,
# but consecutive on swap space - that means they were swapped out together. (Default is 3)
# increase this value to 1 or 2 if you are using physical swap (1 if ssd, 2 if hdd)
vm.page-cluster = 0
# Contains, as bytes, the number of pages at which the background kernel
# flusher threads will start writing out dirty data.
vm.dirty_background_bytes = 67108864
# The kernel flusher threads will periodically wake up and write old data out to disk. This
# tunable expresses the interval between those wakeups, in 100'ths of a second (Default is 500).
vm.dirty_writeback_centisecs = 1500
# This action will speed up your boot and shutdown, because one less module is loaded. Additionally disabling watchdog timers increases performance and lowers power consumption
# Disable NMI watchdog
kernel.nmi_watchdog = 0
# Enable the sysctl setting kernel.unprivileged_userns_clone to allow normal users to run unprivileged containers.
kernel.unprivileged_userns_clone = 1
# To hide any kernel messages from the console
kernel.printk = 3 3 3 3
# Restricting access to kernel pointers in the proc filesystem
kernel.kptr_restrict = 2
# Disable Kexec, which allows replacing the current running kernel.
kernel.kexec_load_disabled = 1
# Increase netdev receive queue
# May help prevent losing packets
net.core.netdev_max_backlog = 4096
# Set size of file handles and inode cache
fs.file-max = 2097152

View File

@@ -0,0 +1,2 @@
[Journal]
SystemMaxUse=50M

View File

@@ -0,0 +1,3 @@
[Manager]
DefaultTimeoutStartSec=15s
DefaultTimeoutStopSec=10s

View File

@@ -0,0 +1,2 @@
[Manager]
DefaultLimitNOFILE=2048:2097152

View File

@@ -0,0 +1,9 @@
[Unit]
Description=Adjust latency timers for PCI peripherals
[Service]
Type=oneshot
ExecStart=/usr/bin/pci-latency
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,2 @@
[Service]
LogLevelMax=info

View File

@@ -0,0 +1,2 @@
[Service]
Delegate=cpu cpuset io memory pids

View File

@@ -0,0 +1,8 @@
[Time]
NTP=time.cloudflare.com
FallbackNTP=time.google.com 0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048
#ConnectionRetrySec=30
#SaveIntervalSec=60

View File

@@ -0,0 +1,2 @@
[Manager]
DefaultLimitNOFILE=1024:1048576

View File

@@ -0,0 +1,5 @@
[zram0]
compression-algorithm = zstd
zram-size = ram
swap-priority = 100
fs-type = swap

View File

@@ -0,0 +1,2 @@
# Clear all coredumps that were created more than 3 days ago
d /var/lib/systemd/coredump 0755 root root 3d

View File

@@ -0,0 +1,6 @@
# THP Shrinker has been added in the 6.12 Kernel
# Default Value is 511
# THP=always policy vastly overprovisions THPs in sparsely accessed memory areas, resulting in excessive memory pressure and premature OOM killing
# 409 means that any THP that has more than 409 out of 512 (80%) zero filled filled pages will be split.
# This reduces the memory usage, when THP=always used and the memory usage goes down to around the same usage as when madvise is used, while still providing an equal performance improvement
w! /sys/kernel/mm/transparent_hugepage/khugepaged/max_ptes_none - - - - 409

View File

@@ -0,0 +1,3 @@
# Improve performance for applications that use tcmalloc
# https://github.com/google/tcmalloc/blob/master/docs/tuning.md#system-level-optimizations
w! /sys/kernel/mm/transparent_hugepage/defrag - - - - defer+madvise

View File

@@ -0,0 +1,17 @@
# Disables power saving capabilities for snd-hda-intel when device is not
# running on battery power. This is needed because it prevents audio cracks on
# some hardware.
ACTION=="add", SUBSYSTEM=="sound", KERNEL=="card*", DRIVERS=="snd_hda_intel", TEST!="/run/udev/snd-hda-intel-powersave", \
RUN+="/usr/bin/bash -c 'touch /run/udev/snd-hda-intel-powersave; \
[[ $$(cat /sys/class/power_supply/BAT0/status 2>/dev/null) != \"Discharging\" ]] && \
echo $$(cat /sys/module/snd_hda_intel/parameters/power_save) > /run/udev/snd-hda-intel-powersave && \
echo 0 > /sys/module/snd_hda_intel/parameters/power_save'"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", TEST=="/sys/module/snd_hda_intel", \
RUN+="/usr/bin/bash -c 'echo $$(cat /run/udev/snd-hda-intel-powersave 2>/dev/null || \
echo 10) > /sys/module/snd_hda_intel/parameters/power_save'"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", TEST=="/sys/module/snd_hda_intel", \
RUN+="/usr/bin/bash -c '[[ $$(cat /sys/module/snd_hda_intel/parameters/power_save) != 0 ]] && \
echo $$(cat /sys/module/snd_hda_intel/parameters/power_save) > /run/udev/snd-hda-intel-powersave; \
echo 0 > /sys/module/snd_hda_intel/parameters/power_save'"

View File

@@ -0,0 +1,14 @@
# When used with ZRAM, it is better to prefer page out only anonymous pages,
# because it ensures that they do not go out of memory, but will be just
# compressed. If we do frequent flushing of file pages, that increases the
# percentage of page cache misses, which in the long term gives additional
# cycles to re-read the same data from disk that was previously in page cache.
# This is the reason why it is recommended to use high values from 100 to keep
# the page cache as hermetic as possible, because otherwise it is "expensive"
# to read data from disk again. At the same time, uncompressing pages from ZRAM
# is not as expensive and is usually very fast on modern CPUs.
#
# Also it's better to disable Zswap, as this may prevent ZRAM from working
# properly or keeping a proper count of compressed pages via zramctl.
ACTION=="change", KERNEL=="zram0", ATTR{initstate}=="1", SYSCTL{vm.swappiness}="150", \
RUN+="/bin/sh -c 'echo N > /sys/module/zswap/parameters/enabled'"

View File

@@ -0,0 +1,2 @@
KERNEL=="rtc0", GROUP="audio"
KERNEL=="hpet", GROUP="audio"

View File

@@ -0,0 +1,4 @@
# SATA Active Link Power Management
ACTION=="add", SUBSYSTEM=="scsi_host", KERNEL=="host*", \
ATTR{link_power_management_policy}=="*", \
ATTR{link_power_management_policy}="max_performance"

View File

@@ -0,0 +1,11 @@
# HDD
ACTION=="add|change", KERNEL=="sd[a-z]*", ATTR{queue/rotational}=="1", \
ATTR{queue/scheduler}="bfq"
# SSD
ACTION=="add|change", KERNEL=="sd[a-z]*|mmcblk[0-9]*", ATTR{queue/rotational}=="0", \
ATTR{queue/scheduler}="mq-deadline"
# NVMe SSD
ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/rotational}=="0", \
ATTR{queue/scheduler}="none"

View File

@@ -0,0 +1,2 @@
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", \
ATTRS{id/bus}=="ata", RUN+="/usr/bin/hdparm -B 254 -S 0 /dev/%k"

View File

@@ -0,0 +1,9 @@
# Enable runtime PM for NVIDIA VGA/3D controller devices on driver bind
ACTION=="add|bind", SUBSYSTEM=="pci", DRIVERS=="nvidia", \
ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", \
TEST=="power/control", ATTR{power/control}="auto"
# Disable runtime PM for NVIDIA VGA/3D controller devices on driver unbind
ACTION=="remove|unbind", SUBSYSTEM=="pci", DRIVERS=="nvidia", \
ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", \
TEST=="power/control", ATTR{power/control}="on"

View File

@@ -0,0 +1 @@
DEVPATH=="/devices/virtual/misc/cpu_dma_latency", OWNER="root", GROUP="audio", MODE="0660"

View File

@@ -0,0 +1,7 @@
Section "InputClass"
Identifier "libinput touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "Tapping" "True"
EndSection