kernel/gen_kheaders.sh
Source file repositories/reference/linux-study-clean/kernel/gen_kheaders.sh
File Facts
- System
- Linux kernel
- Corpus path
kernel/gen_kheaders.sh- Extension
.sh- Size
- 1466 bytes
- Lines
- 51
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: Scheduler, Processes, Timers, Sync, And Syscalls
- Status
- atlas-only
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# This script generates an archive consisting of kernel headers
# for CONFIG_IKHEADERS.
set -e
tarfile=$1
srclist=$2
objlist=$3
timestamp=$4
dir=$(dirname "${tarfile}")
tmpdir=${dir}/.tmp_dir
depfile=${dir}/.$(basename "${tarfile}").d
# generate dependency list.
{
echo
echo "deps_${tarfile} := \\"
sed 's:\(.*\): \1 \\:' "${srclist}"
sed -n '/^include\/generated\/autoconf\.h$/!s:\(.*\): \1 \\:p' "${objlist}"
echo
echo "${tarfile}: \$(deps_${tarfile})"
echo
echo "\$(deps_${tarfile}):"
} > "${depfile}"
rm -rf "${tmpdir}"
mkdir "${tmpdir}"
# shellcheck disable=SC2154 # srctree is passed as an env variable
sed "s:^${srctree}/::" "${srclist}" | ${TAR} -c -f - -C "${srctree}" -T - | ${TAR} -xf - -C "${tmpdir}"
${TAR} -c -f - -T "${objlist}" | ${TAR} -xf - -C "${tmpdir}"
# Remove comments except SDPX lines
# Use a temporary file to store directory contents to prevent find/xargs from
# seeing temporary files created by perl.
find "${tmpdir}" -type f -print0 > "${tmpdir}.contents.txt"
xargs -0 -P8 -n1 \
perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;' \
< "${tmpdir}.contents.txt"
rm -f "${tmpdir}.contents.txt"
# Create archive and try to normalize metadata for reproducibility.
${TAR} "${timestamp:+--mtime=$timestamp}" \
--owner=0 --group=0 --sort=name --numeric-owner --mode=u=rw,go=r,a+X \
-I "${XZ}" -cf "${tarfile}" -C "${tmpdir}/" . > /dev/null
rm -rf "${tmpdir}"
Annotation
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- 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.