@@ -28,23 +28,33 @@ if [ -z "$output" ]; then
output="$PWD"
fi
-for arch in x86 powerpc s390; do
- make -C "$linux" INSTALL_HDR_PATH="$tmpdir" SRCARCH=$arch headers_install
-
- rm -rf "$output/linux-headers/asm-$arch"
- mkdir -p "$output/linux-headers/asm-$arch"
- for header in kvm.h kvm_para.h; do
- cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch"
- done
- if [ $arch = x86 ]; then
- cp "$tmpdir/include/asm/hyperv.h" "$output/linux-headers/asm-x86"
- fi
-done
+IFS=$'\n'
+
+#get list of files
+dirs=`git ls-tree HEAD -- linux-headers/|grep tree|cut -f 2`
+if [ -z "$dirs" ]; then
+ echo "Unable to get list of directories under linux-headers/ to update"
+fi
-rm -rf "$output/linux-headers/linux"
-mkdir -p "$output/linux-headers/linux"
-for header in kvm.h kvm_para.h vhost.h virtio_config.h virtio_ring.h; do
- cp "$tmpdir/include/linux/$header" "$output/linux-headers/linux"
+for d in $dirs; do
+ a=${d/#linux-headers\//}
+ case "$a" in
+ asm-*)
+ arch=${a/asm-/}
+ make -C "$linux" INSTALL_HDR_PATH="$tmpdir" SRCARCH=$arch headers_install
+ files=`git ls-tree -r HEAD -- "$d" |cut -f 2`
+ for dst in $files; do
+ src=include/asm/${dst/linux-headers\/asm-$arch\//}
+ cp -f "$tmpdir/$src" "$output/$dst" || exit 2
+ done ;;
+ *)
+ make -C "$linux" INSTALL_HDR_PATH="$tmpdir" headers_install
+ files=`git ls-tree -r HEAD -- "$d" |cut -f 2`
+ for dst in $files; do
+ src=include/${dst/linux-headers\//}
+ cp -f "$tmpdir/$src" "$output/$dst" || exit 2
+ done ;;
+ esac
done
if [ -L "$linux/source" ]; then
cp "$linux/source/COPYING" "$output/linux-headers"