| 1 |
#!/usr/bin/env bash |
| 2 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 3 |
set -eu |
| 4 |
set -o pipefail |
| 5 |
|
| 6 |
# The directory must be userspace kernel header directory: |
| 7 |
# git clone [email protected]:torvalds/linux.git |
| 8 |
# make -C linux headers |
| 9 |
# ./update.sh linux |
| 10 |
SRCDIR=${1?} |
| 11 |
|
| 12 |
for i in *.h */*.h; do |
| 13 |
if [[ "$i" == bpf_insn.h ]]; then |
| 14 |
cp "$SRCDIR/samples/bpf/$i" "$i" |
| 15 |
else |
| 16 |
cp "$SRCDIR/usr/include/linux/$i" "$i" |
| 17 |
fi |
| 18 |
|
| 19 |
case "$i" in |
| 20 |
auto_dev-ioctl.h) |
| 21 |
# set AUTOFS_DEV_IOCTL_VERSION_MINOR to 0 |
| 22 |
sed -r -i '/^#define[[:space:]]+AUTOFS_DEV_IOCTL_VERSION_MINOR/ s/[0-9]+/0/' "$i" |
| 23 |
;; |
| 24 |
dm-ioctl.h) |
| 25 |
# set DM_VERSION_MINOR to 27 |
| 26 |
sed -r -i '/^#define[[:space:]]+DM_VERSION_MINOR/ s/[0-9]+/27/' "$i" |
| 27 |
;; |
| 28 |
ethtool.h) |
| 29 |
# add casts in ethtool_cmd_speed() |
| 30 |
sed -r -i '/return (ep->speed_hi << 16) | ep->speed;/ s/return .*;/return ((__u32) ep->speed_hi << 16) | (__u32) ep->speed;/' "$i" |
| 31 |
;; |
| 32 |
esac |
| 33 |
done |