2009-12-30 00:35:57 +01:00
|
|
|
#!/bin/bash
|
2019-01-07 09:34:24 +01:00
|
|
|
# bash -x $0 linux.git tag
|
2009-12-30 00:35:57 +01:00
|
|
|
set -e
|
|
|
|
kernel=$1
|
2019-01-07 09:34:24 +01:00
|
|
|
if test $# -ne 2 || ! test -d "$1" || test "$2" = "${2#v}"; then
|
|
|
|
echo "Usage: ${0##*/} linux.git tag"
|
2010-09-13 15:48:42 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
2019-01-07 09:34:24 +01:00
|
|
|
case $PWD in
|
|
|
|
*:*)
|
|
|
|
echo "do not call this in a directory with : - make will fail"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2010-09-13 15:48:42 +02:00
|
|
|
|
2019-01-07 09:34:24 +01:00
|
|
|
version=${2#v}
|
|
|
|
kernel_dir=linux-$version
|
|
|
|
header_dir="$PWD/linux-glibc-devel-$version"
|
|
|
|
if test -d "$kernel_dir"; then
|
|
|
|
echo "$kernel_dir exists, remove it first."
|
|
|
|
exit 1
|
2009-12-30 00:35:57 +01:00
|
|
|
fi
|
2019-01-07 09:34:24 +01:00
|
|
|
if ! mkdir "$header_dir"; then
|
|
|
|
echo "$header_dir exists, remove it first."
|
|
|
|
exit 1
|
2009-12-30 00:35:57 +01:00
|
|
|
fi
|
2019-01-07 09:34:24 +01:00
|
|
|
git clone --single-branch -b "$2" "$1" "$kernel_dir"
|
2019-09-18 12:58:04 +02:00
|
|
|
remove="arc c6x csky h8300 hexagon microblaze nds32 nios2 openrisc sh unicore32 xtensa um"
|
|
|
|
archs=$(cd "$kernel_dir/arch" &&
|
|
|
|
for arch in *; do
|
|
|
|
test -d $arch || continue
|
|
|
|
case " $remove " in *" $arch "*) continue;; esac
|
|
|
|
echo $arch
|
|
|
|
done)
|
2019-01-07 09:34:24 +01:00
|
|
|
pushd "$kernel_dir"
|
2019-09-18 12:58:04 +02:00
|
|
|
for arch in $archs; do
|
|
|
|
mkdir "$header_dir/$arch"
|
|
|
|
cp Makefile "$header_dir/$arch"
|
|
|
|
make O="$header_dir/$arch" headers_install ARCH=$arch
|
|
|
|
done
|
2009-12-30 00:35:57 +01:00
|
|
|
popd
|
|
|
|
pushd "$header_dir"
|
2019-09-18 12:58:04 +02:00
|
|
|
find -type f \( -name ".*.cmd" -o -name Makefile \) -exec rm {} +
|
|
|
|
for arch in $archs; do
|
|
|
|
cd $arch
|
|
|
|
#-------------------------------------------------------------------
|
|
|
|
#Fri Sep 5 10:43:49 CEST 2008 - matz@suse.de
|
2009-12-30 00:35:57 +01:00
|
|
|
|
2019-09-18 12:58:04 +02:00
|
|
|
#- Remove the kernel version of drm headers, they conflict
|
|
|
|
# with the libdrm ones, and those are slightly newer.
|
|
|
|
#
|
|
|
|
rm -rf usr/include/drm/
|
|
|
|
# Remove confusing empty uapi directory
|
|
|
|
test ! -d usr/include/uapi || rmdir usr/include/uapi
|
|
|
|
for dir in *; do
|
|
|
|
case "$dir" in
|
|
|
|
usr) ;;
|
|
|
|
*)
|
|
|
|
if test -d "$dir"; then
|
|
|
|
rm -rf "$dir"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
cd ..
|
2009-12-30 00:35:57 +01:00
|
|
|
done
|
|
|
|
popd
|
2019-09-18 12:58:04 +02:00
|
|
|
du -sh "$header_dir"
|
2016-08-08 11:25:49 +02:00
|
|
|
tar -cJf "$header_dir.tar.xz" --owner=root --group=root "${header_dir##*/}"
|
2019-01-07 09:34:24 +01:00
|
|
|
rm -rf "$header_dir" "$kernel_dir"
|