Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d4f3618ba5 | ||
|
432e560b92 | ||
|
4160cdc52b | ||
|
fb5ad72c94 | ||
|
65dc6bda2f | ||
|
44e228cc0f | ||
|
a0b63c0a3f | ||
|
231ecec0df | ||
|
de9e9855c2 | ||
|
a46f270646 | ||
|
5135834002 | ||
|
ff082aebba | ||
|
8ecdc882c3 | ||
|
e0c74e5e15 |
@@ -3,7 +3,7 @@
|
|||||||
# Linux distribution you are using, options are "Arch", "Ubuntu", "Debian", "Fedora", "Suse", "Gentoo", "Generic".
|
# Linux distribution you are using, options are "Arch", "Ubuntu", "Debian", "Fedora", "Suse", "Gentoo", "Generic".
|
||||||
# It is automatically set to "Arch" when using PKGBUILD.
|
# It is automatically set to "Arch" when using PKGBUILD.
|
||||||
# If left empty, the script will prompt
|
# If left empty, the script will prompt
|
||||||
_distro=""
|
_distro="Arch"
|
||||||
|
|
||||||
# Kernel Version - x.x format without the subversion (will always grab latest available subversion) is recommended
|
# Kernel Version - x.x format without the subversion (will always grab latest available subversion) is recommended
|
||||||
# you can also set a specific kernel version, e.g. "6.0-rc4" or "5.10.51",
|
# you can also set a specific kernel version, e.g. "6.0-rc4" or "5.10.51",
|
||||||
@@ -46,7 +46,7 @@ CUSTOM_GCC_PATH=""
|
|||||||
CUSTOM_LLVM_PATH=""
|
CUSTOM_LLVM_PATH=""
|
||||||
|
|
||||||
# Set to true to bypass makepkg.conf and use all available threads for compilation. False will respect your makepkg.conf options.
|
# Set to true to bypass makepkg.conf and use all available threads for compilation. False will respect your makepkg.conf options.
|
||||||
_force_all_threads="true"
|
_force_all_threads="false"
|
||||||
|
|
||||||
# Set to true to prevent ccache from being used and set CONFIG_GCC_PLUGINS=y (which needs to be disabled for ccache to work properly)
|
# Set to true to prevent ccache from being used and set CONFIG_GCC_PLUGINS=y (which needs to be disabled for ccache to work properly)
|
||||||
_noccache="false"
|
_noccache="false"
|
||||||
@@ -66,10 +66,10 @@ _modprobeddb="false"
|
|||||||
_modprobeddb_db_path=~/.config/modprobed.db
|
_modprobeddb_db_path=~/.config/modprobed.db
|
||||||
|
|
||||||
# Set to "1" to call make menuconfig, "2" to call make nconfig, "3" to call make xconfig, before building the kernel. Set to false to disable and skip the prompt.
|
# Set to "1" to call make menuconfig, "2" to call make nconfig, "3" to call make xconfig, before building the kernel. Set to false to disable and skip the prompt.
|
||||||
_menunconfig=""
|
_menunconfig="false"
|
||||||
|
|
||||||
# Set to true to generate a kernel config fragment from your changes in menuconfig/nconfig. Set to false to disable and skip the prompt.
|
# Set to true to generate a kernel config fragment from your changes in menuconfig/nconfig. Set to false to disable and skip the prompt.
|
||||||
_diffconfig=""
|
_diffconfig="false"
|
||||||
|
|
||||||
# Set to the file name where the generated config fragment should be written to. Only used if _diffconfig is active.
|
# Set to the file name where the generated config fragment should be written to. Only used if _diffconfig is active.
|
||||||
_diffconfig_name=""
|
_diffconfig_name=""
|
||||||
@@ -104,11 +104,11 @@ _STRIP="true"
|
|||||||
|
|
||||||
# CPU scheduler - Options are "pds", "bmq", "cacule", "tt", "bore", "bore-eevdf", "eevdf" or "cfs" (kernel's default)
|
# CPU scheduler - Options are "pds", "bmq", "cacule", "tt", "bore", "bore-eevdf", "eevdf" or "cfs" (kernel's default)
|
||||||
# "upds" (TkG's Undead PDS) and "muqss" are also available on legacy kernel revisions
|
# "upds" (TkG's Undead PDS) and "muqss" are also available on legacy kernel revisions
|
||||||
_cpusched=""
|
_cpusched="pds"
|
||||||
|
|
||||||
# Compiler to use - Options are "gcc" or "llvm".
|
# Compiler to use - Options are "gcc" or "llvm".
|
||||||
# For advanced users.
|
# For advanced users.
|
||||||
_compiler=""
|
_compiler="gcc"
|
||||||
|
|
||||||
# Force the use of the LLVM Integrated Assembler whether using LLVM, LTO or not.
|
# Force the use of the LLVM Integrated Assembler whether using LLVM, LTO or not.
|
||||||
# Set to "1" to enable.
|
# Set to "1" to enable.
|
||||||
@@ -138,7 +138,7 @@ _preempt_rt_force=""
|
|||||||
# For BMQ: 0: No yield.
|
# For BMQ: 0: No yield.
|
||||||
# 1: Deboost and requeue task. (Default)
|
# 1: Deboost and requeue task. (Default)
|
||||||
# 2: Set rq skip task.
|
# 2: Set rq skip task.
|
||||||
_sched_yield_type=""
|
_sched_yield_type="0"
|
||||||
|
|
||||||
# Round Robin interval is the longest duration two tasks with the same nice level will be delayed for. When CPU time is requested by a task, it receives a time slice equal
|
# Round Robin interval is the longest duration two tasks with the same nice level will be delayed for. When CPU time is requested by a task, it receives a time slice equal
|
||||||
# to the rr_interval in addition to a virtual deadline. When using yield_type 2, a low value can help offset the disadvantages of rescheduling a process that has yielded.
|
# to the rr_interval in addition to a virtual deadline. When using yield_type 2, a low value can help offset the disadvantages of rescheduling a process that has yielded.
|
||||||
@@ -146,7 +146,7 @@ _sched_yield_type=""
|
|||||||
# PDS default: 4ms"
|
# PDS default: 4ms"
|
||||||
# BMQ default: 2ms"
|
# BMQ default: 2ms"
|
||||||
# Set to "1" for 2ms, "2" for 4ms, "3" for 6ms, "4" for 8ms, or "default" to keep the chosen scheduler defaults.
|
# Set to "1" for 2ms, "2" for 4ms, "3" for 6ms, "4" for 8ms, or "default" to keep the chosen scheduler defaults.
|
||||||
_rr_interval=""
|
_rr_interval="default"
|
||||||
|
|
||||||
# Set to "true" to disable FUNCTION_TRACER/GRAPH_TRACER, lowering overhead but limiting debugging and analyzing of kernel functions - Kernel default is "false"
|
# Set to "true" to disable FUNCTION_TRACER/GRAPH_TRACER, lowering overhead but limiting debugging and analyzing of kernel functions - Kernel default is "false"
|
||||||
_ftracedisable="false"
|
_ftracedisable="false"
|
||||||
@@ -161,10 +161,10 @@ _misc_adds="true"
|
|||||||
# Full tickless can give higher performances in case you use isolation of CPUs for tasks
|
# Full tickless can give higher performances in case you use isolation of CPUs for tasks
|
||||||
# and it works only when using the nohz_full kernel parameter, otherwise behaves like idle.
|
# and it works only when using the nohz_full kernel parameter, otherwise behaves like idle.
|
||||||
# Just tickless idle perform better for most platforms.
|
# Just tickless idle perform better for most platforms.
|
||||||
_tickless=""
|
_tickless="2"
|
||||||
|
|
||||||
# Set to "true" to use ACS override patch - https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#Bypassing_the_IOMMU_groups_.28ACS_override_patch.29 - Kernel default is "false"
|
# Set to "true" to use ACS override patch - https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#Bypassing_the_IOMMU_groups_.28ACS_override_patch.29 - Kernel default is "false"
|
||||||
_acs_override=""
|
_acs_override="false"
|
||||||
|
|
||||||
# Set to "true" to add Bcache filesystem support. You'll have to install bcachefs-tools-git from AUR for utilities - https://bcachefs.org/ - If in doubt, set to "false"
|
# Set to "true" to add Bcache filesystem support. You'll have to install bcachefs-tools-git from AUR for utilities - https://bcachefs.org/ - If in doubt, set to "false"
|
||||||
# This can be buggy and isn't recommended on a production machine, also enabling this option will not allow you to enable MGLRU.
|
# This can be buggy and isn't recommended on a production machine, also enabling this option will not allow you to enable MGLRU.
|
||||||
@@ -175,7 +175,7 @@ _bcachefs="false"
|
|||||||
_winesync="false"
|
_winesync="false"
|
||||||
|
|
||||||
# Set to "true" to enable Binder modules to use Waydroid Android containers
|
# Set to "true" to enable Binder modules to use Waydroid Android containers
|
||||||
_waydroid=""
|
_waydroid="false"
|
||||||
|
|
||||||
# Various patches and tweaks from Zen/Liquorix, Xanmod and the community - Default is "true"
|
# Various patches and tweaks from Zen/Liquorix, Xanmod and the community - Default is "true"
|
||||||
_glitched_base="true"
|
_glitched_base="true"
|
||||||
@@ -185,7 +185,7 @@ _glitched_base="true"
|
|||||||
_zenify="true"
|
_zenify="true"
|
||||||
|
|
||||||
# compiler optimization level - 1. Optimize for performance (-O2); 2. Optimize harder (-O3); 3. Optimize for size (-Os) - Kernel default is "1"
|
# compiler optimization level - 1. Optimize for performance (-O2); 2. Optimize harder (-O3); 3. Optimize for size (-Os) - Kernel default is "1"
|
||||||
_compileroptlevel="1"
|
_compileroptlevel="2"
|
||||||
|
|
||||||
# CPU compiler optimizations - Defaults to prompt at kernel config if left empty
|
# CPU compiler optimizations - Defaults to prompt at kernel config if left empty
|
||||||
# AMD CPUs : "k8" "k8sse3" "k10" "barcelona" "bobcat" "jaguar" "bulldozer" "piledriver" "steamroller" "excavator" "zen" "zen2" "zen3" "zen4" (zen3 opt support depends on GCC11) (zen4 opt support depends on GCC13)
|
# AMD CPUs : "k8" "k8sse3" "k10" "barcelona" "bobcat" "jaguar" "bulldozer" "piledriver" "steamroller" "excavator" "zen" "zen2" "zen3" "zen4" (zen3 opt support depends on GCC11) (zen4 opt support depends on GCC13)
|
||||||
@@ -199,7 +199,7 @@ _compileroptlevel="1"
|
|||||||
# - "generic_v2" (depends on GCC11 - to share the package between machines with different CPU µarch supporting at least x86-64-v2
|
# - "generic_v2" (depends on GCC11 - to share the package between machines with different CPU µarch supporting at least x86-64-v2
|
||||||
# - "generic_v3" (depends on GCC11 - to share the package between machines with different CPU µarch supporting at least x86-64-v3
|
# - "generic_v3" (depends on GCC11 - to share the package between machines with different CPU µarch supporting at least x86-64-v3
|
||||||
# - "generic_v4" (depends on GCC11 - to share the package between machines with different CPU µarch supporting at least x86-64-v4
|
# - "generic_v4" (depends on GCC11 - to share the package between machines with different CPU µarch supporting at least x86-64-v4
|
||||||
_processor_opt=""
|
_processor_opt="skylake"
|
||||||
|
|
||||||
# CacULE only - Enable Response Driven Balancer, an experimental load balancer for CacULE
|
# CacULE only - Enable Response Driven Balancer, an experimental load balancer for CacULE
|
||||||
_cacule_rdb="false"
|
_cacule_rdb="false"
|
||||||
@@ -212,13 +212,13 @@ _cacule_rdb_interval="19"
|
|||||||
_tt_high_hz="false"
|
_tt_high_hz="false"
|
||||||
|
|
||||||
# MuQSS and PDS only - SMT (Hyperthreading) aware nice priority and policy support (SMT_NICE) - Kernel default is "true" - You can disable this on non-SMT/HT CPUs for lower overhead
|
# MuQSS and PDS only - SMT (Hyperthreading) aware nice priority and policy support (SMT_NICE) - Kernel default is "true" - You can disable this on non-SMT/HT CPUs for lower overhead
|
||||||
_smt_nice=""
|
_smt_nice="true"
|
||||||
|
|
||||||
# Trust the CPU manufacturer to initialize Linux's CRNG (RANDOM_TRUST_CPU) - Kernel default is "false"
|
# Trust the CPU manufacturer to initialize Linux's CRNG (RANDOM_TRUST_CPU) - Kernel default is "false"
|
||||||
_random_trust_cpu="true"
|
_random_trust_cpu="true"
|
||||||
|
|
||||||
# Timer frequency - "100" "250" "300" "500" "750" "1000" ("2000" is available for cacule cpusched only) - More options available in kernel config prompt when left empty depending on selected cpusched with the default option pointed with a ">" (2000 for cacule, 100 for muqss and 1000 for other cpu schedulers)
|
# Timer frequency - "100" "250" "300" "500" "750" "1000" ("2000" is available for cacule cpusched only) - More options available in kernel config prompt when left empty depending on selected cpusched with the default option pointed with a ">" (2000 for cacule, 100 for muqss and 1000 for other cpu schedulers)
|
||||||
_timer_freq=""
|
_timer_freq="1000"
|
||||||
|
|
||||||
# Default CPU governor - "performance", "ondemand", "schedutil" or leave empty for default (schedutil)
|
# Default CPU governor - "performance", "ondemand", "schedutil" or leave empty for default (schedutil)
|
||||||
_default_cpu_gov="ondemand"
|
_default_cpu_gov="ondemand"
|
||||||
@@ -234,7 +234,7 @@ _aggressive_ondemand="true"
|
|||||||
_tcp_cong_alg=""
|
_tcp_cong_alg=""
|
||||||
|
|
||||||
# You can pass a default set of kernel command line options here - example: "intel_pstate=passive nowatchdog amdgpu.ppfeaturemask=0xfffd7fff mitigations=off"
|
# You can pass a default set of kernel command line options here - example: "intel_pstate=passive nowatchdog amdgpu.ppfeaturemask=0xfffd7fff mitigations=off"
|
||||||
_custom_commandline="intel_pstate=passive split_lock_detect=off"
|
_custom_commandline=""
|
||||||
|
|
||||||
# Selection of Clearlinux patches
|
# Selection of Clearlinux patches
|
||||||
_clear_patches="true"
|
_clear_patches="true"
|
||||||
|
17
install.sh
17
install.sh
@@ -272,14 +272,29 @@ if [ "$1" = "install" ]; then
|
|||||||
_kernel_rpm="kernel-${_kernelname}*.rpm"
|
_kernel_rpm="kernel-${_kernelname}*.rpm"
|
||||||
# The headers are actually contained in the kernel-devel RPM and not the headers one...
|
# The headers are actually contained in the kernel-devel RPM and not the headers one...
|
||||||
_kernel_devel_rpm="kernel-devel-${_kernelname}*.rpm"
|
_kernel_devel_rpm="kernel-devel-${_kernelname}*.rpm"
|
||||||
|
_kernel_syms_rpm="kernel-syms-${_kernelname}*.rpm"
|
||||||
|
|
||||||
cd RPMS
|
cd RPMS
|
||||||
if [ "$_distro" = "Fedora" ]; then
|
if [ "$_distro" = "Fedora" ]; then
|
||||||
sudo dnf install $_kernel_rpm $_kernel_devel_rpm
|
sudo dnf install $_kernel_rpm $_kernel_devel_rpm
|
||||||
elif [ "$_distro" = "Suse" ]; then
|
elif [ "$_distro" = "Suse" ]; then
|
||||||
|
warning "By default, system kernel updates will overwrite your custom kernel."
|
||||||
|
warning "Adding a lock will prevent this but skip system kernel updates."
|
||||||
|
msg2 "You can remove the lock if needed with 'sudo zypper removelock kernel-default-devel kernel-default kernel-devel kernel-syms'"
|
||||||
|
read -p "Would you like to lock system kernel packages ? Y/[n]: " _lock
|
||||||
|
if [[ "$_lock" =~ ^(Y|y|Yes|yes)$ ]]; then
|
||||||
|
sudo zypper addlock kernel-default-devel kernel-default kernel-devel kernel-syms
|
||||||
|
fi
|
||||||
msg2 "Some files from 'linux-glibc-devel' will be replaced by files from the custom kernel-hearders package"
|
msg2 "Some files from 'linux-glibc-devel' will be replaced by files from the custom kernel-hearders package"
|
||||||
msg2 "To revert back to the original kernel headers do 'sudo zypper install -f linux-glibc-devel'"
|
msg2 "To revert back to the original kernel headers do 'sudo zypper install -f linux-glibc-devel'"
|
||||||
sudo zypper install --allow-unsigned-rpm $_kernel_rpm $_kernel_devel_rpm
|
sudo zypper install --oldpackage --allow-unsigned-rpm $_kernel_rpm $_kernel_devel_rpm $_kernel_syms_rpm
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$_distro" = "Suse" ]; then
|
||||||
|
msg2 "Creating initramfs"
|
||||||
|
sudo dracut --force --hostonly ${_dracut_options} --kver $_kernelname
|
||||||
|
msg2 "Updating GRUB"
|
||||||
|
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg2 "Install successful"
|
msg2 "Install successful"
|
||||||
|
@@ -659,7 +659,7 @@ _tkg_srcprep() {
|
|||||||
|
|
||||||
# PREEMPT_RT patch
|
# PREEMPT_RT patch
|
||||||
if [ "${_preempt_rt}" = "1" ]; then
|
if [ "${_preempt_rt}" = "1" ]; then
|
||||||
if [ ${_rt_subver_map[$_basekernel]+_} = "_" ]; then
|
if [ "${_rt_subver_map[$_basekernel]+_}" = "_" ]; then
|
||||||
preempt_rt_ksubver="${_rt_subver_map[$_basekernel]}"
|
preempt_rt_ksubver="${_rt_subver_map[$_basekernel]}"
|
||||||
# Check if subversion is supported, skip check if forced
|
# Check if subversion is supported, skip check if forced
|
||||||
if [ "${_preempt_rt_force}" = "1" ] || [ "${preempt_rt_ksubver}" = "${_sub}" ]; then
|
if [ "${_preempt_rt_force}" = "1" ] || [ "${preempt_rt_ksubver}" = "${_sub}" ]; then
|
||||||
@@ -704,6 +704,11 @@ _tkg_srcprep() {
|
|||||||
tkgpatch="$srcdir/0013-fedora-rpm.patch"
|
tkgpatch="$srcdir/0013-fedora-rpm.patch"
|
||||||
_msg="RPM: fixing spec generator" && _tkg_patcher
|
_msg="RPM: fixing spec generator" && _tkg_patcher
|
||||||
|
|
||||||
|
if [ "$_distro" = "Suse" ]; then
|
||||||
|
tkgpatch="$srcdir/0013-suse-additions.patch"
|
||||||
|
_msg="Import Suse-specific patches" && _tkg_patcher
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z $_misc_adds ]; then
|
if [ -z $_misc_adds ]; then
|
||||||
plain "Enable misc additions ? They may contain temporary fixes pending upstream, or some other changes that can break on non-Arch distros."
|
plain "Enable misc additions ? They may contain temporary fixes pending upstream, or some other changes that can break on non-Arch distros."
|
||||||
read -rp "`echo $' > [Y]/n : '`" _interactive_misc_adds;
|
read -rp "`echo $' > [Y]/n : '`" _interactive_misc_adds;
|
||||||
@@ -879,6 +884,7 @@ _tkg_srcprep() {
|
|||||||
scripts/config --set-str localversion ""
|
scripts/config --set-str localversion ""
|
||||||
else
|
else
|
||||||
_disable "LOCALVERSION_AUTO"
|
_disable "LOCALVERSION_AUTO"
|
||||||
|
scripts/config --set-str "DEFAULT_HOSTNAME" "(none)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z $_debug ]; then
|
if [ -z $_debug ]; then
|
||||||
|
400
linux-tkg-patches/6.1/0013-suse-additions.patch
Normal file
400
linux-tkg-patches/6.1/0013-suse-additions.patch
Normal file
@@ -0,0 +1,400 @@
|
|||||||
|
From: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Date: Wed, 7 Feb 2018 15:16:04 +0100
|
||||||
|
Subject: Add ksym-provides tool.
|
||||||
|
|
||||||
|
References: bsc#1077692
|
||||||
|
Patch-mainline: no, not needed
|
||||||
|
|
||||||
|
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
---
|
||||||
|
scripts/mod/Makefile | 6 +-
|
||||||
|
scripts/mod/ksym-provides.c | 124 ++++++++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 129 insertions(+), 1 deletion(-)
|
||||||
|
create mode 100644 scripts/mod/ksym-provides.c
|
||||||
|
|
||||||
|
--- a/scripts/mod/Makefile
|
||||||
|
+++ b/scripts/mod/Makefile
|
||||||
|
@@ -2,11 +2,15 @@
|
||||||
|
OBJECT_FILES_NON_STANDARD := y
|
||||||
|
CFLAGS_REMOVE_empty.o += $(CC_FLAGS_LTO)
|
||||||
|
|
||||||
|
-hostprogs-always-y += modpost mk_elfconfig
|
||||||
|
+hostprogs-always-y += modpost mk_elfconfig ksym-provides
|
||||||
|
always-y += empty.o
|
||||||
|
|
||||||
|
modpost-objs := modpost.o file2alias.o sumversion.o
|
||||||
|
|
||||||
|
+ksym-provides-objs := ksym-provides.o
|
||||||
|
+
|
||||||
|
+HOSTLDLIBS_ksym-provides := -lelf
|
||||||
|
+
|
||||||
|
devicetable-offsets-file := devicetable-offsets.h
|
||||||
|
|
||||||
|
$(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s FORCE
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/scripts/mod/ksym-provides.c
|
||||||
|
@@ -0,0 +1,124 @@
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <sys/stat.h>
|
||||||
|
+#include <fcntl.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include <gelf.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+
|
||||||
|
+int main(int argc, char *argv[])
|
||||||
|
+{
|
||||||
|
+ int fd;
|
||||||
|
+ Elf *elf;
|
||||||
|
+ Elf_Scn *scn;
|
||||||
|
+ GElf_Shdr shdr;
|
||||||
|
+ size_t strndx;
|
||||||
|
+ int ndx;
|
||||||
|
+ Elf_Data *symdata, *data;
|
||||||
|
+ GElf_Sym sym;
|
||||||
|
+ char *name;
|
||||||
|
+ const char * flavor = argv[1];
|
||||||
|
+ const char * prefix = "__crc_";
|
||||||
|
+ size_t prefixlen = strlen(prefix);
|
||||||
|
+ const char * symformat = "ksym(%s:%s) = %lx\n";
|
||||||
|
+
|
||||||
|
+ if (argc != 3) {
|
||||||
|
+ fprintf(stderr, "Usage: %s <flavor> <filename>\n", argv[0]);
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (elf_version(EV_CURRENT) == EV_NONE) {
|
||||||
|
+ fprintf(stderr, "libelf initialization failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ fd = open(argv[2], O_RDONLY);
|
||||||
|
+ if (fd < 0) {
|
||||||
|
+ perror("open failed");
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ elf = elf_begin(fd, ELF_C_READ, NULL);
|
||||||
|
+ if (!elf) {
|
||||||
|
+ fprintf(stderr, "elf_begin failed: %s\n", elf_errmsg(-1));
|
||||||
|
+ goto err_close;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ scn = NULL;
|
||||||
|
+ while ((scn = elf_nextscn(elf, scn)) != NULL) {
|
||||||
|
+ if (!gelf_getshdr(scn, &shdr)) {
|
||||||
|
+ fprintf(stderr, "gelf_getshdr failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (shdr.sh_type == SHT_SYMTAB)
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ if (!scn) {
|
||||||
|
+ fputs("symbol table not found\n", stderr);
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+ strndx = shdr.sh_link;
|
||||||
|
+
|
||||||
|
+ symdata = elf_getdata(scn, NULL);
|
||||||
|
+ if (!symdata) {
|
||||||
|
+ fprintf(stderr, "elf_getdata failed: %s\n", elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (ndx = 0; gelf_getsym(symdata, ndx, &sym) != NULL; ++ndx) {
|
||||||
|
+
|
||||||
|
+ name = elf_strptr(elf, strndx, sym.st_name);
|
||||||
|
+ if (!name) {
|
||||||
|
+ fprintf(stderr, "elf_strptr failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+ if (strncmp(prefix, name, prefixlen))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ if (sym.st_shndx >= SHN_LORESERVE) {
|
||||||
|
+ printf(symformat, flavor, name + prefixlen,
|
||||||
|
+ sym.st_value);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ scn = elf_getscn(elf, sym.st_shndx);
|
||||||
|
+ if (!scn) {
|
||||||
|
+ fprintf(stderr, "elf_getscn failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+ if (!gelf_getshdr(scn, &shdr)) {
|
||||||
|
+ fprintf(stderr, "gelf_getshdr failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (shdr.sh_type != SHT_PROGBITS)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ data = elf_getdata_rawchunk(
|
||||||
|
+ elf, shdr.sh_offset + sym.st_value - shdr.sh_addr,
|
||||||
|
+ sizeof(GElf_Word), ELF_T_WORD);
|
||||||
|
+ if (!data) {
|
||||||
|
+ fprintf(stderr, "elf_getdata_rawchunk failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+ printf(symformat, flavor, name + prefixlen,
|
||||||
|
+ (unsigned long) *(GElf_Word*)data->d_buf);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ elf_end(elf);
|
||||||
|
+ close(fd);
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ err_end:
|
||||||
|
+ elf_end(elf);
|
||||||
|
+ err_close:
|
||||||
|
+ close(fd);
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
|
||||||
|
From bb1a83cf109eee56c8dee26f7910c772f8c246fc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Date: Thu, 29 Jun 2023 17:47:16 +0200
|
||||||
|
Subject: [PATCH] depmod: Handle installing modules under a prefix
|
||||||
|
|
||||||
|
References: bsc#1212835
|
||||||
|
Patch-mainline: Never, upstream rejected
|
||||||
|
|
||||||
|
Some distributions aim at shipping all files in /usr.
|
||||||
|
|
||||||
|
The path under which kernel modules are installed is hardcoded to /lib
|
||||||
|
which conflicts with this goal.
|
||||||
|
|
||||||
|
When kmod provides the config command, use it to determine the correct
|
||||||
|
module installation path.
|
||||||
|
|
||||||
|
With kmod that does not provide the config command /lib/modules is used
|
||||||
|
as before.
|
||||||
|
|
||||||
|
Note: users can use
|
||||||
|
|
||||||
|
make MODLIB='$(INSTALL_MOD_PATH)/usr/lib/modules/$(KERNELRELEASE)'
|
||||||
|
|
||||||
|
to install modules from mainline kernel on usrmerged system.
|
||||||
|
Not great for KMPs, though
|
||||||
|
|
||||||
|
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Nacked-by: Masahiro Yamada <masahiroy@kernel.org>
|
||||||
|
---
|
||||||
|
v2: Avoid error on systems with kmod that does not support config
|
||||||
|
command
|
||||||
|
v3: More verbose commit message
|
||||||
|
v4:
|
||||||
|
- Document jq requirement
|
||||||
|
- fix bashism
|
||||||
|
- Update to getting full module path, not just additional prefix
|
||||||
|
v5: switch to pkgconfig
|
||||||
|
---
|
||||||
|
Makefile | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 658ec2b8aa74..5a1889fc43c7 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -1165,7 +1165,9 @@ export INSTALL_DTBS_PATH ?= $(INSTALL_PATH)/dtbs/$(KERNELRELEASE)
|
||||||
|
# makefile but the argument can be passed to make if needed.
|
||||||
|
#
|
||||||
|
|
||||||
|
-MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
|
||||||
|
+export KERNEL_MODULE_DIRECTORY := $(shell pkg-config --print-variables kmod 2>/dev/null | grep '^module_directory$$' >/dev/null && pkg-config --variable=module_directory kmod || echo /lib/modules)
|
||||||
|
+
|
||||||
|
+MODLIB = $(INSTALL_MOD_PATH)$(KERNEL_MODULE_DIRECTORY)/$(KERNELRELEASE)
|
||||||
|
export MODLIB
|
||||||
|
|
||||||
|
PHONY += prepare0
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
||||||
|
From 4d15c9fa058e6dee09324cfc93f48858d4296019 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Date: Tue, 18 Jul 2023 18:58:43 +0200
|
||||||
|
Subject: [PATCH] Revert "kbuild: Hack for depmod not handling X.Y versions"
|
||||||
|
|
||||||
|
References: bsc#1212835
|
||||||
|
Patch-mainline: v6.6-rc1
|
||||||
|
Git-commit: 4d15c9fa058e6dee09324cfc93f48858d4296019
|
||||||
|
|
||||||
|
Remove hack for ancient version of module-init-tools that was added in
|
||||||
|
Linux 3.0.
|
||||||
|
|
||||||
|
Since then module-init-tools was replaced with kmod.
|
||||||
|
|
||||||
|
This hack adds an additional indirection, and causes confusing errors
|
||||||
|
to be printed when depmod fails.
|
||||||
|
|
||||||
|
Reverts commit 8fc62e594253 ("kbuild: Do not write to builddir in modules_install")
|
||||||
|
Reverts commit bfe5424a8b31 ("kbuild: Hack for depmod not handling X.Y versions")
|
||||||
|
|
||||||
|
Link: https://lore.kernel.org/linux-modules/CAK7LNAQMs3QBYfWcLkmOQdbbq7cj=7wWbK=AWhdTC2rAsKHXzQ@mail.gmail.com/
|
||||||
|
|
||||||
|
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
|
||||||
|
---
|
||||||
|
scripts/depmod.sh | 27 +--------------------------
|
||||||
|
1 file changed, 1 insertion(+), 26 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/scripts/depmod.sh b/scripts/depmod.sh
|
||||||
|
index 3643b4f896ed..fca689ba4f21 100755
|
||||||
|
--- a/scripts/depmod.sh
|
||||||
|
+++ b/scripts/depmod.sh
|
||||||
|
@@ -23,33 +23,8 @@ if [ -z $(command -v $DEPMOD) ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
-# older versions of depmod require the version string to start with three
|
||||||
|
-# numbers, so we cheat with a symlink here
|
||||||
|
-depmod_hack_needed=true
|
||||||
|
-tmp_dir=$(mktemp -d ${TMPDIR:-/tmp}/depmod.XXXXXX)
|
||||||
|
-mkdir -p "$tmp_dir/lib/modules/$KERNELRELEASE"
|
||||||
|
-if "$DEPMOD" -b "$tmp_dir" $KERNELRELEASE 2>/dev/null; then
|
||||||
|
- if test -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep" -o \
|
||||||
|
- -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep.bin"; then
|
||||||
|
- depmod_hack_needed=false
|
||||||
|
- fi
|
||||||
|
-fi
|
||||||
|
-rm -rf "$tmp_dir"
|
||||||
|
-if $depmod_hack_needed; then
|
||||||
|
- symlink="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE"
|
||||||
|
- ln -s "$KERNELRELEASE" "$symlink"
|
||||||
|
- KERNELRELEASE=99.98.$KERNELRELEASE
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
set -- -ae -F System.map
|
||||||
|
if test -n "$INSTALL_MOD_PATH"; then
|
||||||
|
set -- "$@" -b "$INSTALL_MOD_PATH"
|
||||||
|
fi
|
||||||
|
-"$DEPMOD" "$@" "$KERNELRELEASE"
|
||||||
|
-ret=$?
|
||||||
|
-
|
||||||
|
-if $depmod_hack_needed; then
|
||||||
|
- rm -f "$symlink"
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-exit $ret
|
||||||
|
+exec "$DEPMOD" "$@" "$KERNELRELEASE"
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
||||||
|
From 0ec8a11bd6287ada08e6c13023ce47be5cdc4270 Mon Sep 17 00:00:00 2001
|
||||||
|
From: tkg <tkg@froggi.es>
|
||||||
|
Date: Sat, 9 Sep 2023 00:48:37 +0200
|
||||||
|
Subject: mkspec: Suse is using /usr/lib instead of the standard /lib symlink. Adapt.
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
|
||||||
|
index de170760d..2b5ee7b35 100755
|
||||||
|
--- a/scripts/package/mkspec
|
||||||
|
+++ b/scripts/package/mkspec
|
||||||
|
@@ -121,11 +121,11 @@ $S
|
||||||
|
$MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
|
||||||
|
cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
|
||||||
|
cp .config %{buildroot}/boot/config-$KERNELRELEASE
|
||||||
|
-$S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build
|
||||||
|
-$S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/source
|
||||||
|
+$S$M rm -f %{buildroot}/usr/lib/modules/$KERNELRELEASE/build
|
||||||
|
+$S$M rm -f %{buildroot}/usr/lib/modules/$KERNELRELEASE/source
|
||||||
|
$S$M mkdir -p %{buildroot}/usr/src/kernels/$KERNELRELEASE
|
||||||
|
$S$M tar cf - $EXCLUDES . | tar xf - -C %{buildroot}/usr/src/kernels/$KERNELRELEASE
|
||||||
|
-$S$M cd %{buildroot}/lib/modules/$KERNELRELEASE
|
||||||
|
+$S$M cd %{buildroot}/usr/lib/modules/$KERNELRELEASE
|
||||||
|
$S$M ln -sf /usr/src/kernels/$KERNELRELEASE build
|
||||||
|
$S$M ln -sf /usr/src/kernels/$KERNELRELEASE source
|
||||||
|
|
||||||
|
@@ -159,9 +159,9 @@ $S$M ln -sf /usr/src/kernels/$KERNELRELEASE source
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr (-, root, root)
|
||||||
|
-$M /lib/modules/$KERNELRELEASE
|
||||||
|
-$M %exclude /lib/modules/$KERNELRELEASE/build
|
||||||
|
-$M %exclude /lib/modules/$KERNELRELEASE/source
|
||||||
|
+$M /usr/lib/modules/$KERNELRELEASE
|
||||||
|
+$M %exclude /usr/lib/modules/$KERNELRELEASE/build
|
||||||
|
+$M %exclude /usr/lib/modules/$KERNELRELEASE/source
|
||||||
|
/boot/*
|
||||||
|
|
||||||
|
%files headers
|
||||||
|
@@ -171,6 +171,6 @@ $S$M
|
||||||
|
$S$M %files devel
|
||||||
|
$S$M %defattr (-, root, root)
|
||||||
|
$S$M /usr/src/kernels/$KERNELRELEASE
|
||||||
|
-$S$M /lib/modules/$KERNELRELEASE/build
|
||||||
|
-$S$M /lib/modules/$KERNELRELEASE/source
|
||||||
|
+$S$M /usr/lib/modules/$KERNELRELEASE/build
|
||||||
|
+$S$M /usr/lib/modules/$KERNELRELEASE/source
|
||||||
|
EOF
|
||||||
|
|
||||||
|
From 23133fe6745d567db5b93dc9e6aecc32d31354bd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeff Mahoney <jeffm@suse.de>
|
||||||
|
Date: Tue, 31 Mar 2009 09:46:30 -0400
|
||||||
|
Subject: [PATCH] - doc/README.KSYMS: Add to repo.
|
||||||
|
|
||||||
|
---
|
||||||
|
doc/README.KSYMS | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
create mode 100644 doc/README.KSYMS
|
||||||
|
|
||||||
|
diff --git a/doc/README.KSYMS b/doc/README.KSYMS
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000000..39fe7878174
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/doc/README.KSYMS
|
||||||
|
@@ -0,0 +1,6 @@
|
||||||
|
+This file is a place holder for the kernel-syms{,-rt} package. It is used
|
||||||
|
+to group build dependencies for all kernel flavors.
|
||||||
|
+
|
||||||
|
+The KMP build process will build KMPs against all installed kernel flavors
|
||||||
|
+automatically. If you don't need to build against other flavors than the
|
||||||
|
+ones you've already installed - it is safe to uninstall this package.
|
||||||
|
|
||||||
|
From 5cd5e149a95d37746a89850f4beddef4f0ad2224 Mon Sep 17 00:00:00 2001
|
||||||
|
From: tkg <tkg@froggi.es>
|
||||||
|
Date: Sat, 9 Sep 2023 14:06:44 +0200
|
||||||
|
Subject: Suse: Add kernel-syms package
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
|
||||||
|
index ff8c33ead..51c94131e 100755
|
||||||
|
--- a/scripts/package/mkspec
|
||||||
|
+++ b/scripts/package/mkspec
|
||||||
|
@@ -88,6 +88,19 @@ $S$M %description -n kernel-devel
|
||||||
|
$S$M This package provides kernel headers and makefiles sufficient to build modules
|
||||||
|
$S$M against the $__KERNELRELEASE kernel package.
|
||||||
|
$S$M
|
||||||
|
+$S$M %package syms
|
||||||
|
+$S$M Summary: Kernel Symbol Versions (modversions) for the $__KERNELRELEASE kernel
|
||||||
|
+$S$M Group: Development/Sources
|
||||||
|
+$S$M AutoReqProv: no
|
||||||
|
+$S$M Provides: kernel-syms = %{version}
|
||||||
|
+$S$M Requires: kernel-devel = %{version}
|
||||||
|
+$S$M %description -n kernel-syms
|
||||||
|
+$S$M Kernel symbols, such as functions and variables, have version
|
||||||
|
+$S$M information attached to them. This package contains the symbol versions
|
||||||
|
+$S$M for the standard kernels.
|
||||||
|
+$S$M This package is needed for compiling kernel module packages with proper
|
||||||
|
+$S$M package dependencies.
|
||||||
|
+
|
||||||
|
$S # Opt out of a lot of Fedora hardening flags etc...
|
||||||
|
$S # See https://src.fedoraproject.org/rpms/redhat-rpm-config//blob/rawhide/f/buildflags.md
|
||||||
|
$S %undefine _package_note_file
|
||||||
|
@@ -173,4 +189,8 @@ $S$M %defattr (-, root, root)
|
||||||
|
$S$M /usr/src/kernels/$KERNELRELEASE
|
||||||
|
$S$M /usr/lib/modules/$KERNELRELEASE/build
|
||||||
|
$S$M /usr/lib/modules/$KERNELRELEASE/source
|
||||||
|
+$S$M
|
||||||
|
+$S$M %files syms
|
||||||
|
+$S$M %defattr (-, root, root)
|
||||||
|
+$S$M /usr/src/kernels/$KERNELRELEASE/doc
|
||||||
|
EOF
|
409
linux-tkg-patches/6.4/0013-suse-additions.patch
Normal file
409
linux-tkg-patches/6.4/0013-suse-additions.patch
Normal file
@@ -0,0 +1,409 @@
|
|||||||
|
From: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Date: Wed, 7 Feb 2018 15:16:04 +0100
|
||||||
|
Subject: Add ksym-provides tool.
|
||||||
|
|
||||||
|
References: bsc#1077692
|
||||||
|
Patch-mainline: no, not needed
|
||||||
|
|
||||||
|
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
---
|
||||||
|
scripts/mod/Makefile | 6 +-
|
||||||
|
scripts/mod/ksym-provides.c | 124 ++++++++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 129 insertions(+), 1 deletion(-)
|
||||||
|
create mode 100644 scripts/mod/ksym-provides.c
|
||||||
|
|
||||||
|
--- a/scripts/mod/Makefile
|
||||||
|
+++ b/scripts/mod/Makefile
|
||||||
|
@@ -2,11 +2,15 @@
|
||||||
|
OBJECT_FILES_NON_STANDARD := y
|
||||||
|
CFLAGS_REMOVE_empty.o += $(CC_FLAGS_LTO)
|
||||||
|
|
||||||
|
-hostprogs-always-y += modpost mk_elfconfig
|
||||||
|
+hostprogs-always-y += modpost mk_elfconfig ksym-provides
|
||||||
|
always-y += empty.o
|
||||||
|
|
||||||
|
modpost-objs := modpost.o file2alias.o sumversion.o
|
||||||
|
|
||||||
|
+ksym-provides-objs := ksym-provides.o
|
||||||
|
+
|
||||||
|
+HOSTLDLIBS_ksym-provides := -lelf
|
||||||
|
+
|
||||||
|
devicetable-offsets-file := devicetable-offsets.h
|
||||||
|
|
||||||
|
$(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s FORCE
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/scripts/mod/ksym-provides.c
|
||||||
|
@@ -0,0 +1,124 @@
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <sys/stat.h>
|
||||||
|
+#include <fcntl.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include <gelf.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+
|
||||||
|
+int main(int argc, char *argv[])
|
||||||
|
+{
|
||||||
|
+ int fd;
|
||||||
|
+ Elf *elf;
|
||||||
|
+ Elf_Scn *scn;
|
||||||
|
+ GElf_Shdr shdr;
|
||||||
|
+ size_t strndx;
|
||||||
|
+ int ndx;
|
||||||
|
+ Elf_Data *symdata, *data;
|
||||||
|
+ GElf_Sym sym;
|
||||||
|
+ char *name;
|
||||||
|
+ const char * flavor = argv[1];
|
||||||
|
+ const char * prefix = "__crc_";
|
||||||
|
+ size_t prefixlen = strlen(prefix);
|
||||||
|
+ const char * symformat = "ksym(%s:%s) = %lx\n";
|
||||||
|
+
|
||||||
|
+ if (argc != 3) {
|
||||||
|
+ fprintf(stderr, "Usage: %s <flavor> <filename>\n", argv[0]);
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (elf_version(EV_CURRENT) == EV_NONE) {
|
||||||
|
+ fprintf(stderr, "libelf initialization failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ fd = open(argv[2], O_RDONLY);
|
||||||
|
+ if (fd < 0) {
|
||||||
|
+ perror("open failed");
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ elf = elf_begin(fd, ELF_C_READ, NULL);
|
||||||
|
+ if (!elf) {
|
||||||
|
+ fprintf(stderr, "elf_begin failed: %s\n", elf_errmsg(-1));
|
||||||
|
+ goto err_close;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ scn = NULL;
|
||||||
|
+ while ((scn = elf_nextscn(elf, scn)) != NULL) {
|
||||||
|
+ if (!gelf_getshdr(scn, &shdr)) {
|
||||||
|
+ fprintf(stderr, "gelf_getshdr failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (shdr.sh_type == SHT_SYMTAB)
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ if (!scn) {
|
||||||
|
+ fputs("symbol table not found\n", stderr);
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+ strndx = shdr.sh_link;
|
||||||
|
+
|
||||||
|
+ symdata = elf_getdata(scn, NULL);
|
||||||
|
+ if (!symdata) {
|
||||||
|
+ fprintf(stderr, "elf_getdata failed: %s\n", elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (ndx = 0; gelf_getsym(symdata, ndx, &sym) != NULL; ++ndx) {
|
||||||
|
+
|
||||||
|
+ name = elf_strptr(elf, strndx, sym.st_name);
|
||||||
|
+ if (!name) {
|
||||||
|
+ fprintf(stderr, "elf_strptr failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+ if (strncmp(prefix, name, prefixlen))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ if (sym.st_shndx >= SHN_LORESERVE) {
|
||||||
|
+ printf(symformat, flavor, name + prefixlen,
|
||||||
|
+ sym.st_value);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ scn = elf_getscn(elf, sym.st_shndx);
|
||||||
|
+ if (!scn) {
|
||||||
|
+ fprintf(stderr, "elf_getscn failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+ if (!gelf_getshdr(scn, &shdr)) {
|
||||||
|
+ fprintf(stderr, "gelf_getshdr failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (shdr.sh_type != SHT_PROGBITS)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ data = elf_getdata_rawchunk(
|
||||||
|
+ elf, shdr.sh_offset + sym.st_value - shdr.sh_addr,
|
||||||
|
+ sizeof(GElf_Word), ELF_T_WORD);
|
||||||
|
+ if (!data) {
|
||||||
|
+ fprintf(stderr, "elf_getdata_rawchunk failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+ printf(symformat, flavor, name + prefixlen,
|
||||||
|
+ (unsigned long) *(GElf_Word*)data->d_buf);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ elf_end(elf);
|
||||||
|
+ close(fd);
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ err_end:
|
||||||
|
+ elf_end(elf);
|
||||||
|
+ err_close:
|
||||||
|
+ close(fd);
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
|
||||||
|
From bb1a83cf109eee56c8dee26f7910c772f8c246fc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Date: Thu, 29 Jun 2023 17:47:16 +0200
|
||||||
|
Subject: [PATCH] depmod: Handle installing modules under a prefix
|
||||||
|
|
||||||
|
References: bsc#1212835
|
||||||
|
Patch-mainline: Never, upstream rejected
|
||||||
|
|
||||||
|
Some distributions aim at shipping all files in /usr.
|
||||||
|
|
||||||
|
The path under which kernel modules are installed is hardcoded to /lib
|
||||||
|
which conflicts with this goal.
|
||||||
|
|
||||||
|
When kmod provides the config command, use it to determine the correct
|
||||||
|
module installation path.
|
||||||
|
|
||||||
|
With kmod that does not provide the config command /lib/modules is used
|
||||||
|
as before.
|
||||||
|
|
||||||
|
Note: users can use
|
||||||
|
|
||||||
|
make MODLIB='$(INSTALL_MOD_PATH)/usr/lib/modules/$(KERNELRELEASE)'
|
||||||
|
|
||||||
|
to install modules from mainline kernel on usrmerged system.
|
||||||
|
Not great for KMPs, though
|
||||||
|
|
||||||
|
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Nacked-by: Masahiro Yamada <masahiroy@kernel.org>
|
||||||
|
---
|
||||||
|
v2: Avoid error on systems with kmod that does not support config
|
||||||
|
command
|
||||||
|
v3: More verbose commit message
|
||||||
|
v4:
|
||||||
|
- Document jq requirement
|
||||||
|
- fix bashism
|
||||||
|
- Update to getting full module path, not just additional prefix
|
||||||
|
v5: switch to pkgconfig
|
||||||
|
---
|
||||||
|
Makefile | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 658ec2b8aa74..5a1889fc43c7 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -1165,7 +1165,9 @@ export INSTALL_DTBS_PATH ?= $(INSTALL_PATH)/dtbs/$(KERNELRELEASE)
|
||||||
|
# makefile but the argument can be passed to make if needed.
|
||||||
|
#
|
||||||
|
|
||||||
|
-MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
|
||||||
|
+export KERNEL_MODULE_DIRECTORY := $(shell pkg-config --print-variables kmod 2>/dev/null | grep '^module_directory$$' >/dev/null && pkg-config --variable=module_directory kmod || echo /lib/modules)
|
||||||
|
+
|
||||||
|
+MODLIB = $(INSTALL_MOD_PATH)$(KERNEL_MODULE_DIRECTORY)/$(KERNELRELEASE)
|
||||||
|
export MODLIB
|
||||||
|
|
||||||
|
PHONY += prepare0
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
||||||
|
From 4d15c9fa058e6dee09324cfc93f48858d4296019 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Date: Tue, 18 Jul 2023 18:58:43 +0200
|
||||||
|
Subject: [PATCH] Revert "kbuild: Hack for depmod not handling X.Y versions"
|
||||||
|
|
||||||
|
References: bsc#1212835
|
||||||
|
Patch-mainline: v6.6-rc1
|
||||||
|
Git-commit: 4d15c9fa058e6dee09324cfc93f48858d4296019
|
||||||
|
|
||||||
|
Remove hack for ancient version of module-init-tools that was added in
|
||||||
|
Linux 3.0.
|
||||||
|
|
||||||
|
Since then module-init-tools was replaced with kmod.
|
||||||
|
|
||||||
|
This hack adds an additional indirection, and causes confusing errors
|
||||||
|
to be printed when depmod fails.
|
||||||
|
|
||||||
|
Reverts commit 8fc62e594253 ("kbuild: Do not write to builddir in modules_install")
|
||||||
|
Reverts commit bfe5424a8b31 ("kbuild: Hack for depmod not handling X.Y versions")
|
||||||
|
|
||||||
|
Link: https://lore.kernel.org/linux-modules/CAK7LNAQMs3QBYfWcLkmOQdbbq7cj=7wWbK=AWhdTC2rAsKHXzQ@mail.gmail.com/
|
||||||
|
|
||||||
|
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
|
||||||
|
---
|
||||||
|
scripts/depmod.sh | 27 +--------------------------
|
||||||
|
1 file changed, 1 insertion(+), 26 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/scripts/depmod.sh b/scripts/depmod.sh
|
||||||
|
index 3643b4f896ed..fca689ba4f21 100755
|
||||||
|
--- a/scripts/depmod.sh
|
||||||
|
+++ b/scripts/depmod.sh
|
||||||
|
@@ -23,33 +23,8 @@ if [ -z $(command -v $DEPMOD) ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
-# older versions of depmod require the version string to start with three
|
||||||
|
-# numbers, so we cheat with a symlink here
|
||||||
|
-depmod_hack_needed=true
|
||||||
|
-tmp_dir=$(mktemp -d ${TMPDIR:-/tmp}/depmod.XXXXXX)
|
||||||
|
-mkdir -p "$tmp_dir/lib/modules/$KERNELRELEASE"
|
||||||
|
-if "$DEPMOD" -b "$tmp_dir" $KERNELRELEASE 2>/dev/null; then
|
||||||
|
- if test -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep" -o \
|
||||||
|
- -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep.bin"; then
|
||||||
|
- depmod_hack_needed=false
|
||||||
|
- fi
|
||||||
|
-fi
|
||||||
|
-rm -rf "$tmp_dir"
|
||||||
|
-if $depmod_hack_needed; then
|
||||||
|
- symlink="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE"
|
||||||
|
- ln -s "$KERNELRELEASE" "$symlink"
|
||||||
|
- KERNELRELEASE=99.98.$KERNELRELEASE
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
set -- -ae -F System.map
|
||||||
|
if test -n "$INSTALL_MOD_PATH"; then
|
||||||
|
set -- "$@" -b "$INSTALL_MOD_PATH"
|
||||||
|
fi
|
||||||
|
-"$DEPMOD" "$@" "$KERNELRELEASE"
|
||||||
|
-ret=$?
|
||||||
|
-
|
||||||
|
-if $depmod_hack_needed; then
|
||||||
|
- rm -f "$symlink"
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-exit $ret
|
||||||
|
+exec "$DEPMOD" "$@" "$KERNELRELEASE"
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
||||||
|
From 0ec8a11bd6287ada08e6c13023ce47be5cdc4270 Mon Sep 17 00:00:00 2001
|
||||||
|
From: tkg <tkg@froggi.es>
|
||||||
|
Date: Sat, 9 Sep 2023 00:48:37 +0200
|
||||||
|
Subject: mkspec: Suse is using /usr/lib instead of the standard /lib symlink. Adapt.
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
|
||||||
|
index de170760d..2b5ee7b35 100755
|
||||||
|
--- a/scripts/package/mkspec
|
||||||
|
+++ b/scripts/package/mkspec
|
||||||
|
@@ -121,11 +121,11 @@ $S
|
||||||
|
$MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
|
||||||
|
cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
|
||||||
|
cp .config %{buildroot}/boot/config-$KERNELRELEASE
|
||||||
|
-$S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build
|
||||||
|
-$S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/source
|
||||||
|
+$S$M rm -f %{buildroot}/usr/lib/modules/$KERNELRELEASE/build
|
||||||
|
+$S$M rm -f %{buildroot}/usr/lib/modules/$KERNELRELEASE/source
|
||||||
|
$S$M mkdir -p %{buildroot}/usr/src/kernels/$KERNELRELEASE
|
||||||
|
$S$M tar cf - $EXCLUDES . | tar xf - -C %{buildroot}/usr/src/kernels/$KERNELRELEASE
|
||||||
|
-$S$M cd %{buildroot}/lib/modules/$KERNELRELEASE
|
||||||
|
+$S$M cd %{buildroot}/usr/lib/modules/$KERNELRELEASE
|
||||||
|
$S$M ln -sf /usr/src/kernels/$KERNELRELEASE build
|
||||||
|
$S$M ln -sf /usr/src/kernels/$KERNELRELEASE source
|
||||||
|
|
||||||
|
@@ -159,9 +159,9 @@ $S$M ln -sf /usr/src/kernels/$KERNELRELEASE source
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr (-, root, root)
|
||||||
|
-$M /lib/modules/$KERNELRELEASE
|
||||||
|
-$M %exclude /lib/modules/$KERNELRELEASE/build
|
||||||
|
-$M %exclude /lib/modules/$KERNELRELEASE/source
|
||||||
|
+$M /usr/lib/modules/$KERNELRELEASE
|
||||||
|
+$M %exclude /usr/lib/modules/$KERNELRELEASE/build
|
||||||
|
+$M %exclude /usr/lib/modules/$KERNELRELEASE/source
|
||||||
|
/boot/*
|
||||||
|
|
||||||
|
%files headers
|
||||||
|
@@ -171,6 +171,6 @@ $S$M
|
||||||
|
$S$M %files devel
|
||||||
|
$S$M %defattr (-, root, root)
|
||||||
|
$S$M /usr/src/kernels/$KERNELRELEASE
|
||||||
|
-$S$M /lib/modules/$KERNELRELEASE/build
|
||||||
|
-$S$M /lib/modules/$KERNELRELEASE/source
|
||||||
|
+$S$M /usr/lib/modules/$KERNELRELEASE/build
|
||||||
|
+$S$M /usr/lib/modules/$KERNELRELEASE/source
|
||||||
|
EOF
|
||||||
|
|
||||||
|
From 23133fe6745d567db5b93dc9e6aecc32d31354bd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeff Mahoney <jeffm@suse.de>
|
||||||
|
Date: Tue, 31 Mar 2009 09:46:30 -0400
|
||||||
|
Subject: [PATCH] - doc/README.KSYMS: Add to repo.
|
||||||
|
|
||||||
|
---
|
||||||
|
doc/README.KSYMS | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
create mode 100644 doc/README.KSYMS
|
||||||
|
|
||||||
|
diff --git a/doc/README.KSYMS b/doc/README.KSYMS
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000000..39fe7878174
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/doc/README.KSYMS
|
||||||
|
@@ -0,0 +1,6 @@
|
||||||
|
+This file is a place holder for the kernel-syms{,-rt} package. It is used
|
||||||
|
+to group build dependencies for all kernel flavors.
|
||||||
|
+
|
||||||
|
+The KMP build process will build KMPs against all installed kernel flavors
|
||||||
|
+automatically. If you don't need to build against other flavors than the
|
||||||
|
+ones you've already installed - it is safe to uninstall this package.
|
||||||
|
|
||||||
|
From 5cd5e149a95d37746a89850f4beddef4f0ad2224 Mon Sep 17 00:00:00 2001
|
||||||
|
From: tkg <tkg@froggi.es>
|
||||||
|
Date: Sat, 9 Sep 2023 14:06:44 +0200
|
||||||
|
Subject: Suse: Add kernel-syms package
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
|
||||||
|
index ff8c33ead..51c94131e 100755
|
||||||
|
--- a/scripts/package/mkspec
|
||||||
|
+++ b/scripts/package/mkspec
|
||||||
|
@@ -52,7 +52,7 @@ $S Source1: config
|
||||||
|
$S Source2: diff.patch
|
||||||
|
Provides: kernel-$KERNELRELEASE
|
||||||
|
Provides: kernel-uname-r = %{version}
|
||||||
|
-$S BuildRequires: bc binutils bison dwarves
|
||||||
|
+$S BuildRequires: bc binutils bison dwarves coreutils
|
||||||
|
$S BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
|
||||||
|
$S BuildRequires: gcc make openssl openssl-devel perl python3 rsync
|
||||||
|
|
||||||
|
@@ -88,6 +88,19 @@ $S$M %description -n kernel-devel
|
||||||
|
$S$M This package provides kernel headers and makefiles sufficient to build modules
|
||||||
|
$S$M against the $__KERNELRELEASE kernel package.
|
||||||
|
$S$M
|
||||||
|
+$S$M %package syms
|
||||||
|
+$S$M Summary: Kernel Symbol Versions (modversions) for the $__KERNELRELEASE kernel
|
||||||
|
+$S$M Group: Development/Sources
|
||||||
|
+$S$M AutoReqProv: no
|
||||||
|
+$S$M Provides: kernel-syms = %{version}
|
||||||
|
+$S$M Requires: kernel-devel = %{version}
|
||||||
|
+$S$M %description -n kernel-syms
|
||||||
|
+$S$M Kernel symbols, such as functions and variables, have version
|
||||||
|
+$S$M information attached to them. This package contains the symbol versions
|
||||||
|
+$S$M for the standard kernels.
|
||||||
|
+$S$M This package is needed for compiling kernel module packages with proper
|
||||||
|
+$S$M package dependencies.
|
||||||
|
+
|
||||||
|
$S # Opt out of a lot of Fedora hardening flags etc...
|
||||||
|
$S # See https://src.fedoraproject.org/rpms/redhat-rpm-config//blob/rawhide/f/buildflags.md
|
||||||
|
$S %undefine _package_note_file
|
||||||
|
@@ -173,4 +189,8 @@ $S$M %defattr (-, root, root)
|
||||||
|
$S$M /usr/src/kernels/$KERNELRELEASE
|
||||||
|
$S$M /usr/lib/modules/$KERNELRELEASE/build
|
||||||
|
$S$M /usr/lib/modules/$KERNELRELEASE/source
|
||||||
|
+$S$M
|
||||||
|
+$S$M %files syms
|
||||||
|
+$S$M %defattr (-, root, root)
|
||||||
|
+$S$M /usr/src/kernels/$KERNELRELEASE/doc
|
||||||
|
EOF
|
409
linux-tkg-patches/6.5/0013-suse-additions.patch
Normal file
409
linux-tkg-patches/6.5/0013-suse-additions.patch
Normal file
@@ -0,0 +1,409 @@
|
|||||||
|
From: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Date: Wed, 7 Feb 2018 15:16:04 +0100
|
||||||
|
Subject: Add ksym-provides tool.
|
||||||
|
|
||||||
|
References: bsc#1077692
|
||||||
|
Patch-mainline: no, not needed
|
||||||
|
|
||||||
|
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
---
|
||||||
|
scripts/mod/Makefile | 6 +-
|
||||||
|
scripts/mod/ksym-provides.c | 124 ++++++++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 129 insertions(+), 1 deletion(-)
|
||||||
|
create mode 100644 scripts/mod/ksym-provides.c
|
||||||
|
|
||||||
|
--- a/scripts/mod/Makefile
|
||||||
|
+++ b/scripts/mod/Makefile
|
||||||
|
@@ -2,11 +2,15 @@
|
||||||
|
OBJECT_FILES_NON_STANDARD := y
|
||||||
|
CFLAGS_REMOVE_empty.o += $(CC_FLAGS_LTO)
|
||||||
|
|
||||||
|
-hostprogs-always-y += modpost mk_elfconfig
|
||||||
|
+hostprogs-always-y += modpost mk_elfconfig ksym-provides
|
||||||
|
always-y += empty.o
|
||||||
|
|
||||||
|
modpost-objs := modpost.o file2alias.o sumversion.o
|
||||||
|
|
||||||
|
+ksym-provides-objs := ksym-provides.o
|
||||||
|
+
|
||||||
|
+HOSTLDLIBS_ksym-provides := -lelf
|
||||||
|
+
|
||||||
|
devicetable-offsets-file := devicetable-offsets.h
|
||||||
|
|
||||||
|
$(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s FORCE
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/scripts/mod/ksym-provides.c
|
||||||
|
@@ -0,0 +1,124 @@
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <sys/stat.h>
|
||||||
|
+#include <fcntl.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include <gelf.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+
|
||||||
|
+int main(int argc, char *argv[])
|
||||||
|
+{
|
||||||
|
+ int fd;
|
||||||
|
+ Elf *elf;
|
||||||
|
+ Elf_Scn *scn;
|
||||||
|
+ GElf_Shdr shdr;
|
||||||
|
+ size_t strndx;
|
||||||
|
+ int ndx;
|
||||||
|
+ Elf_Data *symdata, *data;
|
||||||
|
+ GElf_Sym sym;
|
||||||
|
+ char *name;
|
||||||
|
+ const char * flavor = argv[1];
|
||||||
|
+ const char * prefix = "__crc_";
|
||||||
|
+ size_t prefixlen = strlen(prefix);
|
||||||
|
+ const char * symformat = "ksym(%s:%s) = %lx\n";
|
||||||
|
+
|
||||||
|
+ if (argc != 3) {
|
||||||
|
+ fprintf(stderr, "Usage: %s <flavor> <filename>\n", argv[0]);
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (elf_version(EV_CURRENT) == EV_NONE) {
|
||||||
|
+ fprintf(stderr, "libelf initialization failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ fd = open(argv[2], O_RDONLY);
|
||||||
|
+ if (fd < 0) {
|
||||||
|
+ perror("open failed");
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ elf = elf_begin(fd, ELF_C_READ, NULL);
|
||||||
|
+ if (!elf) {
|
||||||
|
+ fprintf(stderr, "elf_begin failed: %s\n", elf_errmsg(-1));
|
||||||
|
+ goto err_close;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ scn = NULL;
|
||||||
|
+ while ((scn = elf_nextscn(elf, scn)) != NULL) {
|
||||||
|
+ if (!gelf_getshdr(scn, &shdr)) {
|
||||||
|
+ fprintf(stderr, "gelf_getshdr failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (shdr.sh_type == SHT_SYMTAB)
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ if (!scn) {
|
||||||
|
+ fputs("symbol table not found\n", stderr);
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+ strndx = shdr.sh_link;
|
||||||
|
+
|
||||||
|
+ symdata = elf_getdata(scn, NULL);
|
||||||
|
+ if (!symdata) {
|
||||||
|
+ fprintf(stderr, "elf_getdata failed: %s\n", elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (ndx = 0; gelf_getsym(symdata, ndx, &sym) != NULL; ++ndx) {
|
||||||
|
+
|
||||||
|
+ name = elf_strptr(elf, strndx, sym.st_name);
|
||||||
|
+ if (!name) {
|
||||||
|
+ fprintf(stderr, "elf_strptr failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+ if (strncmp(prefix, name, prefixlen))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ if (sym.st_shndx >= SHN_LORESERVE) {
|
||||||
|
+ printf(symformat, flavor, name + prefixlen,
|
||||||
|
+ sym.st_value);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ scn = elf_getscn(elf, sym.st_shndx);
|
||||||
|
+ if (!scn) {
|
||||||
|
+ fprintf(stderr, "elf_getscn failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+ if (!gelf_getshdr(scn, &shdr)) {
|
||||||
|
+ fprintf(stderr, "gelf_getshdr failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (shdr.sh_type != SHT_PROGBITS)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ data = elf_getdata_rawchunk(
|
||||||
|
+ elf, shdr.sh_offset + sym.st_value - shdr.sh_addr,
|
||||||
|
+ sizeof(GElf_Word), ELF_T_WORD);
|
||||||
|
+ if (!data) {
|
||||||
|
+ fprintf(stderr, "elf_getdata_rawchunk failed: %s\n",
|
||||||
|
+ elf_errmsg(-1));
|
||||||
|
+ goto err_end;
|
||||||
|
+ }
|
||||||
|
+ printf(symformat, flavor, name + prefixlen,
|
||||||
|
+ (unsigned long) *(GElf_Word*)data->d_buf);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ elf_end(elf);
|
||||||
|
+ close(fd);
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ err_end:
|
||||||
|
+ elf_end(elf);
|
||||||
|
+ err_close:
|
||||||
|
+ close(fd);
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
|
||||||
|
From bb1a83cf109eee56c8dee26f7910c772f8c246fc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Date: Thu, 29 Jun 2023 17:47:16 +0200
|
||||||
|
Subject: [PATCH] depmod: Handle installing modules under a prefix
|
||||||
|
|
||||||
|
References: bsc#1212835
|
||||||
|
Patch-mainline: Never, upstream rejected
|
||||||
|
|
||||||
|
Some distributions aim at shipping all files in /usr.
|
||||||
|
|
||||||
|
The path under which kernel modules are installed is hardcoded to /lib
|
||||||
|
which conflicts with this goal.
|
||||||
|
|
||||||
|
When kmod provides the config command, use it to determine the correct
|
||||||
|
module installation path.
|
||||||
|
|
||||||
|
With kmod that does not provide the config command /lib/modules is used
|
||||||
|
as before.
|
||||||
|
|
||||||
|
Note: users can use
|
||||||
|
|
||||||
|
make MODLIB='$(INSTALL_MOD_PATH)/usr/lib/modules/$(KERNELRELEASE)'
|
||||||
|
|
||||||
|
to install modules from mainline kernel on usrmerged system.
|
||||||
|
Not great for KMPs, though
|
||||||
|
|
||||||
|
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Nacked-by: Masahiro Yamada <masahiroy@kernel.org>
|
||||||
|
---
|
||||||
|
v2: Avoid error on systems with kmod that does not support config
|
||||||
|
command
|
||||||
|
v3: More verbose commit message
|
||||||
|
v4:
|
||||||
|
- Document jq requirement
|
||||||
|
- fix bashism
|
||||||
|
- Update to getting full module path, not just additional prefix
|
||||||
|
v5: switch to pkgconfig
|
||||||
|
---
|
||||||
|
Makefile | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 658ec2b8aa74..5a1889fc43c7 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -1165,7 +1165,9 @@ export INSTALL_DTBS_PATH ?= $(INSTALL_PATH)/dtbs/$(KERNELRELEASE)
|
||||||
|
# makefile but the argument can be passed to make if needed.
|
||||||
|
#
|
||||||
|
|
||||||
|
-MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
|
||||||
|
+export KERNEL_MODULE_DIRECTORY := $(shell pkg-config --print-variables kmod 2>/dev/null | grep '^module_directory$$' >/dev/null && pkg-config --variable=module_directory kmod || echo /lib/modules)
|
||||||
|
+
|
||||||
|
+MODLIB = $(INSTALL_MOD_PATH)$(KERNEL_MODULE_DIRECTORY)/$(KERNELRELEASE)
|
||||||
|
export MODLIB
|
||||||
|
|
||||||
|
PHONY += prepare0
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
||||||
|
From 4d15c9fa058e6dee09324cfc93f48858d4296019 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Date: Tue, 18 Jul 2023 18:58:43 +0200
|
||||||
|
Subject: [PATCH] Revert "kbuild: Hack for depmod not handling X.Y versions"
|
||||||
|
|
||||||
|
References: bsc#1212835
|
||||||
|
Patch-mainline: v6.6-rc1
|
||||||
|
Git-commit: 4d15c9fa058e6dee09324cfc93f48858d4296019
|
||||||
|
|
||||||
|
Remove hack for ancient version of module-init-tools that was added in
|
||||||
|
Linux 3.0.
|
||||||
|
|
||||||
|
Since then module-init-tools was replaced with kmod.
|
||||||
|
|
||||||
|
This hack adds an additional indirection, and causes confusing errors
|
||||||
|
to be printed when depmod fails.
|
||||||
|
|
||||||
|
Reverts commit 8fc62e594253 ("kbuild: Do not write to builddir in modules_install")
|
||||||
|
Reverts commit bfe5424a8b31 ("kbuild: Hack for depmod not handling X.Y versions")
|
||||||
|
|
||||||
|
Link: https://lore.kernel.org/linux-modules/CAK7LNAQMs3QBYfWcLkmOQdbbq7cj=7wWbK=AWhdTC2rAsKHXzQ@mail.gmail.com/
|
||||||
|
|
||||||
|
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
||||||
|
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
|
||||||
|
---
|
||||||
|
scripts/depmod.sh | 27 +--------------------------
|
||||||
|
1 file changed, 1 insertion(+), 26 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/scripts/depmod.sh b/scripts/depmod.sh
|
||||||
|
index 3643b4f896ed..fca689ba4f21 100755
|
||||||
|
--- a/scripts/depmod.sh
|
||||||
|
+++ b/scripts/depmod.sh
|
||||||
|
@@ -23,33 +23,8 @@ if [ -z $(command -v $DEPMOD) ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
-# older versions of depmod require the version string to start with three
|
||||||
|
-# numbers, so we cheat with a symlink here
|
||||||
|
-depmod_hack_needed=true
|
||||||
|
-tmp_dir=$(mktemp -d ${TMPDIR:-/tmp}/depmod.XXXXXX)
|
||||||
|
-mkdir -p "$tmp_dir/lib/modules/$KERNELRELEASE"
|
||||||
|
-if "$DEPMOD" -b "$tmp_dir" $KERNELRELEASE 2>/dev/null; then
|
||||||
|
- if test -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep" -o \
|
||||||
|
- -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep.bin"; then
|
||||||
|
- depmod_hack_needed=false
|
||||||
|
- fi
|
||||||
|
-fi
|
||||||
|
-rm -rf "$tmp_dir"
|
||||||
|
-if $depmod_hack_needed; then
|
||||||
|
- symlink="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE"
|
||||||
|
- ln -s "$KERNELRELEASE" "$symlink"
|
||||||
|
- KERNELRELEASE=99.98.$KERNELRELEASE
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
set -- -ae -F System.map
|
||||||
|
if test -n "$INSTALL_MOD_PATH"; then
|
||||||
|
set -- "$@" -b "$INSTALL_MOD_PATH"
|
||||||
|
fi
|
||||||
|
-"$DEPMOD" "$@" "$KERNELRELEASE"
|
||||||
|
-ret=$?
|
||||||
|
-
|
||||||
|
-if $depmod_hack_needed; then
|
||||||
|
- rm -f "$symlink"
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-exit $ret
|
||||||
|
+exec "$DEPMOD" "$@" "$KERNELRELEASE"
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
||||||
|
From 0ec8a11bd6287ada08e6c13023ce47be5cdc4270 Mon Sep 17 00:00:00 2001
|
||||||
|
From: tkg <tkg@froggi.es>
|
||||||
|
Date: Sat, 9 Sep 2023 00:48:37 +0200
|
||||||
|
Subject: mkspec: Suse is using /usr/lib instead of the standard /lib symlink. Adapt.
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
|
||||||
|
index de170760d..2b5ee7b35 100755
|
||||||
|
--- a/scripts/package/mkspec
|
||||||
|
+++ b/scripts/package/mkspec
|
||||||
|
@@ -121,11 +121,11 @@ $S
|
||||||
|
$MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
|
||||||
|
cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
|
||||||
|
cp .config %{buildroot}/boot/config-$KERNELRELEASE
|
||||||
|
-$S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build
|
||||||
|
-$S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/source
|
||||||
|
+$S$M rm -f %{buildroot}/usr/lib/modules/$KERNELRELEASE/build
|
||||||
|
+$S$M rm -f %{buildroot}/usr/lib/modules/$KERNELRELEASE/source
|
||||||
|
$S$M mkdir -p %{buildroot}/usr/src/kernels/$KERNELRELEASE
|
||||||
|
$S$M tar cf - $EXCLUDES . | tar xf - -C %{buildroot}/usr/src/kernels/$KERNELRELEASE
|
||||||
|
-$S$M cd %{buildroot}/lib/modules/$KERNELRELEASE
|
||||||
|
+$S$M cd %{buildroot}/usr/lib/modules/$KERNELRELEASE
|
||||||
|
$S$M ln -sf /usr/src/kernels/$KERNELRELEASE build
|
||||||
|
$S$M ln -sf /usr/src/kernels/$KERNELRELEASE source
|
||||||
|
|
||||||
|
@@ -159,9 +159,9 @@ $S$M ln -sf /usr/src/kernels/$KERNELRELEASE source
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr (-, root, root)
|
||||||
|
-$M /lib/modules/$KERNELRELEASE
|
||||||
|
-$M %exclude /lib/modules/$KERNELRELEASE/build
|
||||||
|
-$M %exclude /lib/modules/$KERNELRELEASE/source
|
||||||
|
+$M /usr/lib/modules/$KERNELRELEASE
|
||||||
|
+$M %exclude /usr/lib/modules/$KERNELRELEASE/build
|
||||||
|
+$M %exclude /usr/lib/modules/$KERNELRELEASE/source
|
||||||
|
/boot/*
|
||||||
|
|
||||||
|
%files headers
|
||||||
|
@@ -171,6 +171,6 @@ $S$M
|
||||||
|
$S$M %files devel
|
||||||
|
$S$M %defattr (-, root, root)
|
||||||
|
$S$M /usr/src/kernels/$KERNELRELEASE
|
||||||
|
-$S$M /lib/modules/$KERNELRELEASE/build
|
||||||
|
-$S$M /lib/modules/$KERNELRELEASE/source
|
||||||
|
+$S$M /usr/lib/modules/$KERNELRELEASE/build
|
||||||
|
+$S$M /usr/lib/modules/$KERNELRELEASE/source
|
||||||
|
EOF
|
||||||
|
|
||||||
|
From 23133fe6745d567db5b93dc9e6aecc32d31354bd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeff Mahoney <jeffm@suse.de>
|
||||||
|
Date: Tue, 31 Mar 2009 09:46:30 -0400
|
||||||
|
Subject: [PATCH] - doc/README.KSYMS: Add to repo.
|
||||||
|
|
||||||
|
---
|
||||||
|
doc/README.KSYMS | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
create mode 100644 doc/README.KSYMS
|
||||||
|
|
||||||
|
diff --git a/doc/README.KSYMS b/doc/README.KSYMS
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000000..39fe7878174
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/doc/README.KSYMS
|
||||||
|
@@ -0,0 +1,6 @@
|
||||||
|
+This file is a place holder for the kernel-syms{,-rt} package. It is used
|
||||||
|
+to group build dependencies for all kernel flavors.
|
||||||
|
+
|
||||||
|
+The KMP build process will build KMPs against all installed kernel flavors
|
||||||
|
+automatically. If you don't need to build against other flavors than the
|
||||||
|
+ones you've already installed - it is safe to uninstall this package.
|
||||||
|
|
||||||
|
From 5cd5e149a95d37746a89850f4beddef4f0ad2224 Mon Sep 17 00:00:00 2001
|
||||||
|
From: tkg <tkg@froggi.es>
|
||||||
|
Date: Sat, 9 Sep 2023 14:06:44 +0200
|
||||||
|
Subject: Suse: Add kernel-syms package
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
|
||||||
|
index ff8c33ead..51c94131e 100755
|
||||||
|
--- a/scripts/package/mkspec
|
||||||
|
+++ b/scripts/package/mkspec
|
||||||
|
@@ -52,7 +52,7 @@ $S Source1: config
|
||||||
|
$S Source2: diff.patch
|
||||||
|
Provides: kernel-$KERNELRELEASE
|
||||||
|
Provides: kernel-uname-r = %{version}
|
||||||
|
-$S BuildRequires: bc binutils bison dwarves
|
||||||
|
+$S BuildRequires: bc binutils bison dwarves coreutils
|
||||||
|
$S BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
|
||||||
|
$S BuildRequires: gcc make openssl openssl-devel perl python3 rsync
|
||||||
|
|
||||||
|
@@ -88,6 +88,19 @@ $S$M %description -n kernel-devel
|
||||||
|
$S$M This package provides kernel headers and makefiles sufficient to build modules
|
||||||
|
$S$M against the $__KERNELRELEASE kernel package.
|
||||||
|
$S$M
|
||||||
|
+$S$M %package syms
|
||||||
|
+$S$M Summary: Kernel Symbol Versions (modversions) for the $__KERNELRELEASE kernel
|
||||||
|
+$S$M Group: Development/Sources
|
||||||
|
+$S$M AutoReqProv: no
|
||||||
|
+$S$M Provides: kernel-syms = %{version}
|
||||||
|
+$S$M Requires: kernel-devel = %{version}
|
||||||
|
+$S$M %description -n kernel-syms
|
||||||
|
+$S$M Kernel symbols, such as functions and variables, have version
|
||||||
|
+$S$M information attached to them. This package contains the symbol versions
|
||||||
|
+$S$M for the standard kernels.
|
||||||
|
+$S$M This package is needed for compiling kernel module packages with proper
|
||||||
|
+$S$M package dependencies.
|
||||||
|
+
|
||||||
|
$S # Opt out of a lot of Fedora hardening flags etc...
|
||||||
|
$S # See https://src.fedoraproject.org/rpms/redhat-rpm-config//blob/rawhide/f/buildflags.md
|
||||||
|
$S %undefine _package_note_file
|
||||||
|
@@ -173,4 +189,8 @@ $S$M %defattr (-, root, root)
|
||||||
|
$S$M /usr/src/kernels/$KERNELRELEASE
|
||||||
|
$S$M /usr/lib/modules/$KERNELRELEASE/build
|
||||||
|
$S$M /usr/lib/modules/$KERNELRELEASE/source
|
||||||
|
+$S$M
|
||||||
|
+$S$M %files syms
|
||||||
|
+$S$M %defattr (-, root, root)
|
||||||
|
+$S$M /usr/src/kernels/$KERNELRELEASE/doc
|
||||||
|
EOF
|
Reference in New Issue
Block a user