scripts: Group kernel maintenance helpers under kernel/

Move patch generation, specialization, regression, kernel selection and
module signing helpers together, with their shared shell libraries. Update
component Makefiles, CI, nightly jobs, packaging metadata, documentation
and KUnit tooling references alongside the move.

Adjust repository-root and source-inventory lookups for the deeper path.
Resolve rhel-rpm-functions relative to kernel-functions through
BASH_SOURCE, since it is also sourced by the QLogic extraction helpers.

Keep the regression runner behavior and the nightly kernel matrix intact,
including the existing checkpatch, sparse and smatch switches and policy.
This commit is contained in:
Gleb Chesnokov
2026-10-19 10:31:32 +03:00
parent 88b5653b06
commit 43e717c7f1
38 changed files with 51 additions and 51 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ jobs:
id: matrix
shell: bash
run: |
matrix="$(bash scripts/kernel-matrix rpm)"
matrix="$(bash scripts/kernel/kernel-matrix rpm)"
printf 'rpm=%s\n' "${matrix}" >>"${GITHUB_OUTPUT}"
build_rpm:
+2 -2
View File
@@ -29,7 +29,7 @@ jobs:
id: matrix
shell: bash
run: |
matrix="$(bash scripts/kernel-matrix regression)"
matrix="$(bash scripts/kernel/kernel-matrix regression)"
printf 'regression=%s\n' "${matrix}" >>"${GITHUB_OUTPUT}"
regression_tests:
@@ -55,7 +55,7 @@ jobs:
workdir="/tmp/scst-${version}"
out="output.txt"
./scripts/run-regression-tests -l -q -d "${workdir}" "${version}-nc-ns-nm" | tee "${out}"
./scripts/kernel/run-regression-tests -l -q -d "${workdir}" "${version}-nc-ns-nm" | tee "${out}"
if ! grep -q "Compiling the patched kernel" "${out}"; then
echo "::error title=Regression tests::run-regression-tests failed"
+2 -2
View File
@@ -19,7 +19,7 @@ user-space handlers and daemons.
- `qla2x00t-32gbit/` is the default, newer QLogic FC target/initiator source
tree for the top-level out-of-tree build; `qla2x00t/` is the alternative
legacy tree selected there with `QLA_32GBIT=no`. Generated in-tree patches
select a tree independently in `scripts/generate-kernel-patch`; inspect its
select a tree independently in `scripts/kernel/generate-kernel-patch`; inspect its
current target-kernel condition. The trees are alternatives, not
interchangeable copies.
- `srpt/`, `fcst/`, and `scst_local/` own the SRP/RDMA, FCoE/libfc, and local
@@ -99,7 +99,7 @@ the whole tree.
headers and code.
- `ABT_KERNELS` in `nightly/conf/nightly.conf` is the maintained, canonical
list of supported upstream and distribution kernels. `nightly/bin/nightly`
passes it to `scripts/run-regression-tests`; the GitHub Actions regression
passes it to `scripts/kernel/run-regression-tests`; the GitHub Actions regression
matrix is a practical subset, not the complete support list. Treat changes
to `ABT_KERNELS` as support-policy changes and keep duplicated CI entries
aligned where applicable.
+1 -1
View File
@@ -142,7 +142,7 @@ in `.github/workflows/ci.yml` and `.github/workflows/coverity.yml`.
`make ginkgo-check` checks the framework only; follow the guide before
running tests that load modules or access storage.
`scripts/run-regression-tests` checks kernel compatibility, compilation,
`scripts/kernel/run-regression-tests` checks kernel compatibility, compilation,
sparse and smatch. It downloads or prepares kernel trees and is separate
from the lightweight local checks above. The nightly support matrix is
`ABT_KERNELS` in `nightly/conf/nightly.conf`; CI exercises a subset in
+4 -4
View File
@@ -119,13 +119,13 @@ DOCKER_RPM_CONTEXT ?= docker/rpm
DOCKER_RPM_DOCKERFILE ?= $(DOCKER_RPM_CONTEXT)/Dockerfile
DOCKER_RPM_IMAGE ?= scst-rpm-builder:$(DOCKER_RPM_TARGET)
DOCKER_RPM_OUTPUT ?= $(CURDIR)/docker-rpmbuilddir/$(DOCKER_RPM_TARGET)
DOCKER_RPM_BASE_IMAGE ?= $(shell bash scripts/kernel-matrix rpm-field \
DOCKER_RPM_BASE_IMAGE ?= $(shell bash scripts/kernel/kernel-matrix rpm-field \
"$(DOCKER_RPM_TARGET)" base_image)
DOCKER_RPM_KERNEL_PACKAGE ?= $(shell bash scripts/kernel-matrix rpm-field \
DOCKER_RPM_KERNEL_PACKAGE ?= $(shell bash scripts/kernel/kernel-matrix rpm-field \
"$(DOCKER_RPM_TARGET)" kernel_package)
DOCKER_RPM_KERNEL_VERSION ?= $(shell bash scripts/kernel-matrix rpm-field \
DOCKER_RPM_KERNEL_VERSION ?= $(shell bash scripts/kernel/kernel-matrix rpm-field \
"$(DOCKER_RPM_TARGET)" kernel_version)
DOCKER_RPM_KERNEL_REPOSITORY ?= $(shell bash scripts/kernel-matrix rpm-field \
DOCKER_RPM_KERNEL_REPOSITORY ?= $(shell bash scripts/kernel/kernel-matrix rpm-field \
"$(DOCKER_RPM_TARGET)" kernel_repository)
RPM_ARTIFACT_SOURCE_DIR ?= $(CURDIR)
RPM_ARTIFACT_OUTPUT_DIR ?= $(CURDIR)/rpm-artifacts
+1 -1
View File
@@ -34,7 +34,7 @@ ls -l scst/src/certs/scst_module_key*
The `.der` file is the public certificate and the `.priv` file is the private
key. Keep the private key secret and never pass it to mokutil. During
installation, `scripts/sign-modules` signs modules with the target kernel's
installation, `scripts/kernel/sign-modules` signs modules with the target kernel's
`scripts/sign-file`. If `sign-file` is unavailable, the script reports that
the modules are not being signed and continues; check the installation output
before relying on signature enforcement.
+5 -5
View File
@@ -17,14 +17,14 @@ Files: Makefile
qla2x00t/qla2x00-target/qla2x00t.c
qla2x00t/qla2x00-target/qla2x00t.h
scripts/blockdev-perftest
scripts/filter-trace-entry-exit
scripts/generate-kernel-patch
scripts/generate-patched-kernel
scripts/kernel/filter-trace-entry-exit
scripts/kernel/generate-kernel-patch
scripts/kernel/generate-patched-kernel
scripts/generate-scst-patch
scripts/source/list-double-blank-lines
scripts/monitor-memory-usage
scripts/run-regression-tests
scripts/specialize-patch
scripts/kernel/run-regression-tests
scripts/kernel/specialize-patch
scst-dkms.spec.in
scst.spec.in
usr/Makefile
+1 -1
View File
@@ -66,7 +66,7 @@ all:
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)")
install: all
KDIR=$(KDIR) ../scripts/sign-modules
KDIR=$(KDIR) ../scripts/kernel/sign-modules
$(MAKE) -C $(KDIR) M=$(shell pwd) \
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)") \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
+2 -2
View File
@@ -171,7 +171,7 @@ install: all
@install -vD -m 644 doc/manpages/iscsi-scstd.8 $(DESTDIR)$(MANDIR)/man8/iscsi-scstd.8
@install -vD -m 755 usr/iscsi-scst-adm $(DESTDIR)$(SBINDIR)/iscsi-scst-adm
@install -vD -m 644 doc/manpages/iscsi-scst-adm.8 $(DESTDIR)$(MANDIR)/man8/iscsi-scst-adm.8
(cd $(KMOD) && KDIR=$(KDIR) ../../scripts/sign-modules)
(cd $(KMOD) && KDIR=$(KDIR) ../../scripts/kernel/sign-modules)
$(MAKE) -C $(KDIR) M=$(KMOD) $(SCST_KUNIT_FLAGS) \
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)") \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
@@ -179,7 +179,7 @@ install: all
CONFIG_MODULE_SIG_ALL= modules_install
echo "$@: INFINIBAND_ENABLED = $(INFINIBAND_ENABLED)"
if $(INFINIBAND_ENABLED); then \
(cd $(ISERTMOD) && KDIR=$(KDIR) ../../../scripts/sign-modules);\
(cd $(ISERTMOD) && KDIR=$(KDIR) ../../../scripts/kernel/sign-modules);\
$(MAKE) -C $(KDIR) M=$(ISERTMOD) \
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)") \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
+1 -1
View File
@@ -150,7 +150,7 @@ for logfile in old new ; do
runcmd ${logfile} \
"Running regression tests" \
"cd ${ABT_TMPDIR}/scst && \
scripts/run-regression-tests -k -d ${ABT_TMPDIR}/regtest \
scripts/kernel/run-regression-tests -k -d ${ABT_TMPDIR}/regtest \
-j ${ABT_JOBS} -q ${ABT_KERNELS}"
runcmd ${logfile} \
"Cleaning up" \
+1 -1
View File
@@ -4,7 +4,7 @@
This is the default QLogic tree selected by the top-level out-of-tree build.
The in-tree patch generator has independent target-kernel selection logic in
`scripts/generate-kernel-patch`. This directory contains a vendor-derived
`scripts/kernel/generate-kernel-patch`. This directory contains a vendor-derived
qla2xxx initiator/HBA driver, its target-mode integration, and the SCST adapter
under `qla2x00-target/`. It is maintained separately from the legacy
`qla2x00t/` tree; verify hardware-support claims in the current device table
+1 -1
View File
@@ -55,7 +55,7 @@ all:
CONFIG_SCSI_QLA2XXX_TARGET=$(CONFIG_SCSI_QLA2XXX_TARGET)
install: all
KDIR=$(KDIR) ../scripts/sign-modules
KDIR=$(KDIR) ../scripts/kernel/sign-modules
$(MAKE) -C $(KDIR) M=$(shell pwd) \
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)") \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
source "$(dirname "$0")/../scripts/kernel-functions" || exit $?
source "$(dirname "$0")/../scripts/kernel/kernel-functions" || exit $?
#########################
# Argument verification #
+1 -1
View File
@@ -76,7 +76,7 @@ install: all
ifneq ($(BUILD_2X_MODULE),)
$(MAKE) M=$(QLA2XXX_DIR) -C $(QLA2XXX_DIR) $@
endif
KDIR=$(KDIR) ../../scripts/sign-modules
KDIR=$(KDIR) ../../scripts/kernel/sign-modules
$(MAKE) -C $(KDIR) M=$(shell pwd) \
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)") \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
+1 -1
View File
@@ -21,7 +21,7 @@ the previous version of the SCST QLogic target driver are:
{ PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2289) },
- The repository-supported kernel list is the ABT_KERNELS list in
../../nightly/conf/nightly.conf. For generated in-tree patches,
../../scripts/generate-kernel-patch selects the legacy QLogic tree for
../../scripts/kernel/generate-kernel-patch selects the legacy QLogic tree for
kernels before v3.18 and this tree otherwise. For out-of-tree builds,
use the current compatibility guards and ../../scst/include/backport.h
rather than this driver's historical Linux v5.1 base as policy.
+1 -1
View File
@@ -5,7 +5,7 @@
This is the legacy QLogic qla2xxx/SCST target tree selected by the top-level
out-of-tree build with `QLA_32GBIT=no`; it is not that build's default. The
in-tree patch generator has independent target-kernel selection logic in
`scripts/generate-kernel-patch`. This directory contains a patched
`scripts/kernel/generate-kernel-patch`. This directory contains a patched
initiator/HBA source tree plus the SCST target addon in `qla2x00-target/`.
Treat its hardware scope and behavior as distinct from
`qla2x00t-32gbit/`.
+1 -1
View File
@@ -53,7 +53,7 @@ all:
CONFIG_SCSI_QLA2XXX_TARGET=$(CONFIG_SCSI_QLA2XXX_TARGET)
install: all
KDIR=$(KDIR) ../scripts/sign-modules
KDIR=$(KDIR) ../scripts/kernel/sign-modules
$(MAKE) -C $(KDIR) M=$(shell pwd) BUILD_INI=m \
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)") \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
source "$(dirname "$0")/../scripts/kernel-functions" || exit $?
source "$(dirname "$0")/../scripts/kernel/kernel-functions" || exit $?
#########################
# Argument verification #
+1 -1
View File
@@ -75,7 +75,7 @@ install: all
ifneq ($(BUILD_2X_MODULE),)
$(MAKE) M=$(QLA2XXX_DIR) -C $(QLA2XXX_DIR) $@
endif
KDIR=$(KDIR) ../../scripts/sign-modules
KDIR=$(KDIR) ../../scripts/kernel/sign-modules
$(MAKE) -C $(KDIR) M=$(shell pwd) \
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)") \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
@@ -144,7 +144,7 @@ function specialize_patch {
fi
if [ "${enable_specialize}" = "true" ]; then
if [ "${generating_upstream_patch}" = "true" ]; then
scripts/filter-trace-entry-exit
scripts/kernel/filter-trace-entry-exit
else
cat
fi |
@@ -29,7 +29,7 @@ if [ "${script_dir#/}" = "${script_dir}" ]; then
script_dir="$PWD/$script_dir"
fi
script_dir="${script_dir%/.}"
scst_dir="$(dirname "${script_dir}")"
scst_dir="$(dirname "$(dirname "${script_dir}")")"
# shellcheck source=./kernel-functions
source "${script_dir}/kernel-functions"
@@ -46,7 +46,7 @@ download_and_extract_kernel_tree "$1" || exit $?
cd "${target}" || exit $?
"${script_dir}/source/list-source-files" "${scst_dir}" |
"${script_dir}/../source/list-source-files" "${scst_dir}" |
grep -- "-${kernel_version}.*.patch$" |
grep -v /in-tree/ |
while read -r p; do
@@ -3,7 +3,7 @@
# from kernel.org.
# shellcheck source=./rhel-rpm-functions
source "$(dirname "$0")/../scripts/rhel-rpm-functions" || return $?
source "$(dirname "${BASH_SOURCE[0]}")/rhel-rpm-functions" || return $?
kernel_mirror="http://cdn.kernel.org/pub/linux/kernel"
kernel_downloads="$HOME/software/downloads"
@@ -2,14 +2,14 @@
set -euo pipefail
root_dir="$(readlink -f "$(dirname "$0")/..")"
root_dir="$(readlink -f "$(dirname "$0")/../..")"
readonly root_dir
readonly nightly_config="${SCST_NIGHTLY_CONFIG:-${root_dir}/nightly/conf/nightly.conf}"
readonly github_config="${SCST_GITHUB_MATRIX_CONFIG:-${root_dir}/.github/kernel-matrix.conf}"
# shellcheck source=../nightly/conf/nightly.conf
# shellcheck source=../../nightly/conf/nightly.conf
source "${nightly_config}"
# shellcheck source=../.github/kernel-matrix.conf
# shellcheck source=../../.github/kernel-matrix.conf
source "${github_config}"
: "${ABT_KERNELS:?ABT_KERNELS is not defined in ${nightly_config}}"
@@ -117,7 +117,7 @@ function test_scst_tree_patches {
function duplicate_scst_source_tree {
if [ -e "$1/AskingQuestions" ]; then
( set -o pipefail
"${scriptsdir}"/source/list-source-files "$1" |
"${scriptsdir}"/../source/list-source-files "$1" |
tar -C "$1" --files-from=- -c -f - |
tar -x -f -
)
@@ -9,7 +9,7 @@ if [ -z "$KDIR" ]; then
exit 1
fi
scst_dir=$(dirname "$(cd "$(dirname "$0")" && pwd)")
scst_dir=$(cd "$(dirname "$0")/../.." && pwd)
if [ ! -e "${KDIR}/scripts/sign-file" ]; then
echo "Not signing modules because no sign-file executable"
@@ -3,7 +3,7 @@
set -euo pipefail
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
scst_dir="$(dirname -- "$script_dir")"
scst_dir="$(dirname -- "$(dirname -- "$script_dir")")"
test_dir="$(mktemp -d)"
trap 'rm -rf -- "$test_dir"' EXIT
+1 -1
View File
@@ -28,7 +28,7 @@ class GeneratorTests(unittest.TestCase):
prepare = root / directory / 'generate-in-tree-patches'
prepare.write_text('#!/bin/sh\nexit 0\n')
prepare.chmod(0o755)
result = subprocess.run(['bash', 'scripts/generate-kernel-patch', '-s', '7.2'],
result = subprocess.run(['bash', 'scripts/kernel/generate-kernel-patch', '-s', '7.2'],
cwd=root, capture_output=True, text=True)
self.assertEqual(result.returncode, 0, result.stderr)
files = set(re.findall(r'^\+\+\+ linux-[^/]+/(\S+)', result.stdout, re.M))
+1 -1
View File
@@ -8,7 +8,7 @@ import tempfile
import unittest
ROOT = Path(__file__).resolve().parents[2]
SCRIPT = (ROOT / 'scripts/run-regression-tests').read_text()
SCRIPT = (ROOT / 'scripts/kernel/run-regression-tests').read_text()
CONFIGURE = re.search(r'^function patch_and_configure_kernel \{\n.*?^\}',
SCRIPT, re.M | re.S).group()
COMPILE = re.search(r'^function compile_scst \{\n.*?^\}', SCRIPT, re.M | re.S).group()
+2 -2
View File
@@ -75,8 +75,8 @@ assuming that the base kernel version is sufficient.
drivers, and installed-header consumers after changing it. Do not assume
that the generated interface hash detects every installed-header change;
verify the current hash inputs in `src/Makefile`.
- `scripts/generate-kernel-patch` includes this header in generated in-tree
patches, and `scripts/specialize-patch` evaluates recognized compatibility
- `scripts/kernel/generate-kernel-patch` includes this header in generated in-tree
patches, and `scripts/kernel/specialize-patch` evaluates recognized compatibility
predicates. Audit both scripts when adding a new predicate form or vendor
feature macro.
- Use the root-defined `ABT_KERNELS` matrix in `nightly/conf/nightly.conf` as
+3 -3
View File
@@ -120,8 +120,8 @@ IMPORTANT: In the current version simultaneous access to local SCSI devices
Creating a kernel patch or patched kernel
-----------------------------------------
Use ../scripts/generate-kernel-patch to convert the current SCST source
tree into a Linux kernel patch, or ../scripts/generate-patched-kernel to
Use ../scripts/kernel/generate-kernel-patch to convert the current SCST source
tree into a Linux kernel patch, or ../scripts/kernel/generate-patched-kernel to
generate a kernel source tree with the SCST patches applied. Consult the
scripts themselves for their current inputs and generated output.
@@ -2597,7 +2597,7 @@ sessions, which is enough.
- Do not apply historical SCST performance patches individually. Use
the out-of-tree workflow from ../INSTALL.md or generate a complete
in-tree patch with ../scripts/generate-kernel-patch as described
in-tree patch with ../scripts/kernel/generate-kernel-patch as described
earlier in this README. The tested kernel list is maintained in
../nightly/conf/nightly.conf.
+2 -2
View File
@@ -109,14 +109,14 @@ install: all
echo Error: the scst and/or scst-devel RPMs must be uninstalled first; \
false; fi
-rm -f $(INSTALL_DIR)/scsi_tgt.ko
KDIR=$(KDIR) ../../scripts/sign-modules
KDIR=$(KDIR) ../../scripts/kernel/sign-modules
$(MAKE) -C $(KDIR) M=$(SCST_MOD_DIR) \
$(SCST_KUNIT_FLAGS) \
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)") \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
$$([ -n "$(DEPMOD)" ] && echo "DEPMOD=$(DEPMOD)") \
CONFIG_MODULE_SIG_ALL= modules_install
(cd $(SCST_DH_MOD_DIR) && KDIR=$(KDIR) ../../../scripts/sign-modules)
(cd $(SCST_DH_MOD_DIR) && KDIR=$(KDIR) ../../../scripts/kernel/sign-modules)
$(MAKE) -C $(KDIR) M=$(SCST_DH_MOD_DIR) \
$(SCST_KUNIT_FLAGS) \
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)") \
+1 -1
View File
@@ -64,7 +64,7 @@ all:
install: all
mkdir -p $(DESTDIR)/var/lib/scst/vdev_mode_pages
KDIR=$(KDIR) ../../../scripts/sign-modules
KDIR=$(KDIR) ../../../scripts/kernel/sign-modules
$(MAKE) -C $(KDIR) M=$(shell pwd) \
$(SCST_KUNIT_FLAGS) \
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)") \
+1 -1
View File
@@ -40,7 +40,7 @@ all:
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)")
install: all
KDIR=$(KDIR) ../scripts/sign-modules
KDIR=$(KDIR) ../scripts/kernel/sign-modules
$(MAKE) -C $(KDIR) M=$(shell pwd) \
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)") \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
+1 -1
View File
@@ -125,7 +125,7 @@ install: all
@[ -z "$(DESTDIR)$(INSTALL_MOD_PATH)" ] && \
find /lib/modules/$(KVER) -name ib_srpt.ko -exec rm {} \; ; \
true
(cd src && KDIR=$(KDIR) ../../scripts/sign-modules)
(cd src && KDIR=$(KDIR) ../../scripts/kernel/sign-modules)
$(MAKE) -C $(KDIR) M=$(shell pwd)/src \
$(shell [ -n "$(PASS_CC_TO_MAKE)" ] && echo CC="$(CC)") \
CONFTEST_CFLAGS="$(CONFTEST_CFLAGS)" \