Add menuconfig

This commit is contained in:
JeremyStar™ 2024-03-22 15:34:41 +01:00
parent 67ae4ef5d3
commit ce6d47775c
3 changed files with 29 additions and 2 deletions

View file

@ -6,6 +6,10 @@
### BUILD OPTIONS
# Set to anything but null to activate
# Tweak kernel options prior to a build via menuconfig
: "${_makemenuconfig:=""}"
# Set to anything but null to activate
# Tweak kernel options prior to a build via nconfig
: "${_makenconfig:=""}"
@ -222,6 +226,10 @@ prepare() {
echo ":: prepare: writing kernel version"
make -s kernelrelease > version
[[ -z "$_makemenuconfig" ]] || (
echo ":: prepare: executing menuconfig"
make ${BUILD_FLAGS[*]} menuconfig
)
[[ -z "$_makexconfig" ]] || (
echo ":: prepare: executing xconfig"
make ${BUILD_FLAGS[*]} xconfig

View file

@ -138,6 +138,10 @@ prepare() {
echo ":: prepare: writing kernel version"
make -s kernelrelease > version
[[ -z "$_makemenuconfig" ]] || (
echo ":: prepare: executing menuconfig"
make ${BUILD_FLAGS[*]} menuconfig
)
[[ -z "$_makexconfig" ]] || (
echo ":: prepare: executing xconfig"
make ${BUILD_FLAGS[*]} xconfig

View file

@ -160,6 +160,21 @@ function ask_tmpfs() {
ask_tmpfs
esac
}
## Ask for kernel config modification using menuconfig
function ask_menuconfig() {
read -rp "$(infoh "Do you want to configure the kernel using menuconfig before build [y/N]? ")" BUILDTOOL_MENUCONFIG
case "${BUILDTOOL_MENUCONFIG}" in
"y"|"Y")
export "BUILDTOOL_PKGBUILD_MENUCONFIG=_makemenuconfig=SET"
;;
"n"|"N"|"")
export "BUILDTOOL_PKGBUILD_MENUCONFIG=_makemenuconfig="
;;
*)
errorh "Invalid answer. Please answer with Y or N"
ask_menuconfig
esac
}
## Ask for kernel config modification using xconfig
function ask_xconfig() {
read -rp "$(infoh "Do you want to configure the kernel using xconfig before build [y/N]? ")" BUILDTOOL_XCONFIG
@ -411,14 +426,14 @@ if [ -n "${BUILDTOOL_DEBUG}" ]; then
diage "Environment variables:"
env|grep "BUILDTOOL_"|sort
diagh "More debug information:"
diage "Build cmdline=${BUILDTOOL_BUILDCMDLINE} ${BUILDTOOL_PKGBUILD_XCONFIG} ${BUILDTOOL_PKGBUILD_NCONFIG} ${BUILDTOOL_PKGBUILD_CPFINALCONFIG} ${BUILDTOOL_PKGBUILD_MODPROBEDDB} ${BUILDTOOL_PKGBUILD_SUBARCHITECTURE} ${BUILDTOOL_PKGBUILD_DEBUG} makepkg --syncdeps -p PKGBUILD.buildtool"
diage "Build cmdline=${BUILDTOOL_BUILDCMDLINE} ${BUILDTOOL_PKGBUILD_MENUCONFIG} ${BUILDTOOL_PKGBUILD_XCONFIG} ${BUILDTOOL_PKGBUILD_NCONFIG} ${BUILDTOOL_PKGBUILD_CPFINALCONFIG} ${BUILDTOOL_PKGBUILD_MODPROBEDDB} ${BUILDTOOL_PKGBUILD_SUBARCHITECTURE} ${BUILDTOOL_PKGBUILD_DEBUG} makepkg --syncdeps -p PKGBUILD.buildtool"
diage "Cwd=$(pwd)"
fi
# Build package
infoh "Building package"
# shellcheck disable=SC2086
if ! ${BUILDTOOL_BUILDCMDLINE} "${BUILDTOOL_PKGBUILD_XCONFIG}" "${BUILDTOOL_PKGBUILD_NCONFIG}" "${BUILDTOOL_PKGBUILD_CPFINALCONFIG}" "${BUILDTOOL_PKGBUILD_MODPROBEDDB}" "${BUILDTOOL_PKGBUILD_SUBARCHITECTURE}" "${BUILDTOOL_PKGBUILD_DEBUG}" makepkg --syncdeps${BUILDTOOL_MAKEPKG_REUSE} -p PKGBUILD.buildtool; then
if ! ${BUILDTOOL_BUILDCMDLINE} "${BUILDTOOL_PKGBUILD_MENUCONFIG}" "${BUILDTOOL_PKGBUILD_XCONFIG}" "${BUILDTOOL_PKGBUILD_NCONFIG}" "${BUILDTOOL_PKGBUILD_CPFINALCONFIG}" "${BUILDTOOL_PKGBUILD_MODPROBEDDB}" "${BUILDTOOL_PKGBUILD_SUBARCHITECTURE}" "${BUILDTOOL_PKGBUILD_DEBUG}" makepkg --syncdeps${BUILDTOOL_MAKEPKG_REUSE} -p PKGBUILD.buildtool; then
errorh "Failed package compilation: makepkg returned with non-zero exit code"
errore "Please report this at \"${BUILDTOOL_ISSUETRACKER}\""
exit 1