File: import-linux-headers.sh

package info (click to toggle)
rust-virtio-bindings 0.2.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,124 kB
  • sloc: sh: 64; makefile: 4
file content (33 lines) | stat: -rwxr-xr-x 776 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# SPDX-License-Identifier: (BSD-3-Clause OR Apache-2.0)
# Copyright Red Hat, Inc.
#
# ./import-linux-headers.sh path/to/kernel/headers
#
# Import header files from a Linux kernel header tree. Be sure to run `cargo
# build` to test that bindgen succeeds before committing the updated headers.

src=$1
dst=include/linux

import_header() {
	# Use our local header files rather than system headers
	sed -e 's%#include <\([^>]*\)>%#include "\1"%' "$1" >"$2"
}

mkdir -p "$dst"

# If you change this list, remember to update build.rs
for header in \
	virtio_blk \
	virtio_config \
	virtio_gpu \
	virtio_ids \
	virtio_input \
	virtio_mmio \
	virtio_net \
	virtio_ring \
	virtio_scsi \
	virtio_types; do
	import_header "$src/include/linux/$header.h" "$dst/$header.h"
done