Proposed changes to the _use_current functionality #1
1 changed files with 84 additions and 65 deletions
65
PKGBUILD
65
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\""
|
||||||
|
@ -270,18 +289,23 @@ prepare() {
|
||||||
# Ask for subarch
|
# Ask for subarch
|
||||||
[[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig
|
[[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig
|
||||||
|
|
||||||
# Optionally use the configuration of the running kernel
|
# Open configuration editors
|
||||||
# Written originally by nous, see
|
[[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig
|
||||||
# https://web.archive.org/web/20110711231356/https://aur.archlinux.org/packages.php?ID=40191 (package doesn't exist anymore)
|
[[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig
|
||||||
[[ -n "${_use_current}" ]] &&
|
[[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig
|
||||||
if [[ -s /proc/config.gz ]]; then
|
|
||||||
# modprobe configs
|
# Save configuration
|
||||||
zcat /proc/config.gz > ./.config
|
[[ -n "${_copyfinalconfig}" ]] && cp -Tf ./.config "${startdir}/kconfig-new" || true
|
||||||
else
|
}
|
||||||
warning "Your kernel was not compiled with IKCONFIG_PROC."
|
|
||||||
warning "Unable to read kernel configuration, aborting."
|
# Prepares the installation
|
||||||
exit
|
prepare() {
|
||||||
fi
|
cd "${_src_linux}" || exit 1
|
||||||
|
|
||||||
|
apply_patches
|
||||||
|
|
||||||
|
[[ -n "${_use_current}" ]] && copy_defconfig
|
||||||
|
[[ -z "${_use_current}" ]] && update_defconfig
|
||||||
|
|
||||||
# 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