Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
google
GitHub Repository: google/crosvm
Path: blob/main/kernel_loader/bindgen.sh
5392 views
1
#!/usr/bin/env bash
2
# Copyright 2022 The ChromiumOS Authors
3
# Use of this source code is governed by a BSD-style license that can be
4
# found in the LICENSE file.
5
6
# Regenerate kernel_loader bindgen bindings.
7
8
set -euo pipefail
9
cd "$(dirname "${BASH_SOURCE[0]}")/.."
10
11
source tools/impl/bindgen-common.sh
12
13
KERNEL_LOADER_EXTRA="// Added by kernel_loader/bindgen.sh
14
use zerocopy::FromBytes;
15
use zerocopy::Immutable;
16
use zerocopy::IntoBytes;
17
use zerocopy::KnownLayout;"
18
19
bindgen_generate \
20
--raw-line "${KERNEL_LOADER_EXTRA}" \
21
--blocklist-item='ASM_INPUT_.*' \
22
--blocklist-item='.*BITS_PER_.*' \
23
--blocklist-item='__FD_SETSIZE' \
24
--allowlist-type='Elf32_Ehdr' \
25
--allowlist-type='Elf32_Phdr' \
26
--allowlist-type='Elf64_Ehdr' \
27
--allowlist-type='Elf64_Phdr' \
28
--allowlist-var='.+' \
29
--with-derive-custom "elf32_hdr=FromBytes,Immutable,IntoBytes,KnownLayout" \
30
--with-derive-custom "elf64_hdr=FromBytes,Immutable,IntoBytes,KnownLayout" \
31
--with-derive-custom "elf32_phdr=FromBytes,Immutable,IntoBytes,KnownLayout" \
32
--with-derive-custom "elf64_phdr=FromBytes,Immutable,IntoBytes,KnownLayout" \
33
"${BINDGEN_LINUX_X86_HEADERS}/include/linux/elf.h" \
34
-- \
35
-isystem "${BINDGEN_LINUX_X86_HEADERS}/include" \
36
| replace_linux_int_types \
37
> kernel_loader/src/elf.rs
38
39