From 43e717c7f19b969714b063a50c7ebbb46071c24e Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Sun, 18 Oct 2026 12:59:54 +0300 Subject: [PATCH] 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. --- .github/workflows/rpm.yml | 2 +- .github/workflows/run_regression_tests.yaml | 4 ++-- AGENTS.md | 4 ++-- CONTRIBUTING.md | 2 +- Makefile | 8 ++++---- README.module-signing | 2 +- debian/copyright | 10 +++++----- fcst/Makefile | 2 +- iscsi-scst/Makefile | 4 ++-- nightly/bin/nightly | 2 +- qla2x00t-32gbit/AGENTS.md | 2 +- qla2x00t-32gbit/Makefile | 2 +- qla2x00t-32gbit/extract-qla2xxx-orig | 2 +- qla2x00t-32gbit/qla2x00-target/Makefile | 2 +- qla2x00t-32gbit/qla2x00-target/README | 2 +- qla2x00t/AGENTS.md | 2 +- qla2x00t/Makefile | 2 +- qla2x00t/extract-qla2xxx-orig | 2 +- qla2x00t/qla2x00-target/Makefile | 2 +- scripts/{ => kernel}/filter-trace-entry-exit | 0 scripts/{ => kernel}/generate-kernel-patch | 2 +- scripts/{ => kernel}/generate-patched-kernel | 4 ++-- scripts/{ => kernel}/kernel-functions | 2 +- scripts/{ => kernel}/kernel-matrix | 6 +++--- scripts/{ => kernel}/list-conditional-defines | 0 scripts/{ => kernel}/rhel-rpm-functions | 0 scripts/{ => kernel}/run-regression-tests | 2 +- scripts/{ => kernel}/sign-modules | 2 +- scripts/{ => kernel}/specialize-patch | 0 scripts/{ => kernel}/test-specialize-patch | 2 +- scripts/kunit/test_generator.py | 2 +- scripts/kunit/test_regression.py | 2 +- scst/AGENTS.md | 4 ++-- scst/README | 6 +++--- scst/src/Makefile | 4 ++-- scst/src/dev_handlers/Makefile | 2 +- scst_local/Makefile | 2 +- srpt/Makefile | 2 +- 38 files changed, 51 insertions(+), 51 deletions(-) rename scripts/{ => kernel}/filter-trace-entry-exit (100%) rename scripts/{ => kernel}/generate-kernel-patch (99%) rename scripts/{ => kernel}/generate-patched-kernel (92%) rename scripts/{ => kernel}/kernel-functions (99%) rename scripts/{ => kernel}/kernel-matrix (97%) rename scripts/{ => kernel}/list-conditional-defines (100%) rename scripts/{ => kernel}/rhel-rpm-functions (100%) rename scripts/{ => kernel}/run-regression-tests (99%) rename scripts/{ => kernel}/sign-modules (94%) rename scripts/{ => kernel}/specialize-patch (100%) rename scripts/{ => kernel}/test-specialize-patch (98%) diff --git a/.github/workflows/rpm.yml b/.github/workflows/rpm.yml index 888a30b95..68bf5c105 100644 --- a/.github/workflows/rpm.yml +++ b/.github/workflows/rpm.yml @@ -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: diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index d9fd3126c..170652209 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -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" diff --git a/AGENTS.md b/AGENTS.md index 70d37dbf2..b317a941f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 81213cc41..ca8e00549 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/Makefile b/Makefile index 196286f07..f0dce7a1e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.module-signing b/README.module-signing index 888bdc182..3caeb47e9 100644 --- a/README.module-signing +++ b/README.module-signing @@ -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. diff --git a/debian/copyright b/debian/copyright index 135d2919c..74af35853 100644 --- a/debian/copyright +++ b/debian/copyright @@ -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 diff --git a/fcst/Makefile b/fcst/Makefile index 497291bb2..4c7d241d5 100644 --- a/fcst/Makefile +++ b/fcst/Makefile @@ -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) \ diff --git a/iscsi-scst/Makefile b/iscsi-scst/Makefile index ffe0163f1..05388f096 100644 --- a/iscsi-scst/Makefile +++ b/iscsi-scst/Makefile @@ -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) \ diff --git a/nightly/bin/nightly b/nightly/bin/nightly index 9034d0b40..ee928b358 100755 --- a/nightly/bin/nightly +++ b/nightly/bin/nightly @@ -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" \ diff --git a/qla2x00t-32gbit/AGENTS.md b/qla2x00t-32gbit/AGENTS.md index 4c4c85878..fb34c6b01 100644 --- a/qla2x00t-32gbit/AGENTS.md +++ b/qla2x00t-32gbit/AGENTS.md @@ -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 diff --git a/qla2x00t-32gbit/Makefile b/qla2x00t-32gbit/Makefile index 48dad4ff1..43d5f7ba5 100644 --- a/qla2x00t-32gbit/Makefile +++ b/qla2x00t-32gbit/Makefile @@ -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) \ diff --git a/qla2x00t-32gbit/extract-qla2xxx-orig b/qla2x00t-32gbit/extract-qla2xxx-orig index 124f32435..eb83ef515 100755 --- a/qla2x00t-32gbit/extract-qla2xxx-orig +++ b/qla2x00t-32gbit/extract-qla2xxx-orig @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname "$0")/../scripts/kernel-functions" || exit $? +source "$(dirname "$0")/../scripts/kernel/kernel-functions" || exit $? ######################### # Argument verification # diff --git a/qla2x00t-32gbit/qla2x00-target/Makefile b/qla2x00t-32gbit/qla2x00-target/Makefile index 4de10dc7a..777cb3f05 100644 --- a/qla2x00t-32gbit/qla2x00-target/Makefile +++ b/qla2x00t-32gbit/qla2x00-target/Makefile @@ -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) \ diff --git a/qla2x00t-32gbit/qla2x00-target/README b/qla2x00t-32gbit/qla2x00-target/README index 13e8731bf..c3e69247e 100644 --- a/qla2x00t-32gbit/qla2x00-target/README +++ b/qla2x00t-32gbit/qla2x00-target/README @@ -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. diff --git a/qla2x00t/AGENTS.md b/qla2x00t/AGENTS.md index 4caa37124..fa39cc168 100644 --- a/qla2x00t/AGENTS.md +++ b/qla2x00t/AGENTS.md @@ -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/`. diff --git a/qla2x00t/Makefile b/qla2x00t/Makefile index 4bdb5fa1b..f7fb1b0c5 100644 --- a/qla2x00t/Makefile +++ b/qla2x00t/Makefile @@ -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) \ diff --git a/qla2x00t/extract-qla2xxx-orig b/qla2x00t/extract-qla2xxx-orig index 7f1b5028a..7f670e480 100755 --- a/qla2x00t/extract-qla2xxx-orig +++ b/qla2x00t/extract-qla2xxx-orig @@ -1,6 +1,6 @@ #!/bin/bash -source "$(dirname "$0")/../scripts/kernel-functions" || exit $? +source "$(dirname "$0")/../scripts/kernel/kernel-functions" || exit $? ######################### # Argument verification # diff --git a/qla2x00t/qla2x00-target/Makefile b/qla2x00t/qla2x00-target/Makefile index 5fdfcf878..6c1e8e179 100644 --- a/qla2x00t/qla2x00-target/Makefile +++ b/qla2x00t/qla2x00-target/Makefile @@ -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) \ diff --git a/scripts/filter-trace-entry-exit b/scripts/kernel/filter-trace-entry-exit similarity index 100% rename from scripts/filter-trace-entry-exit rename to scripts/kernel/filter-trace-entry-exit diff --git a/scripts/generate-kernel-patch b/scripts/kernel/generate-kernel-patch similarity index 99% rename from scripts/generate-kernel-patch rename to scripts/kernel/generate-kernel-patch index 120cb2bd2..aade712b6 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/kernel/generate-kernel-patch @@ -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 | diff --git a/scripts/generate-patched-kernel b/scripts/kernel/generate-patched-kernel similarity index 92% rename from scripts/generate-patched-kernel rename to scripts/kernel/generate-patched-kernel index a65157974..e448f8896 100755 --- a/scripts/generate-patched-kernel +++ b/scripts/kernel/generate-patched-kernel @@ -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 diff --git a/scripts/kernel-functions b/scripts/kernel/kernel-functions similarity index 99% rename from scripts/kernel-functions rename to scripts/kernel/kernel-functions index 03dd6da83..9c1c9fb9d 100644 --- a/scripts/kernel-functions +++ b/scripts/kernel/kernel-functions @@ -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" diff --git a/scripts/kernel-matrix b/scripts/kernel/kernel-matrix similarity index 97% rename from scripts/kernel-matrix rename to scripts/kernel/kernel-matrix index d7be7c240..997b9ea68 100644 --- a/scripts/kernel-matrix +++ b/scripts/kernel/kernel-matrix @@ -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}}" diff --git a/scripts/list-conditional-defines b/scripts/kernel/list-conditional-defines similarity index 100% rename from scripts/list-conditional-defines rename to scripts/kernel/list-conditional-defines diff --git a/scripts/rhel-rpm-functions b/scripts/kernel/rhel-rpm-functions similarity index 100% rename from scripts/rhel-rpm-functions rename to scripts/kernel/rhel-rpm-functions diff --git a/scripts/run-regression-tests b/scripts/kernel/run-regression-tests similarity index 99% rename from scripts/run-regression-tests rename to scripts/kernel/run-regression-tests index bf28e7b6d..14bd48814 100755 --- a/scripts/run-regression-tests +++ b/scripts/kernel/run-regression-tests @@ -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 - ) diff --git a/scripts/sign-modules b/scripts/kernel/sign-modules similarity index 94% rename from scripts/sign-modules rename to scripts/kernel/sign-modules index 03cb23565..8c27efd02 100755 --- a/scripts/sign-modules +++ b/scripts/kernel/sign-modules @@ -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" diff --git a/scripts/specialize-patch b/scripts/kernel/specialize-patch similarity index 100% rename from scripts/specialize-patch rename to scripts/kernel/specialize-patch diff --git a/scripts/test-specialize-patch b/scripts/kernel/test-specialize-patch similarity index 98% rename from scripts/test-specialize-patch rename to scripts/kernel/test-specialize-patch index 161a600a6..5b19fb9d8 100755 --- a/scripts/test-specialize-patch +++ b/scripts/kernel/test-specialize-patch @@ -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 diff --git a/scripts/kunit/test_generator.py b/scripts/kunit/test_generator.py index 54e209c1e..ebab4372c 100644 --- a/scripts/kunit/test_generator.py +++ b/scripts/kunit/test_generator.py @@ -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)) diff --git a/scripts/kunit/test_regression.py b/scripts/kunit/test_regression.py index 44934b6e2..19503809b 100644 --- a/scripts/kunit/test_regression.py +++ b/scripts/kunit/test_regression.py @@ -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() diff --git a/scst/AGENTS.md b/scst/AGENTS.md index a6f852f0b..a58c37c90 100644 --- a/scst/AGENTS.md +++ b/scst/AGENTS.md @@ -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 diff --git a/scst/README b/scst/README index 5bd4af7cd..3f899d251 100644 --- a/scst/README +++ b/scst/README @@ -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. diff --git a/scst/src/Makefile b/scst/src/Makefile index a2836e851..589a3601a 100644 --- a/scst/src/Makefile +++ b/scst/src/Makefile @@ -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)") \ diff --git a/scst/src/dev_handlers/Makefile b/scst/src/dev_handlers/Makefile index 312a7655e..ce25f5d21 100644 --- a/scst/src/dev_handlers/Makefile +++ b/scst/src/dev_handlers/Makefile @@ -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)") \ diff --git a/scst_local/Makefile b/scst_local/Makefile index 05e2c4c4e..56a6b9c7e 100644 --- a/scst_local/Makefile +++ b/scst_local/Makefile @@ -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) \ diff --git a/srpt/Makefile b/srpt/Makefile index 979be611e..f0e0d183c 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -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)" \