mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-25 05:03:05 +00:00
2712fc59b1
Switch to the ChromeOS v6.1 branch and regenerate all affected bindings in the crosvm tree. Some minor fixes were required in users of the bindings: - KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2 is available in the kernel now and was removed from the manually-added section of kvm_sys. - The KVM system_event now contains an anonymous union, requiring a few renames. - IORING_OP_* were moved into an enum, which required the enum name to be prefixed to the uses of those values. BUG=None TEST=tools/presubmit --all Change-Id: I84568fb76658832130e2e9a631495ba82fd4c3ed Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4285742 Reviewed-by: Elie Kheirallah <khei@google.com> Reviewed-by: Zihan Chen <zihanchen@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
74 lines
2.6 KiB
Bash
Executable file
74 lines
2.6 KiB
Bash
Executable file
# Copyright 2022 The ChromiumOS Authors
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
# Helper functions for bindgen scripts sourced by tools/bindgen-all-the-things.
|
|
|
|
export BINDGEN_LINUX="${PWD}/../../third_party/kernel/v6.1"
|
|
|
|
export BINDGEN_PLATFORM2="${PWD}/../../platform2"
|
|
|
|
export BINDGEN_OPTS=(
|
|
'--disable-header-comment'
|
|
'--no-layout-tests'
|
|
'--no-doc-comments'
|
|
'--with-derive-default'
|
|
'--size_t-is-usize'
|
|
)
|
|
|
|
export BINDGEN_HEADER="/* automatically generated by tools/bindgen-all-the-things */
|
|
|
|
#![allow(clippy::missing_safety_doc)]
|
|
#![allow(clippy::upper_case_acronyms)]
|
|
#![allow(non_upper_case_globals)]
|
|
#![allow(non_camel_case_types)]
|
|
#![allow(non_snake_case)]
|
|
#![allow(dead_code)]
|
|
"
|
|
|
|
# Delete definitions of types like __u32 and replace their uses with the equivalent native Rust
|
|
# type, like u32. This ensures that the types are correctly sized on all platforms, unlike the
|
|
# definitions from the system headers, which resolve to C types like short/int/long that may vary
|
|
# across architectures.
|
|
replace_linux_int_types() {
|
|
sed -E -e '/^pub type __(u|s)(8|16|32|64) =/d' -e 's/__u(8|16|32|64)/u\1/g' -e 's/__s(8|16|32|64)/i\1/g'
|
|
cat
|
|
}
|
|
|
|
# Delete definitions of types like __le32 and __be32 and replace their uses with the equivalent
|
|
# data_model types.
|
|
replace_linux_endian_types() {
|
|
sed -E -e '/^pub type __(l|b)e(16|32|64) =/d' -e 's/__le(16|32|64)/Le\1/g' -e 's/__be(16|32|64)/Be\1/g'
|
|
}
|
|
|
|
# Wrapper for bindgen used by the various bindgen.sh scripts.
|
|
# Pass extra bindgen options and the .h filename as parameters.
|
|
# Output is produced on stdout and should be redirected to a file.
|
|
bindgen_generate() {
|
|
echo "${BINDGEN_HEADER}"
|
|
bindgen "${BINDGEN_OPTS[@]}" "$@"
|
|
}
|
|
|
|
bindgen_cleanup() {
|
|
rm -rf "${BINDGEN_LINUX_X86_HEADERS}" "${BINDGEN_LINUX_ARM64_HEADERS}"
|
|
}
|
|
|
|
# Install Linux kernel headers for x86 and arm into temporary locations. These are used for KVM bindings.
|
|
|
|
if [[ -z "${BINDGEN_LINUX_X86_HEADERS+x}" || ! -d "${BINDGEN_LINUX_X86_HEADERS}" ||
|
|
-z "${BINDGEN_LINUX_ARM64_HEADERS+x}" || ! -d "${BINDGEN_LINUX_ARM64_HEADERS}" ]]; then
|
|
export BINDGEN_LINUX_X86_HEADERS='/tmp/bindgen_linux_x86_headers'
|
|
export BINDGEN_LINUX_ARM64_HEADERS='/tmp/bindgen_linux_arm64_headers'
|
|
|
|
trap bindgen_cleanup EXIT
|
|
|
|
echo -n "Installing Linux headers for x86 and arm64..."
|
|
(
|
|
cd "${BINDGEN_LINUX}"
|
|
nproc=$(nproc)
|
|
make -s headers_install ARCH=x86 INSTALL_HDR_PATH="${BINDGEN_LINUX_X86_HEADERS}" -j "${nproc}"
|
|
make -s headers_install ARCH=arm64 INSTALL_HDR_PATH="${BINDGEN_LINUX_ARM64_HEADERS}" -j "${nproc}"
|
|
make -s mrproper
|
|
)
|
|
echo " done."
|
|
fi
|