Optimize kernel
This commit is contained in:
parent
0bf62ad404
commit
6d9927aba0
3 changed files with 10299 additions and 113 deletions
16
.SRCINFO
16
.SRCINFO
|
@ -1,8 +1,8 @@
|
||||||
pkgbase = linux-clear
|
pkgbase = linux-jstm-optimized
|
||||||
pkgdesc = Clear Linux
|
pkgdesc = Optimized Linux kernel. Includes Clear Linux's kernel config and some tweaks made by JeremyStarTM.
|
||||||
pkgver = 6.7.9
|
pkgver = 6.7.9
|
||||||
pkgrel = 1
|
pkgrel = 1
|
||||||
url = https://github.com/clearlinux-pkgs/linux
|
url = https://git.staropensource.de/JeremyStarTM/kernel-optimized
|
||||||
arch = x86_64
|
arch = x86_64
|
||||||
license = GPL2
|
license = GPL2
|
||||||
makedepends = bc
|
makedepends = bc
|
||||||
|
@ -15,7 +15,7 @@ pkgbase = linux-clear
|
||||||
source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.tar.xz
|
source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.tar.xz
|
||||||
source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.tar.sign
|
source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.tar.sign
|
||||||
source = https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-6.7.9.xz
|
source = https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-6.7.9.xz
|
||||||
source = linux-clear::git+https://github.com/clearlinux-pkgs/linux.git#tag=6.7.8-1413
|
source = linux-jstm-optimized::git+https://github.com/clearlinux-pkgs/linux.git#tag=6.7.8-1413
|
||||||
source = more-uarches-20240221.2.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/20240221.2.tar.gz
|
source = more-uarches-20240221.2.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/20240221.2.tar.gz
|
||||||
validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886
|
validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886
|
||||||
validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E
|
validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E
|
||||||
|
@ -25,8 +25,8 @@ pkgbase = linux-clear
|
||||||
sha256sums = SKIP
|
sha256sums = SKIP
|
||||||
sha256sums = 1d3ac3e581cbc5108f882fcdc75d74f7f069654c71bad65febe5ba15a7a3a14f
|
sha256sums = 1d3ac3e581cbc5108f882fcdc75d74f7f069654c71bad65febe5ba15a7a3a14f
|
||||||
|
|
||||||
pkgname = linux-clear
|
pkgname = linux-jstm-optimized
|
||||||
pkgdesc = The Clear Linux kernel and modules
|
pkgdesc = Optimized Linux kernel. Includes Clear Linux's kernel config and some tweaks made by JeremyStarTM. This package includes the kernel and compiled modules.
|
||||||
install = linux.install
|
install = linux.install
|
||||||
depends = coreutils
|
depends = coreutils
|
||||||
depends = kmod
|
depends = kmod
|
||||||
|
@ -38,6 +38,6 @@ pkgname = linux-clear
|
||||||
provides = WIREGUARD-MODULE
|
provides = WIREGUARD-MODULE
|
||||||
provides = KSMBD-MODULE
|
provides = KSMBD-MODULE
|
||||||
|
|
||||||
pkgname = linux-clear-headers
|
pkgname = linux-jstm-optimized-headers
|
||||||
pkgdesc = Headers and scripts for building modules for the Clear Linux kernel
|
pkgdesc = Optimized Linux kernel. Includes Clear Linux's kernel config and some tweaks made by JeremyStarTM. This package includes various headers and scripts for building modules.
|
||||||
depends = pahole
|
depends = pahole
|
||||||
|
|
134
PKGBUILD
134
PKGBUILD
|
@ -1,12 +1,21 @@
|
||||||
|
# Maintainer: JeremyStarTM <jeremystartm@staropensource.de>
|
||||||
# Maintainer: Josip Ponjavic <josipponjavic at gmail dot com>
|
# Maintainer: Josip Ponjavic <josipponjavic at gmail dot com>
|
||||||
# Contributor:
|
|
||||||
|
|
||||||
### BUILD OPTIONS
|
### BUILD OPTIONS
|
||||||
# Set the next two variables to ANYTHING that is not null to enable them
|
|
||||||
|
|
||||||
|
# Set to anything but null to activate
|
||||||
# Tweak kernel options prior to a build via nconfig
|
# Tweak kernel options prior to a build via nconfig
|
||||||
: "${_makenconfig:=""}"
|
: "${_makenconfig:=""}"
|
||||||
|
|
||||||
|
# Set to anything but null to activate
|
||||||
|
# Tweak kernel options prior to a build via xconfig
|
||||||
|
: "${_makexconfig:="SET"}"
|
||||||
|
|
||||||
|
# Set to anything but null to activate
|
||||||
|
# Copies the final kernel configuration before building
|
||||||
|
: "${_copyfinalconfig:=""}"
|
||||||
|
|
||||||
|
# Set to anything but null to activate
|
||||||
# Only compile active modules to VASTLY reduce the number of modules built and
|
# Only compile active modules to VASTLY reduce the number of modules built and
|
||||||
# the build time.
|
# the build time.
|
||||||
#
|
#
|
||||||
|
@ -68,13 +77,6 @@
|
||||||
# 45. AMD-Native optimizations autodetected by the compiler (MNATIVE_AMD)
|
# 45. AMD-Native optimizations autodetected by the compiler (MNATIVE_AMD)
|
||||||
: "${_subarch:=""}"
|
: "${_subarch:=""}"
|
||||||
|
|
||||||
# Use the current kernel's .config file
|
|
||||||
# Enabling this option will use the .config of the RUNNING kernel rather than
|
|
||||||
# the ARCH defaults. Useful when the package gets updated and you already went
|
|
||||||
# through the trouble of customizing your config options. NOT recommended when
|
|
||||||
# a new kernel is released, but again, convenient for package bumps.
|
|
||||||
: "${_use_current:=""}"
|
|
||||||
|
|
||||||
# Enable compiling with LLVM
|
# Enable compiling with LLVM
|
||||||
: "${_use_llvm_lto:=""}"
|
: "${_use_llvm_lto:=""}"
|
||||||
|
|
||||||
|
@ -83,19 +85,19 @@
|
||||||
# .config file or leave empty to ignore debug options.
|
# .config file or leave empty to ignore debug options.
|
||||||
: "${_debug:=""}"
|
: "${_debug:=""}"
|
||||||
|
|
||||||
### IMPORTANT: Do no edit below this line unless you know what you're doing
|
### BUILD OPTIONS END
|
||||||
|
|
||||||
_major=6.7
|
_major=6.7
|
||||||
_minor=9
|
_minor=9
|
||||||
_srcname=linux-${_major}
|
_srcname=linux-${_major}
|
||||||
_clr=${_major}.8-1413
|
_clr=${_major}.8-1413
|
||||||
_gcc_more_v='20240221.2'
|
_gcc_more_v='20240221.2'
|
||||||
pkgbase=linux-clear
|
pkgbase=linux-jstm-optimized
|
||||||
pkgver=${_major}.${_minor}
|
pkgver=${_major}.${_minor}
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc='Clear Linux'
|
pkgdesc="Optimized Linux kernel. Includes Clear Linux's kernel config and some tweaks made by JeremyStarTM."
|
||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
url="https://github.com/clearlinux-pkgs/linux"
|
url="https://git.staropensource.de/JeremyStarTM/kernel-optimized"
|
||||||
license=('GPL2')
|
license=('GPL2')
|
||||||
makedepends=('bc' 'cpio' 'git' 'libelf' 'pahole' 'xmlto')
|
makedepends=('bc' 'cpio' 'git' 'libelf' 'pahole' 'xmlto')
|
||||||
if [ -n "$_use_llvm_lto" ]; then
|
if [ -n "$_use_llvm_lto" ]; then
|
||||||
|
@ -106,7 +108,7 @@ source=(
|
||||||
"https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${_major}.tar.xz"
|
"https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${_major}.tar.xz"
|
||||||
"https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${_major}.tar.sign"
|
"https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${_major}.tar.sign"
|
||||||
"https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-${pkgver}.xz"
|
"https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-${pkgver}.xz"
|
||||||
"$pkgbase::git+https://github.com/clearlinux-pkgs/linux.git#tag=${_clr}"
|
"cl-linux::git+https://github.com/clearlinux-pkgs/linux.git#tag=${_clr}"
|
||||||
"more-uarches-$_gcc_more_v.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/$_gcc_more_v.tar.gz"
|
"more-uarches-$_gcc_more_v.tar.gz::https://github.com/graysky2/kernel_compiler_patch/archive/$_gcc_more_v.tar.gz"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -126,15 +128,15 @@ prepare() {
|
||||||
|
|
||||||
### Add upstream patches
|
### Add upstream patches
|
||||||
echo "Add upstream patches"
|
echo "Add upstream patches"
|
||||||
patch -Np1 -i ../patch-${pkgver}
|
patch -Np1 -i ../patch-${pkgver} || true
|
||||||
|
|
||||||
### Setting version
|
### Setting version
|
||||||
echo "Setting version..."
|
echo "Setting version..."
|
||||||
echo "-$pkgrel" > localversion.10-pkgrel
|
echo "-$pkgrel" > localversion.10-pkgrel
|
||||||
echo "${pkgbase#linux}" > localversion.20-pkgname
|
echo "${pkgbase#linux}" > localversion.20-pkgname
|
||||||
|
|
||||||
### Add Clearlinux patches
|
### Add Clear Linux patches
|
||||||
for i in $(grep '^Patch' ${srcdir}/$pkgbase/linux.spec |\
|
for i in $(grep '^Patch' ${srcdir}/cl-linux/linux.spec |\
|
||||||
grep -Ev '^Patch0132|^Patch0118|^Patch0113|^Patch0138|^Patch0139' | sed -n 's/.*: //p'); do
|
grep -Ev '^Patch0132|^Patch0118|^Patch0113|^Patch0138|^Patch0139' | sed -n 's/.*: //p'); do
|
||||||
if [ -n "$_use_llvm_lto" ]; then
|
if [ -n "$_use_llvm_lto" ]; then
|
||||||
if [ "${i}" == "0162-extra-optmization-flags.patch" ] ; then
|
if [ "${i}" == "0162-extra-optmization-flags.patch" ] ; then
|
||||||
|
@ -142,76 +144,12 @@ prepare() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "Applying patch ${i}..."
|
echo "Applying patch ${i}..."
|
||||||
patch -Np1 -i "$srcdir/$pkgbase/${i}"
|
patch -Np1 -i "$srcdir/cl-linux/${i}" || true
|
||||||
done
|
done
|
||||||
|
|
||||||
### Setting config
|
### Copy config
|
||||||
echo "Setting config..."
|
echo "Copying config..."
|
||||||
cp -Tf $srcdir/$pkgbase/config ./.config
|
cp -Tf "${startdir}/kconfig" ./.config
|
||||||
|
|
||||||
### Enable extra options
|
|
||||||
echo "Enable extra options..."
|
|
||||||
|
|
||||||
# General setup
|
|
||||||
scripts/config --set-str DEFAULT_HOSTNAME archlinux \
|
|
||||||
-e IKCONFIG \
|
|
||||||
-e IKCONFIG_PROC \
|
|
||||||
-u RT_GROUP_SCHED
|
|
||||||
|
|
||||||
# Power management and ACPI options
|
|
||||||
scripts/config -e ACPI_REV_OVERRIDE_POSSIBLE \
|
|
||||||
-e ACPI_TABLE_UPGRADE
|
|
||||||
|
|
||||||
# Virtualization
|
|
||||||
scripts/config -e KVM_SMM
|
|
||||||
|
|
||||||
# General architecture-dependent options
|
|
||||||
scripts/config -e KPROBES
|
|
||||||
|
|
||||||
# Enable loadable module support
|
|
||||||
scripts/config -u MODULE_SIG_FORCE \
|
|
||||||
-e MODULE_COMPRESS_ZSTD
|
|
||||||
|
|
||||||
# Networking support
|
|
||||||
scripts/config -e NETFILTER_INGRESS
|
|
||||||
|
|
||||||
# Device Drivers
|
|
||||||
scripts/config -e FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER \
|
|
||||||
-e DELL_SMBIOS_SMM \
|
|
||||||
-m PATA_JMICRON \
|
|
||||||
-E SOUND SOUND_OSS_CORE \
|
|
||||||
-e SND_OSSEMUL \
|
|
||||||
-M SND_OSSEMUL SND_MIXER_OSS \
|
|
||||||
-M SND_MIXER_OSS SND_PCM_OSS \
|
|
||||||
-E SND_PCM_OSS SND_PCM_OSS_PLUGINS \
|
|
||||||
-m AGP -M AGP AGP_INTEL -M AGP_INTEL AGP_VIA
|
|
||||||
|
|
||||||
# Kernel hacking -> Compile-time checks and compiler options -> Make section mismatch errors non-fatal
|
|
||||||
scripts/config -e SECTION_MISMATCH_WARN_ONLY
|
|
||||||
|
|
||||||
# File systems
|
|
||||||
scripts/config -m NTFS3_FS \
|
|
||||||
-e NTFS3_LZX_XPRESS \
|
|
||||||
-e NTFS3_FS_POSIX_ACL
|
|
||||||
|
|
||||||
scripts/config -m SMB_SERVER \
|
|
||||||
-e SMB_SERVER_SMBDIRECT \
|
|
||||||
-e SMB_SERVER_CHECK_CAP_NET_ADMIN \
|
|
||||||
-e SMB_SERVER_KERBEROS5
|
|
||||||
|
|
||||||
# Security options
|
|
||||||
scripts/config -e SECURITY_SELINUX \
|
|
||||||
-e SECURITY_SELINUX_BOOTPARAM \
|
|
||||||
-e SECURITY_SMACK \
|
|
||||||
-e SECURITY_SMACK_BRINGUP \
|
|
||||||
-e SECURITY_SMACK_NETFILTER \
|
|
||||||
-e SECURITY_SMACK_APPEND_SIGNALS \
|
|
||||||
-e SECURITY_TOMOYO \
|
|
||||||
-e SECURITY_APPARMOR \
|
|
||||||
-e SECURITY_YAMA
|
|
||||||
|
|
||||||
# Library routines
|
|
||||||
scripts/config -k -e FONT_TER16x32
|
|
||||||
|
|
||||||
if [ -n "$_use_llvm_lto" ]; then
|
if [ -n "$_use_llvm_lto" ]; then
|
||||||
scripts/config -d LTO_NONE \
|
scripts/config -d LTO_NONE \
|
||||||
|
@ -239,7 +177,7 @@ prepare() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
make ${BUILD_FLAGS[*]} olddefconfig
|
make ${BUILD_FLAGS[*]} olddefconfig
|
||||||
diff -u $srcdir/$pkgbase/config .config || :
|
diff -u $srcdir/cl-linux/config .config || :
|
||||||
|
|
||||||
# https://github.com/graysky2/kernel_compiler_patch
|
# https://github.com/graysky2/kernel_compiler_patch
|
||||||
# make sure to apply after olddefconfig to allow the next section
|
# make sure to apply after olddefconfig to allow the next section
|
||||||
|
@ -254,25 +192,10 @@ prepare() {
|
||||||
make ${BUILD_FLAGS[*]} oldconfig
|
make ${BUILD_FLAGS[*]} oldconfig
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Optionally use running kernel's config
|
|
||||||
# code originally by nous; http://aur.archlinux.org/packages.php?ID=40191
|
|
||||||
if [ -n "$_use_current" ]; then
|
|
||||||
if [[ -s /proc/config.gz ]]; then
|
|
||||||
echo "Extracting config from /proc/config.gz..."
|
|
||||||
# modprobe configs
|
|
||||||
zcat /proc/config.gz > ./.config
|
|
||||||
else
|
|
||||||
warning "Your kernel was not compiled with IKCONFIG_PROC!"
|
|
||||||
warning "You cannot read the current config!"
|
|
||||||
warning "Aborting!"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
### Optionally load needed modules for the make localmodconfig
|
### Optionally load needed modules for the make localmodconfig
|
||||||
# See https://aur.archlinux.org/packages/modprobed-db
|
# See https://aur.archlinux.org/packages/modprobed-db
|
||||||
if [ -n "$_localmodcfg" ]; then
|
if [ -n "$_localmodcfg" ]; then
|
||||||
if [ -e $HOME/.config/modprobed.db ]; then
|
if [ -e "$HOME/.config/modprobed.db" ]; then
|
||||||
echo "Running Steven Rostedt's make localmodconfig now"
|
echo "Running Steven Rostedt's make localmodconfig now"
|
||||||
make ${BUILD_FLAGS[*]} LSMOD=$HOME/.config/modprobed.db localmodconfig
|
make ${BUILD_FLAGS[*]} LSMOD=$HOME/.config/modprobed.db localmodconfig
|
||||||
else
|
else
|
||||||
|
@ -284,10 +207,11 @@ prepare() {
|
||||||
make -s kernelrelease > version
|
make -s kernelrelease > version
|
||||||
echo "Prepared $pkgbase version $(<version)"
|
echo "Prepared $pkgbase version $(<version)"
|
||||||
|
|
||||||
|
[[ -z "$_makexconfig" ]] || make ${BUILD_FLAGS[*]} xconfig
|
||||||
[[ -z "$_makenconfig" ]] || make ${BUILD_FLAGS[*]} nconfig
|
[[ -z "$_makenconfig" ]] || make ${BUILD_FLAGS[*]} nconfig
|
||||||
|
|
||||||
### Save configuration for later reuse
|
### Save configuration for later reuse
|
||||||
cp -Tf ./.config "${startdir}/config-${pkgver}-${pkgrel}${pkgbase#linux}"
|
[[ -z "$_copyfinalconfig" ]] || cp -Tf ./.config "${startdir}/finalconfig-${pkgver}-${pkgrel}${pkgbase#linux}"
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
@ -296,7 +220,7 @@ build() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_package() {
|
_package() {
|
||||||
pkgdesc="The $pkgdesc kernel and modules"
|
pkgdesc="${pkgdesc} This package includes the kernel and compiled modules."
|
||||||
depends=('coreutils' 'kmod' 'initramfs')
|
depends=('coreutils' 'kmod' 'initramfs')
|
||||||
optdepends=('wireless-regdb: to set the correct wireless channels of your country'
|
optdepends=('wireless-regdb: to set the correct wireless channels of your country'
|
||||||
'linux-firmware: firmware images needed for some devices'
|
'linux-firmware: firmware images needed for some devices'
|
||||||
|
@ -325,7 +249,7 @@ _package() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_package-headers() {
|
_package-headers() {
|
||||||
pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
|
pkgdesc="${pkgdesc} This package includes various headers and scripts for building modules."
|
||||||
depends=(pahole)
|
depends=(pahole)
|
||||||
|
|
||||||
cd ${_srcname}
|
cd ${_srcname}
|
||||||
|
|
Reference in a new issue