how to reduce compile kernel time

Post Reply
caidezhi
Posts: 10
Joined: Fri Aug 28, 2020 10:35 am
languages_spoken: english
ODROIDs: C4
Has thanked: 1 time
Been thanked: 0
Contact:

how to reduce compile kernel time

Post by caidezhi »

how to reduce the time it takes to compile kernel again, after 'make clean', the time of compile kernel time is too long.

User avatar
tobetter
Posts: 13094
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 996 times
Been thanked: 2275 times
Contact:

Re: how to reduce compile kernel time

Post by tobetter »

caidezhi wrote:
Tue Nov 21, 2023 11:58 am
how to reduce the time it takes to compile kernel again, after 'make clean', the time of compile kernel time is too long.
Maybe CCACHE? https://ccache.dev/
Personally I don't use it.

User avatar
rooted
Posts: 10612
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 821 times
Been thanked: 733 times
Contact:

Re: how to reduce compile kernel time

Post by rooted »

caidezhi wrote:how to reduce the time it takes to compile kernel again, after 'make clean', the time of compile kernel time is too long.
Don't make clean?

The compiler will only compile new/changed code or additional drivers.

User avatar
mctom
Posts: 3992
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 585 times
Been thanked: 783 times
Contact:

Re: how to reduce compile kernel time

Post by mctom »

Also try using distcc to distribute compilation tasks across many computers. However it's hard to set up correctly.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

att2
Posts: 171
Joined: Tue Jan 17, 2017 10:56 pm
languages_spoken: english, german
ODROIDs: Odroid C2, Odroid C4 Also : Bananapi, Orangepi, Raspi3
Location: Graz, Austria, Europe
Has thanked: 33 times
Been thanked: 10 times
Contact:

Re: how to reduce compile kernel time

Post by att2 »

Cross-compile it on a suitably equipped PC, move the file to your Odroid.

fvolk
Posts: 900
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C4, H3, M1S
Has thanked: 0
Been thanked: 142 times
Contact:

Re: how to reduce compile kernel time

Post by fvolk »

I run an aarch64 rootfs in QEMU system emulation on x86.
Once set up, one can just chroot into it and everything is like on the real ARM CPU - but the user land calls to the kernel are translated on the fly to the x86 host kernel - amazing technology!
Compared to a cross-compiling setup I feel it's less headache?

Kernel native build on C4 was ~3h,
same kernel build on a 8-core x86 machine under QEmu system emulation took about ~2h.
It uses massively more CPU power, but is still overall noticeable faster.
(I can't remember which x86 CPU this was, was some time ago.)

crashoverride
Posts: 5864
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 647 times
Contact:

Re: how to reduce compile kernel time

Post by crashoverride »

fvolk wrote:
Thu Jan 11, 2024 7:46 am
I run an aarch64 rootfs in QEMU system emulation on x86.
This was the method I once used. I discovered a much better option! I now use a Mac mini M1 as my "compile farm". I run a native arm64 version of Ubuntu in a virtual machine. The speed is amazing compared to QEMU on x86, and it does not require any complicated cross compiling setups. The 'catch' is only arm64 if supported. The M1 cpus lack armv7 support. This only mattered with OGA/OGS which used some 32bit software.

att2
Posts: 171
Joined: Tue Jan 17, 2017 10:56 pm
languages_spoken: english, german
ODROIDs: Odroid C2, Odroid C4 Also : Bananapi, Orangepi, Raspi3
Location: Graz, Austria, Europe
Has thanked: 33 times
Been thanked: 10 times
Contact:

Re: how to reduce compile kernel time

Post by att2 »

So how fast is the Mac mini m1 for compiling, exactly ?

crashoverride
Posts: 5864
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 647 times
Contact:

Re: how to reduce compile kernel time

Post by crashoverride »

att2 wrote:
Fri Jan 19, 2024 7:09 pm
So how fast is the Mac mini m1 for compiling, exactly ?
Compiling the kernel as of today:

Code: Select all

$ git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidg12-4.9.y
$ cd linux
$ make odroidg12_defconfig
$ time make -j4

[... compile output omitted ..]

real	6m44.225s
user	23m9.509s
sys	3m10.455s
These users thanked the author crashoverride for the post:
odroid (Wed Jan 24, 2024 2:24 pm)

hominoid
Posts: 934
Joined: Tue Feb 28, 2017 3:55 am
languages_spoken: english
ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
Location: Lake Superior Basin, USA
Has thanked: 144 times
Been thanked: 443 times
Contact:

Re: how to reduce compile kernel time

Post by hominoid »

Another datum for those interested:
Volunteers: three S922X (N2L, N2Plus, N2) 6 threads each, Client: RK3588 4 Threads

Code: Select all

$ git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidg12-6.1.y
$ cd linux-odroidg12-6.1.y
$ make odroidn2_defconfig
$ sed -i 's/CONFIG_GCC_PLUGINS=y/CONFIG_GCC_PLUGINS=n/g' .config
$ time make -j22

[... compile output omitted ..]

real	11m47.233s
user	62m42.878s
sys	13m26.354s
Screenshot_2024-02-29_00-51-03.png
Screenshot_2024-02-29_00-51-03.png (99.35 KiB) Viewed 260 times
These users thanked the author hominoid for the post (total 2):
odroid (Thu Feb 29, 2024 4:42 pm) • mctom (Thu Feb 29, 2024 5:55 pm)

mdrjr
Site Admin
Posts: 12101
Joined: Fri Feb 22, 2013 11:34 pm
languages_spoken: english, portuguese
ODROIDs: -
Location: Brazil
Has thanked: 8 times
Been thanked: 153 times
Contact:

Re: how to reduce compile kernel time

Post by mdrjr »

After those years doing this, the only method that is actually faster is distcc to a x86 power hungry monsters.
Just leave the board to pre-process and link.

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 2 guests