PKGBUILD: allow passing the subarch value as the Kconfig name

It'll be easier to maintain for the users instead of using fixed
numbers. The doc was also updated.
This commit is contained in:
Yaraslau Furman 2025-01-04 20:16:32 +02:00
parent d0fecf90fe
commit 4dea0881c4

View file

@ -66,9 +66,10 @@
# Set to anything but null to activate. # Set to anything but null to activate.
: "${_localmodcfg:=""}" : "${_localmodcfg:=""}"
# Optionally select a sub architecture by number or # Optionally select a sub architecture by number or its Kconfig name,
# leave blank, which will require user interaction during the build. # for example MCORE2 or MZEN4.
# Note that the default option is 41. # Leaving it blank will require user interaction during the build.
# Note that the default option is empty.
# #
# 1. AMD Opteron/Athlon64/Hammer/K8 (MK8) # 1. AMD Opteron/Athlon64/Hammer/K8 (MK8)
# 2. AMD Opteron/Athlon64/Hammer/K8 with SSE3 (MK8SSE3) # 2. AMD Opteron/Athlon64/Hammer/K8 with SSE3 (MK8SSE3)
@ -326,18 +327,27 @@ update_defconfig() {
# Here we slightly break the config by removing one of the # Here we slightly break the config by removing one of the
# members of the 'Processor family' selection. # members of the 'Processor family' selection.
# This causes oldconfig to invoke that selection always. # This causes oldconfig to always invoke that selection.
sed -i '/CONFIG_GENERIC_CPU/d' .config || : sed -i '/CONFIG_GENERIC_CPU/d' .config || :
# For a slim chance that someone is building X86_32 # For a slim chance that someone is building X86_32
sed -i '/CONFIG_M686/d' .config || : sed -i '/CONFIG_M686/d' .config || :
# Set subarch automatically
if [ -n "${_subarch}" ]; then if [ -n "${_subarch}" ]; then
if [ "${_subarch}" == "41" ]; then # check if subarch is a number
yes "${_subarch} if [[ ${_subarch} =~ ^[0-9]+$ ]] && ((_subarch>=1)); then
if [ "${_subarch}" == "41" ]; then
yes "${_subarch}
${_subarch_microarch}" | make ${BUILD_FLAGS[*]} oldconfig ${_subarch_microarch}" | make ${BUILD_FLAGS[*]} oldconfig
else
yes "${_subarch}" | make ${BUILD_FLAGS[*]} oldconfig
fi
# check that this option is present in the .config
elif [[ $(grep -c "${_subarch}" .config) -eq 1 ]]; then
scripts/config -e "${_subarch}"
make ${BUILD_FLAGS[*]} olddefconfig
else else
yes "${_subarch}" | make ${BUILD_FLAGS[*]} oldconfig warning "Unrecognized subarch value: ${_subarch}"
exit 1
fi fi
else else
# Ask for subarch # Ask for subarch