diff --git a/PKGBUILD b/PKGBUILD index daa154d..74e2f2d 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -66,9 +66,10 @@ # Set to anything but null to activate. : "${_localmodcfg:=""}" -# Optionally select a sub architecture by number or -# leave blank, which will require user interaction during the build. -# Note that the default option is 41. +# Optionally select a sub architecture by number or its Kconfig name, +# for example MCORE2 or MZEN4. +# Leaving it blank will require user interaction during the build. +# Note that the default option is empty. # # 1. AMD Opteron/Athlon64/Hammer/K8 (MK8) # 2. AMD Opteron/Athlon64/Hammer/K8 with SSE3 (MK8SSE3) @@ -221,7 +222,7 @@ modify_defconfig() { # 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]')" + local _cur_major_ver="$(uname -r | 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" @@ -325,13 +326,29 @@ update_defconfig() { make ${BUILD_FLAGS[*]} olddefconfig diff -u $srcdir/cl-linux/config .config || : - # Set subarch automatically + # Here we slightly break the config by removing one of the + # members of the 'Processor family' selection. + # This causes oldconfig to always invoke that selection. + sed -i '/CONFIG_GENERIC_CPU/d' .config || : + # For a slim chance that someone is building X86_32 + sed -i '/CONFIG_M686/d' .config || : + if [ -n "${_subarch}" ]; then - if [ "${_subarch}" == "41" ]; then - yes "${_subarch} + # check if subarch is a number + if [[ ${_subarch} =~ ^[0-9]+$ ]] && ((_subarch>=1)); then + if [ "${_subarch}" == "41" ]; then + yes "${_subarch} ${_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 - yes "${_subarch}" | make ${BUILD_FLAGS[*]} oldconfig + warning "Unrecognized subarch value: ${_subarch}" + exit 1 fi else # Ask for subarch