On 3/20/24 09:38, Michael Roth wrote:
Data structures like struct setup_data have been moved to a separate
setup_data.h header which bootparam.h relies on. Add setup_data.h to
the cp_portable() list and sync it along with the other header files.
Note that currently struct setup_data is stripped away as part of
generating bootparam.h, but that handling is no currently needed for
setup_data.h since it doesn't pull in many external
headers/dependencies. However, QEMU currently redefines struct
setup_data in hw/i386/x86.c, so that will need to be removed as part of
any header update that pulls in the new setup_data.h to avoid build
bisect breakage.
Signed-off-by: Michael Roth <michael.roth@xxxxxxx>
Including Linux headers from standard-headers breaks build on
non-Linux systems, and <asm/setup_data.h> is the first architecture
specific #include in include/standard-headers/.
So this needs a small fixup, to rewrite asm/ include to the
standard-headers/asm-* subdirectory for the current architecture.
While at it, we should remove asm-generic/kvm_para.h from the list of
allowed includes: it does not have a matching substitution, so if it
appeared it would break the build it on non-Linux systems where there
is no /usr/include/asm-generic/ directory.
Applied patches 2-5 to my QEMU coco tree - still temporary, but
certainly better than the hack that I posted yesterday. By the time
QEMU 9.1 opens there will be something more stable to import from.
Paolo
diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index 579b03dc824..d48856f9e24 100755
--- a/scripts/update-linux-headers.sh
+++ b/scripts/update-linux-headers.sh
@@ -61,7 +61,6 @@ cp_portable() {
-e 'linux/const' \
-e 'linux/kernel' \
-e 'linux/sysinfo' \
- -e 'asm-generic/kvm_para' \
-e 'asm/setup_data.h' \
> /dev/null
then
@@ -78,6 +77,7 @@ cp_portable() {
-e 's/__be\([0-9][0-9]*\)/uint\1_t/g' \
-e 's/"\(input-event-codes\.h\)"/"standard-headers\/linux\/\1"/' \
-e 's/<linux\/\([^>]*\)>/"standard-headers\/linux\/\1"/' \
+ -e 's/<asm\/\([^>]*\)>/"standard-headers\/asm-'$arch'\/\1"/' \
-e 's/__bitwise//' \
-e 's/__attribute__((packed))/QEMU_PACKED/' \
-e 's/__inline__/inline/' \
@@ -157,12 +157,13 @@ for arch in $ARCHLIST; do
cp_portable "$tmpdir/bootparam.h" \
"$output/include/standard-headers/asm-$arch"
cp_portable "$tmpdir/include/asm/setup_data.h" \
- "$output/linux-headers/asm-x86"
+ "$output/standard-headers/asm-x86"
fi
if [ $arch = riscv ]; then
cp "$tmpdir/include/asm/ptrace.h" "$output/linux-headers/asm-riscv/"
fi
done
+arch=
rm -rf "$output/linux-headers/linux"
mkdir -p "$output/linux-headers/linux"