71 lines
1.9 KiB
Text
Executable file
71 lines
1.9 KiB
Text
Executable file
# Description: Linux kernel, sources and modules
|
|
# URL:
|
|
# Maintainer: Emmett1, emmett1 dot 2miligrams at gmail dot com
|
|
# Depends on: elfutils mkinitramfs openssl linux-firmware
|
|
|
|
name=linux
|
|
version=4.19.66
|
|
release=1
|
|
source=(https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-$version.tar.xz
|
|
config-$version)
|
|
|
|
build() {
|
|
cd linux-$version
|
|
|
|
make mrproper
|
|
|
|
cp $SRC/config-$version ./.config
|
|
|
|
sed '/^CONFIG_LOCALVERSION=/d' -i .config
|
|
echo 'CONFIG_LOCALVERSION="-LFS"' >> .config
|
|
|
|
kernver=${version}$(grep CONFIG_LOCALVERSION= .config | cut -d '"' -f2)
|
|
|
|
#make menuconfig
|
|
make bzImage modules
|
|
make INSTALL_MOD_PATH=$PKG modules_install
|
|
|
|
mkdir -p $PKG/boot
|
|
|
|
cp arch/x86/boot/bzImage $PKG/boot/vmlinuz-lfs
|
|
echo $kernver > $PKG/lib/modules/KERNELVERSION
|
|
|
|
make clean
|
|
make prepare
|
|
|
|
rm -rf $PKG/lib/firmware
|
|
|
|
for file in $(ls arch); do
|
|
case $file in
|
|
x86|Kconfig) continue ;;
|
|
*) rm -fr arch/$file ;;
|
|
esac
|
|
done
|
|
|
|
# strip down sources
|
|
# don't package the kernel in the sources directory
|
|
find . -name "*Image" -exec rm "{}" \;
|
|
find . -name "*.cmd" -exec rm -f "{}" \;
|
|
rm -f .*.d
|
|
|
|
rm -fr firmware ipc .config.old .version .cocciconfig \
|
|
.get_maintainer.ignore .gitattributes .gitignore .mailmap \
|
|
COPYING CREDITS MAINTAINERS README Documentation
|
|
find . -name ".gitignore" -exec rm "{}" \;
|
|
for dir in block certs crypto drivers fs init kernel lib mm net samples security sound usr virt; do
|
|
find $dir -type f \( -name "*.c" -o -name "*.h" \) -exec rm "{}" \;
|
|
done
|
|
for i in $(ls tools); do
|
|
[ "$i" = "objtool" ] || rm -fr tools/$i
|
|
done
|
|
for i in $(ls tools/objtool); do
|
|
[ "$i" = "objtool" ] || rm -fr tools/objtool/$i
|
|
done
|
|
|
|
rm $PKG/lib/modules/$kernver/{build,source}
|
|
mv $SRC/linux-$version $PKG/lib/modules/$kernver/build
|
|
ln -sv build $PKG/lib/modules/$kernver/source
|
|
|
|
# remove now broken symlinks
|
|
find -L $PKG/lib/modules/$kernver/build -type l -exec rm -f "{}" \;
|
|
}
|