guysoft / RealtimePi

An out-of-the-box raspebrrypi/raspbian distro with a realtime kernel
GNU General Public License v3.0
164 stars 25 forks source link

Make compile time faster #1

Closed guysoft closed 4 years ago

guysoft commented 7 years ago

Compile time can easily reach up to 12 hours. The way to do this would be to build the kernel in the vm, and only then chroot with qemu. But CustomPiOSs architecture would not allow that.

robiwano commented 6 years ago

But this is compiling on a Raspberry Pi, right ? Hmm... it would be so nice to be able to cross compile :)

guysoft commented 6 years ago

Its compiling using qemu, as stated in the CustomPiOS README. You dont need a raspberrypi. Its still slow because its compiling using emulation, but you can use a stronger virtual machine.

robiwano commented 6 years ago

I see. But is there a reason why the cross-compilation tools aren't used instead ?

guysoft commented 6 years ago

Yes, because cross-compiling means you have to have a separate toolchain. Lets say you want to build this on windows, mac, linux32 bit. linux with different versions of GCC, you will have to support all of that. This way the toolchain is what is on the Raspberrypi. CustomPiOS does much more than just compiling, it ships a distribution.

The cost of a single compile toolchain is that the compilation can take a long time. The gain is:

  1. You can stack the resulting base-image, like I am doing now in ZynthianOS.
  2. Its easy for people using different machines to contribute.
  3. Its deterministic

You could technically build a separate system to compile kernels and maintain it against RealtimePi, and have RealtimePi use the kernels from there. But good luck with that. I have no time for it or support all system configurations.

What I can suggest is have a local environment to compile and test kernels, and use RealtimePi when you want a deterministic compilation environment that you can ship those kernels.

I hope its a good answer to "why?".

robiwano commented 6 years ago

It indeed is. Thanks.

robiwano commented 6 years ago

Ah, damn. For others to know: It is not possible to build on WSL (Win 10), because of the lack of the "loop" module (and probably other issues as well), so I'll be resorting to a VM to do this.

guysoft commented 6 years ago

@robiwano See https://github.com/guysoft/CustomPiOS/issues/22 , I am really close to getting the build running on windows. I in fact got it to build, just need to formalize it.

guysoft commented 5 years ago

Docker build should now let you build on windows. It should also help compile time because its one virtualization less. Still cross-compile via qemu is slower than native tools. But I am not sure if there is a way around it other than supplying a completely separate toolchain.

guysoft commented 4 years ago

Ok, this seems to be solved, or have a workaround. The docker image now supported building on arm32v7. Which is how the nightly builds are built. The compile time went down from ~16 hours to only 2! So I am closing this unless someone wants to talk about amd64 o different arches specifically.