Huh?
There are over 20 different architectures, with a 46 minute time, that would equal to about 2 minutes per arch, a bit fast for that poor small ARM…
Or did I understand you wrong?
AFAIK defconfig builds according to the defconfig config of the host arch. Arm64 defconfig is in arch/arm64/configs/defconfig.
real 6m16,480s
user 39m48,323s
sys 4m7,967s
AMD Ryzen 3500u
8GB DDR4
AMD Vega8 graphics
5.8.10 on Intel i5-7200U:
gcc:
9m18.35s
clang-11:
10m58.59s
Clear example that thread count isn’t everything.
Just ran the same thing on my new system with half the threads of my old T5500
AMD Ryzen 5 3600
16GB DDR4
That same GTX1650
real 2m4,007s
user 20m29,585s
sys 2m7,122s
[mathias@mathias-b550mds3h linux-5.8.3]$
.makepkg.conf
➜ ~ cat .makepkg.conf
#
# /etc/makepkg.conf
#
#########################################################################
# SOURCE ACQUISITION
#########################################################################
#
#-- The download utilities that makepkg should use to acquire sources
# Format: 'protocol::agent'
DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u'
'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'rsync::/usr/bin/rsync --no-motd -z %u %o'
'scp::/usr/bin/scp -C %u %o')
# Other common tools:
# /usr/bin/snarf
# /usr/bin/lftpget -c
# /usr/bin/wget
#-- The package required by makepkg to download VCS sources
# Format: 'protocol::package'
VCSCLIENTS=('bzr::bzr'
'git::git'
'hg::mercurial'
'svn::subversion')
#########################################################################
# ARCHITECTURE, COMPILE FLAGS
#########################################################################
#
CARCH="x86_64"
CHOST="x86_64-pc-linux-gnu"
#-- Compiler and Linker Flags
# -march (or -mcpu) builds exclusively for an architecture
# -mtune optimizes for an architecture, but builds for whole processor family
CPPFLAGS="-D_FORTIFY_SOURCE=2"
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
#-- Make Flags: change this for DistCC/SMP systems
MAKEFLAGS="-j6"
#-- Debugging flags
DEBUG_CFLAGS="-g -fvar-tracking-assignments"
DEBUG_CXXFLAGS="-g -fvar-tracking-assignments"
#########################################################################
# BUILD ENVIRONMENT
#########################################################################
#
# Defaults: BUILDENV=(!distcc color !ccache check !sign)
# A negated environment option will do the opposite of the comments below.
#
#-- distcc: Use the Distributed C/C++/ObjC compiler
#-- color: Colorize output messages
#-- ccache: Use ccache to cache compilation
#-- check: Run the check() function if present in the PKGBUILD
#-- sign: Generate PGP signature file
#
BUILDENV=(!distcc color !ccache check !sign)
#
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
#-- specify a space-delimited list of hosts running in the DistCC cluster.
#DISTCC_HOSTS=""
#
#-- Specify a directory for package building.
#BUILDDIR=/tmp/makepkg
#########################################################################
# GLOBAL PACKAGE OPTIONS
# These are default values for the options=() settings
#########################################################################
#
# Default: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug)
# A negated option will do the opposite of the comments below.
#
#-- strip: Strip symbols from binaries/libraries
#-- docs: Save doc directories specified by DOC_DIRS
#-- libtool: Leave libtool (.la) files in packages
#-- staticlibs: Leave static library (.a) files in packages
#-- emptydirs: Leave empty directories in packages
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
#-- purge: Remove files specified by PURGE_TARGETS
#-- debug: Add debugging flags as specified in DEBUG_* variables
#
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug)
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
INTEGRITY_CHECK=(md5)
#-- Options to be used when stripping binaries. See `man strip' for details.
STRIP_BINARIES="--strip-all"
#-- Options to be used when stripping shared libraries. See `man strip' for details.
STRIP_SHARED="--strip-unneeded"
#-- Options to be used when stripping static libraries. See `man strip' for details.
STRIP_STATIC="--strip-debug"
#-- Manual (man and info) directories to compress (if zipman is specified)
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
#-- Doc directories to remove (if !docs is specified)
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
#-- Files to be removed from all packages (if purge is specified)
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
#-- Directory to store source code in for debug packages
DBGSRCDIR="/usr/src/debug"
#########################################################################
# PACKAGE OUTPUT
#########################################################################
#
# Default: put built package and cached source in build directory
#
#-- Destination: specify a fixed directory where all packages will be placed
#PKGDEST=/home/packages
#-- Source cache: specify a fixed directory where source files will be cached
#SRCDEST=/home/sources
#-- Source packages: specify a fixed directory where all src packages will be placed
#SRCPKGDEST=/home/srcpackages
#-- Log files: specify a fixed directory where all log files will be placed
#LOGDEST=/home/makepkglogs
#-- Packager: name/email of the person or organization building packages
PACKAGER="fhdk <fh@manjaro.org>"
#-- Specify a key to use for package signing
GPGKEY="17C752B61B2F2E90"
#########################################################################
# COMPRESSION DEFAULTS
#########################################################################
#
COMPRESSGZ=(gzip -c -f -n)
COMPRESSBZ2=(bzip2 -c -f)
COMPRESSXZ=(xz -c -z -)
COMPRESSZST=(zstd -c -z -q -)
COMPRESSLRZ=(lrzip -q)
COMPRESSLZO=(lzop -q)
COMPRESSZ=(compress -c -f)
COMPRESSLZ4=(lz4 -q)
COMPRESSLZ=(lzip -c -f)
#########################################################################
# EXTENSION DEFAULTS
#########################################################################
#
# WARNING: Do NOT modify these variables unless you know what you are
# doing.
#
PKGEXT='.pkg.tar.zst'
SRCEXT='.src.tar.gz'
system
$ inxi -CmG
Memory: RAM: total: 62.50 GiB used: 1.48 GiB (2.4%)
RAM Report: permissions: Unable to run dmidecode. Root privileges required.
CPU: Topology: 8-Core model: Intel Core i9-9900K bits: 64 type: MT MCP L2 cache: 16.0 MiB
Speed: 801 MHz min/max: 800/5000 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800
5: 800 6: 800 7: 800 8: 800 9: 800 10: 800 11: 800 12: 800 13: 800 14: 800 15: 800
16: 800
Graphics: Device-1: Intel UHD Graphics 630 driver: i915 v: kernel
Device-2: NVIDIA GP106GL [Quadro P2000] driver: nvidia v: 450.66
Display: server: X.Org 1.20.9 driver: nvidia resolution: 1: 1920x1080~60Hz
2: 1920x1080~60Hz
Message: Unable to show advanced data. Required tool glxinfo missing.
commands
$ wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.8.3.tar.xz
$ tar -axf linux-5.8.3.tar.xz
$ cd linux-5.8.3
$ make mrproper
$ make defconfig
$ time make -j$(nproc)
time elapsed
make -j$(nproc) 1466,54s user 136,68s system 1464% cpu 1:49,45 total
with option -O2 flags ?
ok 24mn time elapsed
I don’t know - just did as everyone else did
My .makepkg.conf has -O2 flags - so I suppose
Tell that to my bedsheets.
![]()
The settings in makepkg.conf are irrelevant for this test.
It’s only being used when running makepkg / AUR helpers.
You can however source the file:
$ echo $CFLAGS
$ source /etc/makepkg.conf
[...]
$ echo $CFLAGS
-march=znver2 -O2 -pipe -fstack-protector-strong -fno-plt
I see - I am not that knowledgeable on compiler flags and make files to know - I was just curios. It makes sense though - when you mention it - that makepkg.conf is for making packages
- I feel enlightened. 
To see if the flag is in use when compiling the kernel - ran a grep inside the source folder
grep -r "O2" ./
The -O2 flag is found in a lot of files - and by searching I found https://stackoverflow.com/questions/887509/when-to-use-o2-flag-for-gcc which gave a brief explanation that satisfied my curiosity.
I’m quite sure the default for x86_64 is -O2 anyway.
Remember that not every source file in the kernel tree is compiled with the same flags.
If unsure, just pass CFLAGS to the make command or export them, e.g. export CFLAGS="-O2 -march=native".
To automate all this, I created a simple bash script:
#!/bin/bash
# Usage: buildkernel.sh /path/to/builddir
[[ -z $1 ]] && echo "Please specify a path, aborting!" && exit 4
export LANG=C
export CFLAGS="-O2 -pipe -march=native"
BUILDDIR=$1
NCORES=`nproc`
KERNVER="5.8.11"
KERNURL="https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-$KERNVER.tar.xz"
CPUGOV=`cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor`
SYSINFO=$(inxi -c0 -v | sed "s/Up:.*//;s/inxi:.*//;s/Storage:.*//")
DATE=`date +%F-%H%M`
if [[ ! -d $BUILDDIR ]] ; then
mkdir $BUILDDIR
fi
if [[ -f /usr/bin/time ]] ; then
TIMER="/usr/bin/time -f%E -o $BUILDDIR/result-$DATE"
else
echo "Please install the 'time' package and try again!" ; exit 4
fi
if [[ $CPUGOV != "performance" ]] ; then
read -p "You should use the 'performance' cpufreq governor, enable now? (y/N)" DCHOICE
[[ $DCHOICE = "y" || $DCHOICE = "Y" ]] && su -c "cpupower frequency-set -g performance"
fi
cd $BUILDDIR
[[ ! -f linux-$KERNVER.tar.xz ]] && wget -q --show-progress $KERNURL
[[ ! -d linux-$KERNVER ]] && tar xf linux-$KERNVER.tar.xz &>/dev/null
cd linux-$KERNVER
echo "Cleaning up..." ; make -s mrproper
echo "Running defconfig..." ; make -s defconfig
echo "Start!"
$TIMER make -sj$NCORES bzImage &>/dev/null
printf "Total time: %s\n" "$(<$BUILDDIR/result-$DATE)"
echo $SYSINFO >> $BUILDDIR/result-$DATE
exit 0
$ cat result-2020-09-25-1731
1:43.53
CPU: 8-Core Intel Core i9-9900K (-MT MCP-) speed/min/max: 3647/800/5000 MHz Kernel: 5.8.10-zen1-1-zen x86_64
$ cat result-2020-09-25-1740
1:43.42
CPU: 8-Core Intel Core i9-9900K (-MT MCP-) speed/min/max: 5002/800/5000 MHz Kernel: 5.8.10-zen1-1-zen x86_64
1:00.96
CPU: 12-Core AMD Ryzen 9 3900X (-MT MCP-) speed/min/max: 2196/2200/3800 MHz Kernel: 5.8.11-vd-1 x86_64 Mem: 1916.6/32087.8 MiB (6.0%)
Woof. Nearly broke the one minute mark 
I’m not really sure, but I think you can get a few seconds off.
Maybe by running it in runlevel 3 (systemctl isolate multi-user.target)?
You could also try running the script like this: schedtool -B -e nameofscript.sh /path, but I’m not sure how scheduling policies work on -zen kernel.
(you might have to install schedtool first)
Room temperature could also make a big difference, at least in my case. Compare my previous results, since then room temperature has dropped by 3°C.
Nah - I am not going to compile kernels on a regular base - so the current setup works for me 
How did you do that? I’d like to try that on my Ryzen 7 3800X
This is absolutely true. Ryzen cpu’s (and vega gpu’s for that matter) set their max boost clock based on the temp they see at boot. The lower that is the closer to max they will boost.
Except for my custom kernel, no special tricks were involved.
(run in an xfce-terminal, cold boot)
If you’re using -zen kernel, try the ondemand or performance scheduler if not yet set.
Are you talking about your script?