crosvm/kernel_loader/bindgen.sh
Daniel Verkamp f20af151e2 crosvm: upgrade zerocopy to 0.8
BUG=b:372549215
TEST=tools/dev_container tools/presubmit

Change-Id: I3fcc524d1c6c41ae92c51cecb6e4d856c3d60670
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/6255229
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2025-02-24 11:35:51 -08:00

37 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# 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.
# Regenerate kernel_loader bindgen bindings.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
source tools/impl/bindgen-common.sh
KERNEL_LOADER_EXTRA="// Added by kernel_loader/bindgen.sh
use zerocopy::FromBytes;
use zerocopy::Immutable;
use zerocopy::IntoBytes;
use zerocopy::KnownLayout;"
bindgen_generate \
--raw-line "${KERNEL_LOADER_EXTRA}" \
--blocklist-item='ASM_INPUT_.*' \
--blocklist-item='.*BITS_PER_.*' \
--blocklist-item='__FD_SETSIZE' \
--allowlist-type='Elf32_Ehdr' \
--allowlist-type='Elf32_Phdr' \
--allowlist-type='Elf64_Ehdr' \
--allowlist-type='Elf64_Phdr' \
--allowlist-var='.+' \
--with-derive-custom "elf32_hdr=FromBytes,Immutable,IntoBytes,KnownLayout" \
--with-derive-custom "elf64_hdr=FromBytes,Immutable,IntoBytes,KnownLayout" \
--with-derive-custom "elf32_phdr=FromBytes,Immutable,IntoBytes,KnownLayout" \
--with-derive-custom "elf64_phdr=FromBytes,Immutable,IntoBytes,KnownLayout" \
"${BINDGEN_LINUX}/include/uapi/linux/elf.h" \
-- \
-isystem "${BINDGEN_LINUX}/include" \
| replace_linux_int_types \
> kernel_loader/src/elf.rs