mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
0cf264b313
We currently check the atomic headers at build-time to ensure they haven't been modified directly, and these checks require regenerating the headers in full. As this takes a few seconds, even when parallelized, this is too slow to run for every kernel build. Instead, we can generate a hash of each header as we generate them, which we can cheaply check at build time (~0.16s for all headers). This patch does so, updating headers with their hashes using the new gen-atomics.sh script. As some users apparently build the kernel wihout coreutils, lacking sha1sum, the checks are skipped in this case. Presumably, most developers have a working coreutils installation. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Will Deacon <will.deacon@arm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: anders.roxell@linaro.org Cc: linux-kernel@vger.kernel.rg Cc: naresh.kamboju@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
34 lines
730 B
Bash
Executable File
34 lines
730 B
Bash
Executable File
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Check if atomic headers are up-to-date
|
|
|
|
ATOMICDIR=$(dirname $0)
|
|
ATOMICTBL=${ATOMICDIR}/atomics.tbl
|
|
LINUXDIR=${ATOMICDIR}/../..
|
|
|
|
echo '' | sha1sum - > /dev/null 2>&1
|
|
if [ $? -ne 0 ]; then
|
|
printf "sha1sum not available, skipping atomic header checks.\n"
|
|
exit 0
|
|
fi
|
|
|
|
cat <<EOF |
|
|
asm-generic/atomic-instrumented.h
|
|
asm-generic/atomic-long.h
|
|
linux/atomic-fallback.h
|
|
EOF
|
|
while read header; do
|
|
OLDSUM="$(tail -n 1 ${LINUXDIR}/include/${header})"
|
|
OLDSUM="${OLDSUM#// }"
|
|
|
|
NEWSUM="$(head -n -1 ${LINUXDIR}/include/${header} | sha1sum)"
|
|
NEWSUM="${NEWSUM%% *}"
|
|
|
|
if [ "${OLDSUM}" != "${NEWSUM}" ]; then
|
|
printf "warning: generated include/${header} has been modified.\n"
|
|
fi
|
|
done
|
|
|
|
exit 0
|