2009-12-30 00:35:57 +01:00
|
|
|
#!/bin/bash
|
2012-12-21 10:34:49 +01:00
|
|
|
# bash -x $0 linux-1.2.3.tar.xz
|
2009-12-30 00:35:57 +01:00
|
|
|
set -e
|
|
|
|
kernel=$1
|
|
|
|
if ! test -f "$1"
|
|
|
|
then
|
2012-12-21 10:34:49 +01:00
|
|
|
echo "Usage: ${0##*/} linux-1.2.3.tar.xz"
|
2009-12-30 00:35:57 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
2010-09-13 15:48:42 +02:00
|
|
|
if echo $PWD | grep -q :; then
|
|
|
|
echo "do not call this in a directory with : - make will fail"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2009-12-30 00:35:57 +01:00
|
|
|
kernel_dir="`tar -tf $1 | sed '1 {s@^.*[[:blank:]]@@;s@linux-@@;s@/.*$@@;s@^\([0-9]\+\.[0-9]\+\.[0-9]\+\)\(.*\)@\1@;p;Q}'`"
|
|
|
|
header_dir="$PWD/linux-glibc-devel-$kernel_dir"
|
|
|
|
if test -d "$kernel_dir"
|
|
|
|
then
|
|
|
|
echo "$kernel_dir exists, remove it first."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if ! mkdir "$header_dir"
|
|
|
|
then
|
|
|
|
echo "$header_dir exists, remove it first."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
tar -xf $1
|
|
|
|
pushd linux-${kernel_dir}
|
|
|
|
cp Makefile $header_dir
|
2011-06-29 10:03:59 +02:00
|
|
|
# header export for unicore32 in 2.6.39 is broken, disable it
|
|
|
|
sed -i -e 's/cris/cris\|unicore32/' scripts/headers.sh
|
2009-12-30 00:35:57 +01:00
|
|
|
/usr/bin/make O="$header_dir" headers_install_all
|
|
|
|
# kvm.h and aout.h are only installed if SRCARCH is an architecture
|
|
|
|
# that has support for them. As the package is noarch we need to make
|
|
|
|
# sure we get the full support on x86
|
|
|
|
/usr/bin/make SRCARCH=x86 O="$header_dir" headers_install_all
|
|
|
|
popd
|
|
|
|
pushd "$header_dir"
|
|
|
|
for asm in \
|
|
|
|
alpha \
|
|
|
|
avr32 \
|
|
|
|
blackfin \
|
|
|
|
cris \
|
|
|
|
frv \
|
|
|
|
h8300 \
|
|
|
|
m32r \
|
|
|
|
m68knommu \
|
|
|
|
mips \
|
|
|
|
mn10300 \
|
|
|
|
sh \
|
|
|
|
sh64 \
|
|
|
|
v850 \
|
|
|
|
xtensa \
|
2011-06-29 10:03:59 +02:00
|
|
|
unicore32 \
|
2009-12-30 00:35:57 +01:00
|
|
|
; do
|
|
|
|
rm -rf usr/include/asm-$asm
|
|
|
|
done
|
|
|
|
rm Makefile
|
|
|
|
find -type f -name "..install.cmd" -print0 | xargs -0 --no-run-if-empty rm
|
|
|
|
find -type f -name ".install" -print0 | xargs -0 --no-run-if-empty rm
|
|
|
|
#-------------------------------------------------------------------
|
|
|
|
#Fri Sep 5 10:43:49 CEST 2008 - matz@suse.de
|
|
|
|
|
|
|
|
#- Remove the kernel version of drm headers, they conflict
|
|
|
|
# with the libdrm ones, and those are slightly newer.
|
|
|
|
#
|
|
|
|
rm -rf usr/include/drm/
|
2017-01-11 15:03:17 +01:00
|
|
|
# Remove confusing empty uapi directory
|
2017-07-03 10:48:22 +02:00
|
|
|
test ! -d usr/include/uapi || rmdir usr/include/uapi
|
2009-12-30 00:35:57 +01:00
|
|
|
for dir in *
|
|
|
|
do
|
|
|
|
case "$dir" in
|
|
|
|
usr) ;;
|
|
|
|
*)
|
|
|
|
if test -d "$dir"
|
|
|
|
then
|
|
|
|
rm -rf "$dir"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
popd
|
|
|
|
du -sh "$header_dir/usr"
|
2016-08-08 11:25:49 +02:00
|
|
|
tar -cJf "$header_dir.tar.xz" --owner=root --group=root "${header_dir##*/}"
|
2011-06-29 10:03:59 +02:00
|
|
|
rm -rf $header_dir linux-${kernel_dir}
|
|
|
|
|