scx-upstream/scheds/sync-from-kernel.sh

38 lines
754 B
Bash
Raw Normal View History

2023-11-28 01:40:34 +00:00
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: sync-from-kernel.sh KERNEL_TREE_TO_SYNC_FROM" 1>&2
2023-11-28 01:40:34 +00:00
exit 1
fi
kernel="$1/tools/sched_ext"
files=(include/common/* kernel-examples/*.[hc])
2023-11-28 01:40:34 +00:00
echo "Syncing ${#files[@]} files from \"$1\""
nr_missing=0
for i in "${files[@]}"; do
base=$(basename "$i")
if [ ! -f "$kernel/$base" ]; then
echo "ERROR: $base does not exist in $kernel" 1>&2
2023-11-28 01:40:34 +00:00
nr_missing=$((nr_missing+1))
fi
done
if [ $nr_missing -gt 0 ]; then
exit 1
fi
nr_skipped=0
for i in "${files[@]}"; do
base=$(basename "$i")
if cmp -s "$kernel/$base" $i; then
nr_skipped=$((nr_skipped+1))
continue
fi
echo "Syncing $base"
cp -f "$kernel/$base" $i
done
echo "Skipped $nr_skipped files as they are unchanged"