Proposed changes to the _use_current functionality #1
1 changed files with 84 additions and 65 deletions
149
PKGBUILD
149
PKGBUILD
|
@ -152,9 +152,8 @@ export KBUILD_BUILD_HOST=archlinux
|
||||||
export KBUILD_BUILD_USER=${pkgbase}
|
export KBUILD_BUILD_USER=${pkgbase}
|
||||||
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
|
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
|
||||||
|
|
||||||
prepare() {
|
# Applies all patches
|
||||||
cd "${_src_linux}" || exit 1
|
apply_patches() {
|
||||||
|
|
||||||
# Patch with kernel version patches
|
# Patch with kernel version patches
|
||||||
patch -Np1 -i ../patch-${_kernel_major}.${_kernel_minor} || true
|
patch -Np1 -i ../patch-${_kernel_major}.${_kernel_minor} || true
|
||||||
|
|
||||||
|
@ -172,7 +171,27 @@ prepare() {
|
||||||
|
|
||||||
patch -Np1 -i "${srcdir}/cl-linux/${i}" || true
|
patch -Np1 -i "${srcdir}/cl-linux/${i}" || true
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Copies the kernel config
|
||||||
|
copy_defconfig() {
|
||||||
|
local _cur_major_ver="$(zcat /proc/config.gz | grep Linux | grep -o '[0-9]*[0-9]\.[0-9]*[0-9]')"
|
||||||
|
[[ ${_cur_major_ver} != ${_kernel_major} ]] &&
|
||||||
|
warning "Major version was updated, you should regen the defconfig"
|
||||||
|
|
||||||
|
if [[ -s /proc/config.gz ]]; then
|
||||||
|
# modprobe configs
|
||||||
|
zcat /proc/config.gz > ./.config
|
||||||
|
make ${BUILD_FLAGS[*]} olddefconfig
|
||||||
|
else
|
||||||
|
warning "Your kernel was not compiled with IKCONFIG_PROC."
|
||||||
|
warning "Unable to read kernel configuration, aborting."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Updates the kernel config
|
||||||
|
update_defconfig() {
|
||||||
# Copy configuration file (if found)
|
# Copy configuration file (if found)
|
||||||
if [ -f "${startdir}/kconfig" ]; then
|
if [ -f "${startdir}/kconfig" ]; then
|
||||||
echo ":: Using configuration file \"${startdir}/kconfig\""
|
echo ":: Using configuration file \"${startdir}/kconfig\""
|
||||||
|
@ -185,12 +204,12 @@ prepare() {
|
||||||
# Extra configuration
|
# Extra configuration
|
||||||
# General setup
|
# General setup
|
||||||
scripts/config --set-str DEFAULT_HOSTNAME archlinux \
|
scripts/config --set-str DEFAULT_HOSTNAME archlinux \
|
||||||
-e IKCONFIG \
|
-e IKCONFIG \
|
||||||
-e IKCONFIG_PROC \
|
-e IKCONFIG_PROC \
|
||||||
-u RT_GROUP_SCHED
|
-u RT_GROUP_SCHED
|
||||||
# Power management and ACPI options
|
# Power management and ACPI options
|
||||||
scripts/config -e ACPI_REV_OVERRIDE_POSSIBLE \
|
scripts/config -e ACPI_REV_OVERRIDE_POSSIBLE \
|
||||||
-e ACPI_TABLE_UPGRADE
|
-e ACPI_TABLE_UPGRADE
|
||||||
# Virtualization
|
# Virtualization
|
||||||
scripts/config -e KVM_SMM
|
scripts/config -e KVM_SMM
|
||||||
# General architecture-dependent options
|
# General architecture-dependent options
|
||||||
|
@ -201,34 +220,34 @@ prepare() {
|
||||||
scripts/config -e NETFILTER_INGRESS
|
scripts/config -e NETFILTER_INGRESS
|
||||||
# Device Drivers
|
# Device Drivers
|
||||||
scripts/config -e FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER \
|
scripts/config -e FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER \
|
||||||
-e DELL_SMBIOS_SMM \
|
-e DELL_SMBIOS_SMM \
|
||||||
-m PATA_JMICRON \
|
-m PATA_JMICRON \
|
||||||
-E SOUND SOUND_OSS_CORE \
|
-E SOUND SOUND_OSS_CORE \
|
||||||
-e SND_OSSEMUL \
|
-e SND_OSSEMUL \
|
||||||
-M SND_OSSEMUL SND_MIXER_OSS \
|
-M SND_OSSEMUL SND_MIXER_OSS \
|
||||||
-M SND_MIXER_OSS SND_PCM_OSS \
|
-M SND_MIXER_OSS SND_PCM_OSS \
|
||||||
-E SND_PCM_OSS SND_PCM_OSS_PLUGINS \
|
-E SND_PCM_OSS SND_PCM_OSS_PLUGINS \
|
||||||
-m AGP -M AGP AGP_INTEL -M AGP_INTEL AGP_VIA
|
-m AGP -M AGP AGP_INTEL -M AGP_INTEL AGP_VIA
|
||||||
# Kernel hacking -> Compile-time checks and compiler options -> Make section mismatch errors non-fatal
|
# Kernel hacking -> Compile-time checks and compiler options -> Make section mismatch errors non-fatal
|
||||||
scripts/config -e SECTION_MISMATCH_WARN_ONLY
|
scripts/config -e SECTION_MISMATCH_WARN_ONLY
|
||||||
# File systems
|
# File systems
|
||||||
scripts/config -m NTFS3_FS \
|
scripts/config -m NTFS3_FS \
|
||||||
-e NTFS3_LZX_XPRESS \
|
-e NTFS3_LZX_XPRESS \
|
||||||
-e NTFS3_FS_POSIX_ACL
|
-e NTFS3_FS_POSIX_ACL
|
||||||
scripts/config -m SMB_SERVER \
|
scripts/config -m SMB_SERVER \
|
||||||
-e SMB_SERVER_SMBDIRECT \
|
-e SMB_SERVER_SMBDIRECT \
|
||||||
-e SMB_SERVER_CHECK_CAP_NET_ADMIN \
|
-e SMB_SERVER_CHECK_CAP_NET_ADMIN \
|
||||||
-e SMB_SERVER_KERBEROS5
|
-e SMB_SERVER_KERBEROS5
|
||||||
# Security options
|
# Security options
|
||||||
scripts/config -e SECURITY_SELINUX \
|
scripts/config -e SECURITY_SELINUX \
|
||||||
-e SECURITY_SELINUX_BOOTPARAM \
|
-e SECURITY_SELINUX_BOOTPARAM \
|
||||||
-e SECURITY_SMACK \
|
-e SECURITY_SMACK \
|
||||||
-e SECURITY_SMACK_BRINGUP \
|
-e SECURITY_SMACK_BRINGUP \
|
||||||
-e SECURITY_SMACK_NETFILTER \
|
-e SECURITY_SMACK_NETFILTER \
|
||||||
-e SECURITY_SMACK_APPEND_SIGNALS \
|
-e SECURITY_SMACK_APPEND_SIGNALS \
|
||||||
-e SECURITY_TOMOYO \
|
-e SECURITY_TOMOYO \
|
||||||
-e SECURITY_APPARMOR \
|
-e SECURITY_APPARMOR \
|
||||||
-e SECURITY_YAMA
|
-e SECURITY_YAMA
|
||||||
# Security options -> Landlock options
|
# Security options -> Landlock options
|
||||||
scripts/config -e SECURITY_LANDLOCK
|
scripts/config -e SECURITY_LANDLOCK
|
||||||
# Library routines
|
# Library routines
|
||||||
|
@ -236,30 +255,30 @@ prepare() {
|
||||||
|
|
||||||
# Enable LLVM compilation
|
# Enable LLVM compilation
|
||||||
[[ -n "${_use_llvm_lto}" ]] && scripts/config -d LTO_NONE \
|
[[ -n "${_use_llvm_lto}" ]] && scripts/config -d LTO_NONE \
|
||||||
-e LTO \
|
-e LTO \
|
||||||
-e LTO_CLANG \
|
-e LTO_CLANG \
|
||||||
-e ARCH_SUPPORTS_LTO_CLANG \
|
-e ARCH_SUPPORTS_LTO_CLANG \
|
||||||
-e ARCH_SUPPORTS_LTO_CLANG_THIN \
|
-e ARCH_SUPPORTS_LTO_CLANG_THIN \
|
||||||
-e HAS_LTO_CLANG \
|
-e HAS_LTO_CLANG \
|
||||||
-e LTO_CLANG_THIN \
|
-e LTO_CLANG_THIN \
|
||||||
-e HAVE_GCC_PLUGINS
|
-e HAVE_GCC_PLUGINS
|
||||||
|
|
||||||
# Enable or disable debug settings
|
# Enable or disable debug settings
|
||||||
[[ "${_debug}" == "y" ]] && scripts/config -e DEBUG_INFO \
|
[[ "${_debug}" == "y" ]] && scripts/config -e DEBUG_INFO \
|
||||||
-e DEBUG_INFO_BTF \
|
-e DEBUG_INFO_BTF \
|
||||||
-e DEBUG_INFO_DWARF4 \
|
-e DEBUG_INFO_DWARF4 \
|
||||||
-e PAHOLE_HAS_SPLIT_BTF \
|
-e PAHOLE_HAS_SPLIT_BTF \
|
||||||
-e DEBUG_INFO_BTF_MODULES
|
-e DEBUG_INFO_BTF_MODULES
|
||||||
[[ "${_debug}" == "n" ]] && scripts/config -d DEBUG_INFO \
|
[[ "${_debug}" == "n" ]] && scripts/config -d DEBUG_INFO \
|
||||||
-d DEBUG_INFO_BTF \
|
-d DEBUG_INFO_BTF \
|
||||||
-d DEBUG_INFO_DWARF4 \
|
-d DEBUG_INFO_DWARF4 \
|
||||||
-d PAHOLE_HAS_SPLIT_BTF \
|
-d PAHOLE_HAS_SPLIT_BTF \
|
||||||
-d DEBUG_INFO_BTF_MODULES
|
-d DEBUG_INFO_BTF_MODULES
|
||||||
|
|
||||||
# Run olddefconfig
|
# Run olddefconfig
|
||||||
make ${BUILD_FLAGS[*]} olddefconfig
|
make ${BUILD_FLAGS[*]} olddefconfig
|
||||||
diff -u $srcdir/cl-linux/config .config || :
|
diff -u $srcdir/cl-linux/config .config || :
|
||||||
|
|
||||||
# Patch with kernel_compiler_patch patches
|
# Patch with kernel_compiler_patch patches
|
||||||
# This must be executed after olddefconfig
|
# This must be executed after olddefconfig
|
||||||
# to allow for the next section to run.
|
# to allow for the next section to run.
|
||||||
|
@ -269,19 +288,24 @@ prepare() {
|
||||||
[[ -n "${_subarch}" ]] && yes "${_subarch}" | make ${BUILD_FLAGS[*]} oldconfig
|
[[ -n "${_subarch}" ]] && yes "${_subarch}" | make ${BUILD_FLAGS[*]} oldconfig
|
||||||
# Ask for subarch
|
# Ask for subarch
|
||||||
[[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig
|
[[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig
|
||||||
|
|
||||||
|
# Open configuration editors
|
||||||
|
[[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig
|
||||||
|
[[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig
|
||||||
|
[[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig
|
||||||
|
|
||||||
|
# Save configuration
|
||||||
|
[[ -n "${_copyfinalconfig}" ]] && cp -Tf ./.config "${startdir}/kconfig-new" || true
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prepares the installation
|
||||||
|
prepare() {
|
||||||
|
cd "${_src_linux}" || exit 1
|
||||||
|
|
||||||
|
apply_patches
|
||||||
|
|
||||||
# Optionally use the configuration of the running kernel
|
[[ -n "${_use_current}" ]] && copy_defconfig
|
||||||
# Written originally by nous, see
|
[[ -z "${_use_current}" ]] && update_defconfig
|
||||||
# https://web.archive.org/web/20110711231356/https://aur.archlinux.org/packages.php?ID=40191 (package doesn't exist anymore)
|
|
||||||
[[ -n "${_use_current}" ]] &&
|
|
||||||
if [[ -s /proc/config.gz ]]; then
|
|
||||||
# modprobe configs
|
|
||||||
zcat /proc/config.gz > ./.config
|
|
||||||
else
|
|
||||||
warning "Your kernel was not compiled with IKCONFIG_PROC."
|
|
||||||
warning "Unable to read kernel configuration, aborting."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Read and apply modprobed database
|
# Read and apply modprobed database
|
||||||
# See https://aur.archlinux.org/packages/modprobed-db
|
# See https://aur.archlinux.org/packages/modprobed-db
|
||||||
|
@ -294,21 +318,15 @@ prepare() {
|
||||||
|
|
||||||
# Write kernel version
|
# Write kernel version
|
||||||
make -s kernelrelease > version
|
make -s kernelrelease > version
|
||||||
|
|
||||||
# Open configuration editors
|
|
||||||
[[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig
|
|
||||||
[[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig
|
|
||||||
[[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig
|
|
||||||
|
|
||||||
# Save configuration
|
|
||||||
[[ -n "${_copyfinalconfig}" ]] && cp -Tf ./.config "${startdir}/kconfig-new" || true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Build kernel
|
||||||
build() {
|
build() {
|
||||||
cd "${_src_linux}" || exit 1
|
cd "${_src_linux}" || exit 1
|
||||||
make ${BUILD_FLAGS[*]} all
|
make ${BUILD_FLAGS[*]} all
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Packages the kernel package
|
||||||
_package() {
|
_package() {
|
||||||
pkgdesc="${pkgdesc} This package includes the kernel and compiled modules."
|
pkgdesc="${pkgdesc} This package includes the kernel and compiled modules."
|
||||||
depends=("coreutils" "kmod" "initramfs")
|
depends=("coreutils" "kmod" "initramfs")
|
||||||
|
@ -336,6 +354,7 @@ _package() {
|
||||||
rm "${modulesdir}"/build
|
rm "${modulesdir}"/build
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Packages the headers package
|
||||||
_package-headers() {
|
_package-headers() {
|
||||||
pkgdesc="${pkgdesc} This package includes header files and scripts for building kernel modules."
|
pkgdesc="${pkgdesc} This package includes header files and scripts for building kernel modules."
|
||||||
depends=("pahole")
|
depends=("pahole")
|
||||||
|
|
Loading…
Reference in a new issue