custom/linux-rc/spkgbuild

81 lines
2.2 KiB
Plaintext

# description : Linux kernel, sources and modules
# depends : elfutils openssl yaml bc
name=linux-rc
version=6.9.0
release=7
source="https://git.kernel.org/torvalds/t/${name%-*}-${version%.*}-rc$release.tar.gz
config-ryzen config-ryzen3 config-ryzen7"
NO_STRIP=yes
build() {
cd ${name%-*}-${version%.*}-rc$release
make mrproper
cp $SRC/config-$(hostname) ./.config
make oldconfig
sed '/^CONFIG_LOCALVERSION=/d' -i .config
echo 'CONFIG_LOCALVERSION="-Venom-RC"' >> .config
kernver=${version}-rc$release$(grep CONFIG_LOCALVERSION= .config | cut -d '"' -f2)
#make menuconfig
# https://github.com/graysky2/kernel_compiler_patch
# Define a '-march= option' exporting the value/values
# for the KCFLAGS and KCPPFLAGS before calling make.
# More info: https://docs.kernel.org/kbuild/kbuild.html
export KCFLAGS=' -march=native'
export KCPPFLAGS=' -march=native'
make
make INSTALL_MOD_PATH=$PKG modules_install
mkdir -p $PKG/boot
cp -iv arch/x86/boot/bzImage $PKG/boot/vmlinuz-venom-rc
cp -iv .config $PKG/boot/config-venom-rc
#cp -iv System.map $PKG/boot/
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 #$PKG/lib/modules/$kernver/source
mv $SRC/${name%-*}-${version%.*}-rc$release $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 "{}" \;
}