install kernel headers, synlink /usr/src/linux

This commit is contained in:
Gwenhael Le Moine 2020-09-10 13:26:38 +02:00
parent 9d4a294ded
commit 3cab462156
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -31,7 +31,9 @@ fi
mkdir -p $PKG/usr/src/ mkdir -p $PKG/usr/src/
tar xf $CWD/linux-$VERSION.tar.gz -C $PKG/usr/src/ tar xf $CWD/linux-$VERSION.tar.gz -C $PKG/usr/src/
cd $PKG/usr/src/linux-$VERSION cd $PKG/usr/src/
ln -s linux-$VERSION linux
cd linux-$VERSION
if [ -e $CWD/config-$VERSION ] ; then if [ -e $CWD/config-$VERSION ] ; then
cp $CWD/config-$VERSION .config cp $CWD/config-$VERSION .config
@ -52,6 +54,29 @@ if [[ "$ARCH" == "aarch64" ]]; then
fi fi
make modules_install INSTALL_MOD_PATH=$PKG make modules_install INSTALL_MOD_PATH=$PKG
if [ -z "${HEADERS_ARCH}" ]; then
case "$(uname -m)" in
i?86) HEADERS_ARCH=x86 ;;
x86_64) HEADERS_ARCH=x86 ;;
# Use uname -m for all other archs:
*) HEADERS_ARCH=$(uname -m) ;;
esac
fi
# Generate the kernel headers and clean them up:
( echo "Generating headers from the Linux kernel source tree in ${KERNEL_SOURCE}:"
make headers_install ARCH=${HEADERS_ARCH} INSTALL_HDR_PATH=$PKG/usr
cd $PKG/usr/include
# You won't want these files. The ones in libdrm work better.
rm -rf drm
# This next part seems pretty much cosmetic, but since we've been doing this
# for a long time (and others also do), we'll stick with it:
mv asm asm-${HEADERS_ARCH}
ln -sf asm-${HEADERS_ARCH} asm
# Remove unneeded dotfiles:
find . -name ".??*" -exec rm -f {} \+
)
VERSION=$(basename $(ls $PKG/lib/modules/ | head -n1)) VERSION=$(basename $(ls $PKG/lib/modules/ | head -n1))
mkdir -p $PKG/install mkdir -p $PKG/install