Bakul Shah
Posts: 321
Joined: Sun Sep 25, 2011 1:25 am

Time to compile the kernel

Sat Feb 09, 2013 12:33 am

Just curious. How long does it take to compile the RPi linux kernel on an RPi? And to cross compile on a fast Intel/amd 64bit processor? And can you cross-compile a kernel for another platform on the RPi?

For comparison, here are some plan9 numbers:

Code: Select all

rpi; pwd
/sys/src/nix/k10

#time to cross compile amd64 plan9 kernel on the RPi
rpi; time mk 'CONF=term'>/dev/null
39.79u 17.72s 77.77r 	 mk CONF=term

#time to native compile amd64 kernel on Xeon
minooka²; time mk 'CONF=term'>/dev/null
0.03u 0.32s 3.83r 	 mk CONF=term
minooka²; aux/cpuid -i
      Intel(R) Xeon(R) CPU E5-2640 0 @ 2.50GHz

; cd /sys/src/9/bcm

#time to native compile the RPi kernel on the RPi
; time mk 'CONF=pi'>/dev/null
ar: creating ../boot/libboot.a5
34.22u 16.70s 75.64r 	 mk CONF=pi

#time to cross compile the RPi kernel on Xeon
minooka²; time mk 'CONF=pi'>/dev/null
0.03u 0.25s 3.72r 	 mk CONF=pi
So basically under 80 seconds to compile on RPi, under 4 seconds to compile on a 2.5Ghz Xeon, for an RPi kernel or an Amd64 kernel. Thanks to Erik Quanstrom for the timing numbers.

aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Re: Time to compile the kernel

Sat Feb 09, 2013 3:43 pm

cross compiling on amd64 takes less then a minute, on the pi i think it takes quite a bit longer

Bakul Shah
Posts: 321
Joined: Sun Sep 25, 2011 1:25 am

Re: Time to compile the kernel

Wed Feb 13, 2013 6:09 pm

Thanks. Compiling the default raspian kernel on the RPi takes over 10 hours.

subash_patel
Posts: 4
Joined: Fri Sep 07, 2012 4:45 am
Location: Bangalore, India

Re: Time to compile the kernel

Thu Feb 14, 2013 12:02 am

What is the significance of this question? Are you trying to optimize compiler for rpi native building?
Try building the kernel for rpi on another powerful ARM board like panda.

anto
Posts: 26
Joined: Tue Jan 01, 2013 5:20 pm
Location: Vienna, Austria

Re: Time to compile the kernel

Sun Mar 10, 2013 9:56 pm

I have been natively compiling kernel in the last 3 days. I only compile all driver that I need and disable the rest. It usually takes about 4 hours or less if I got errors :D.

On my old Debian PC with Pentium D, it takes about an hour to cross-compile a kernel.

d73909
Posts: 8
Joined: Sun Mar 24, 2013 5:18 pm

Re: Time to compile the kernel

Wed Mar 27, 2013 8:00 pm

Since you've been cross-compiling kernels, I would like to ask my question here.
I've been trying to understand and learn linux (and kernel compiling).

When compiling for an ARM processor, why would certain kernel compiling options need to be given during compiling when you are already cross-compiling it for ARM?

(these options where given to me in another thread and I was also be able to find certain references via google)

Code: Select all

-march=armv6
-mfpu=vfp
-mfloat-abi=hard

aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Re: Time to compile the kernel

Wed Mar 27, 2013 9:54 pm

d73909 wrote:Since you've been cross-compiling kernels, I would like to ask my question here.
I've been trying to understand and learn linux (and kernel compiling).

When compiling for an ARM processor, why would certain kernel compiling options need to be given during compiling when you are already cross-compiling it for ARM?

(these options where given to me in another thread and I was also be able to find certain references via google)

Code: Select all

-march=armv6
-mfpu=vfp
-mfloat-abi=hard
Not needed for kernel,
http://elinux.org/RPi_Kernel_Compilation

d73909
Posts: 8
Joined: Sun Mar 24, 2013 5:18 pm

Re: Time to compile the kernel

Thu Mar 28, 2013 6:43 am

I looked at it, but it doesn't really answer my question. Since I'm trying to learn instead of creating something, I think it's better not to brainlessly do what it say's rather then understand.

On this website you linked me, it also say's I have to compile with options:

Code: Select all

ARCH=arm
And then it goes on saying:

Code: Select all

If you are building on the RPi, remove ARCH=arm CROSS_COMPILE=${CCPREFIX} from each command.
Why is this needed (or not needed)? I know what cross-compiling accomplishes, but why the option? To make the build more efficient with ARM? Then why can I leave it out when I'm compiling on the Pi itself?

aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Re: Time to compile the kernel

Thu Mar 28, 2013 11:36 am

d73909 wrote:
I looked at it, but it doesn't really answer my question. Since I'm trying to learn instead of creating something, I think it's better not to brainlessly do what it say's rather then understand.

On this website you linked me, it also say's I have to compile with options:

Code: Select all

ARCH=arm
And then it goes on saying:

Code: Select all

If you are building on the RPi, remove ARCH=arm CROSS_COMPILE=${CCPREFIX} from each command.
Why is this needed (or not needed)? I know what cross-compiling accomplishes, but why the option? To make the build more efficient with ARM? Then why can I leave it out when I'm compiling on the Pi itself?
The kernel does not have anything that can be accelerated on hardware, therefore the hardware floating point is void for the package
ARCH=arm is telling it to build the kernel with the arm modules etc, and CROSS_COMPILE points to the rpi toolchain (or any armv6 toolchain) that will be used to compile

if you are compiling on the rpi (which is extremely slow for this) you dont need those as they are the default params which can be aquired from the enviroment

d73909
Posts: 8
Joined: Sun Mar 24, 2013 5:18 pm

Re: Time to compile the kernel

Thu Mar 28, 2013 2:14 pm

Ok, I think I'm starting to get it.
The kernel does not have anything that can be accelerated on hardware, therefore the hardware floating point is void for the package
ARCH=arm is telling it to build the kernel with the arm modules etc, and CROSS_COMPILE points to the rpi toolchain (or any armv6 toolchain) that will be used to compile
If I was building a kernel, and left out the ARCH=arm option, would I still be able to select the neccesary modules via the "make xconfig" menu's ?

User avatar
RaTTuS
Posts: 10485
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Time to compile the kernel

Thu Mar 28, 2013 3:22 pm

it takes 4-5 hrs to build the kernel on 3 of RPi's [using distcc]
it takes 5 mins to do it on a dual core 4Gb 2.4Ghz intel machine
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Re: Time to compile the kernel

Thu Mar 28, 2013 3:38 pm

d73909 wrote:Ok, I think I'm starting to get it.
The kernel does not have anything that can be accelerated on hardware, therefore the hardware floating point is void for the package
ARCH=arm is telling it to build the kernel with the arm modules etc, and CROSS_COMPILE points to the rpi toolchain (or any armv6 toolchain) that will be used to compile
If I was building a kernel, and left out the ARCH=arm option, would I still be able to select the neccesary modules via the "make xconfig" menu's ?
make ARCH=arm CROSS_COMPILE=/rpitoolchain/blabla menuconfig

d73909
Posts: 8
Joined: Sun Mar 24, 2013 5:18 pm

Re: Time to compile the kernel

Thu Mar 28, 2013 6:06 pm

make ARCH=arm CROSS_COMPILE=/rpitoolchain/blabla menuconfig
I should have asked my question differently.
What I meant was, is the option ARCH=arm a shortcut for a pre-selected menuconfig? Technically, what does the ARCH option (or any other option for that matter) change in kernel compiling.

aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Re: Time to compile the kernel

Thu Mar 28, 2013 6:31 pm

d73909 wrote:
make ARCH=arm CROSS_COMPILE=/rpitoolchain/blabla menuconfig
I should have asked my question differently.
What I meant was, is the option ARCH=arm a shortcut for a pre-selected menuconfig? Technically, what does the ARCH option (or any other option for that matter) change in kernel compiling.
it means what machine cpu it should target, x86 would be for most desktop pcs
there are other types too
the cpu in the pi is arm based

d73909
Posts: 8
Joined: Sun Mar 24, 2013 5:18 pm

Re: Time to compile the kernel

Thu Mar 28, 2013 8:22 pm

Then again.

If so, why did it say
If you are building on the RPi, remove ARCH=arm CROSS_COMPILE=${CCPREFIX} from each command.
on that website?

If you are correct. One should never leave out ARCH=arm when compiling for ARM processor.

aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Re: Time to compile the kernel

Thu Mar 28, 2013 8:49 pm

d73909 wrote:Then again.

If so, why did it say
If you are building on the RPi, remove ARCH=arm CROSS_COMPILE=${CCPREFIX} from each command.
on that website?

If you are correct. One should never leave out ARCH=arm when compiling for ARM processor.
because on the rpi ARCH=arm is already defined as a enviromental variable, while cross compiling on a home desktop (x86, x86_64) the arch would defaultly be x86 or x86_64 unless set to ARM

remsnet
Posts: 151
Joined: Wed Dec 19, 2012 7:32 pm
Location: Planet Gaia
Contact: Website Yahoo Messenger

Re: Time to compile the kernel

Tue Apr 16, 2013 10:44 am

Bakul Shah wrote:Just curious. How long does it take to compile the RPi linux kernel on an RPi?
...
.
Preparaion for my OpenSuSE 3.8.x kernel .config took 1 Month due some modules and Option issuies.

Final Compile 22-28 Houers of 3.8.6 kernel in background ( nohup make .. ) on a Model B PI

regards

Return to “Linux Kernel”