tools/testing/selftests/kho/vmtest.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/kho/vmtest.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/kho/vmtest.sh- Extension
.sh- Size
- 4049 bytes
- Lines
- 191
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function usagefunction mkinitrdfunction main
Annotated Snippet
function usage() {
cat <<EOF
$0 [-d build_dir] [-j jobs] [-t target_arch] [-h]
Options:
-d) path to the kernel build directory
-j) number of jobs for compilation, similar to -j in make
-t) run test for target_arch, requires CROSS_COMPILE set
supported targets: aarch64, x86_64
-h) display this help
EOF
}
function cleanup() {
rm -fr "$tmp_dir"
ktap_finished
}
trap cleanup EXIT
function skip() {
local msg=${1:-""}
ktap_test_skip "$msg"
exit "$KSFT_SKIP"
}
function fail() {
local msg=${1:-""}
ktap_test_fail "$msg"
exit "$KSFT_FAIL"
}
function build_kernel() {
local build_dir=$1
local make_cmd=$2
local arch_kconfig=$3
local kimage=$4
local kho_config="$tmp_dir/kho.config"
local kconfig="$build_dir/.config"
# enable initrd, KHO and KHO test in kernel configuration
tee "$kconfig" > "$kho_config" <<EOF
CONFIG_BLK_DEV_INITRD=y
CONFIG_KEXEC_HANDOVER=y
CONFIG_KEXEC_HANDOVER_DEBUG=y
CONFIG_KEXEC_HANDOVER_DEBUGFS=y
CONFIG_TEST_KEXEC_HANDOVER=y
CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_VM=y
CONFIG_DEBUG_VM_PGFLAGS=y
CONFIG_SMP=y
CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
$arch_kconfig
EOF
make_cmd="$make_cmd -C $kernel_dir O=$build_dir"
$make_cmd olddefconfig
# verify that kernel confiration has all necessary options
while read -r opt ; do
grep "$opt" "$kconfig" &>/dev/null || skip "$opt is missing"
done < "$kho_config"
$make_cmd "$kimage"
$make_cmd headers_install INSTALL_HDR_PATH="$headers_dir"
}
function mkinitrd() {
local kernel=$1
Annotation
- Detected declarations: `function usage`, `function mkinitrd`, `function main`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.