8 ms·
"We need plenty of space to build the kernel. Compiling will take around 12 hours, so it is helpful to overclock the Pi for this task." Or, you know, use a cro
by raverbashing 13y ago
"We need plenty of space to build the kernel. Compiling will take around 12 hours, so it is helpful to overclock the Pi for this task."
Or, you know, use a cross-compiler?
- warsheep 13y agoYou probably already know this, but setting up a cross-compiler toolchain is a super annoying task, and is very dependent on the distro you're using. I'm sure the author knows about cross-compiling, but he probably preferred clear instructions that work for any RPi user. There might be even stronger reasons to not use cross-compilers such as weird bugs or compiler version compatibility issues.
- pjc50 13y agoIndeed. Either you give distro-specific instructions (long) or you make people build a gcc cross-compiler from scratch (also long) or you gloss over that bit (prone to failure). Many Pi users' only linux system is the Pi.
- ihnorton 13y ago> cross-compiler from scratch (also long) Building GCC shouldn't take more than a couple hours on a modern machine, and it's a one-time cost for a drastic speedup of every subsequent RPi build. So the aggregate time should still be considerably less than 12 hours.
- joezydeco 13y agoVirtualbox is free. Debian is free. Code Sourcery ARM/GCC Lite is free. I've set up ARM crosscompile environments this way in under an hour. This isn't really a superhard thing to do. [EDIT] Vendors do this too. I went to a workshop on the Freescale i.MX line and guess how everyone got the development system? A VMware image on a thumb drive. You don't have to be a hero when it comes to cross-compiling, just get the work done.
- pjc50 13y agoIt's probably a good thing to do if you're doing a lot of ARM kernel development, but for a oneshot thing? For someone unfamiliar with those tools? It would be interesting to race someone unfamiliar with that toolchain installing it and cross-compiling versus someone just following the instructions.
- joezydeco 13y agoIf it really takes 12 hours to compile the kernel and application on the target, I think no amount of instructions would be slower. And it's a one-shot thing, why make people compile the kernel at all?
- vkjv 13y agoConsidering this really isn't a, "have to have it right now" type feature, it's simply easier to kick off the compile and walk away.
- DanBC 13y agoAt the moment this is the winning result of a competition (first person to run Qiii with the open source drivers at 1080x? At 20 fps) so there are further optimisations to be made. Once the code has been tweaked there'll probably be an image for it somewhere.
- fhars 13y agoStart the compile, eat dinner, go to bed, breakfast, go to school, eat lunch, done. Beats fighthing with a cross compiler toolchain for a one-off job by miles. (Reminds me of a povray benchmark I did some time ago: start the render, go on a holiday trip, wait some more, done: https://groups.google.com/d/msg/de.comp.os.linux.misc/XmdkN1gFzDE/TBFtTIyPTzcJ https://groups.google.com/d/msg/de.comp.os.linux.misc/XmdkN1... )
- trippy_biscuits 13y agoIn the 90s I built a FreeBSD firewall using discarded PC parts. It took 10.5 hours to build world and kernel. There were 2 power outages that forced me to start over each time. I bought my first personal UPS to fix that problem. I would learn how to cross compile instead of waiting 12 hours.
- raverbashing 13y ago"You probably already know this, but setting up a cross-compiler toolchain is a super annoying task" Yes, I agree 100%, building a cross-compiler is a very complicated task. But I think with the weight of the Raspberry Pi projects this should have been easier. This is a good project http://buildroot.uclibc.org http://buildroot.uclibc.org but unfortunately it's very unstable.
- captainmuon 13y agoI wonder why its so hard? I once built a modern gcc + glibc in my home directory on an older linux (to be able to run modern programs), and it was mostly "relocatable" or "portable" (what I mean is that you could copy it around and run it from other directories). Couldn't somebody build a full cross-compiler toolchain as "relocatable" binaries, depending on an older kernel, and then just offer that as a binary download to run on most recent distributions? It's not a typical way to distribute a linux application, but it should work in principle.
- raverbashing 13y agoSome issues: Your GCC build has to match the userspace C library (uclibc or other). If it doesn't you'll need to do all the path passing and usually link manually as well. It has also to match the kernel somewhat (not so critical for userspace apps, but if you want to add a module or something it's critical) So, basically what you "should do" is build the whole system together (cross-compiler + userspace + kernel), some tools do that, building first a "raw" cross-compiler, then the C library and kernel, then a full compiler with all the options applied.
- sarnowski 13y agoI suggest looking at LinuxFromScratch[0], especially II.5. It's hard to do a "real" cross-platform compiler because your target system might not only be a different architecture but also has different libraries on the system with which the compiler has to work. All in all, doing it right and being able to ship binaries is a lot of work and constant maintenance as your target system, in this case Raspbian, also changes their libraries. [0] http://www.linuxfromscratch.org/lfs/view/stable/ http://www.linuxfromscratch.org/lfs/view/stable/
- code4life 13y agoHere is a great explanation of why setting up a cross compiler is so difficult. http://www.airs.com/blog/archives/492 http://www.airs.com/blog/archives/492
- jevinskie 13y agoI use crosstool-ng to do the heavy lifting for me. [0] But lately I've been trying out musl-cross to get nice, self-contained static binaries. [1] [0]: http://crosstool-ng.org/ http://crosstool-ng.org/ [1]: https://bitbucket.org/GregorR/musl-cross https://bitbucket.org/GregorR/musl-cross
- Crito 13y agoCrosstool-ng is nice, but if you have even a mildly out of the ordinary arch/libc/kernel version/etc combination it is still a massive pain in the ass. Typically I'd rather build the kernel on device overnight instead of spend manhours getting crosstool-ng to work as I want so that I can build on beefy hardware. It tends to only be worth it if you are going to be using it more than a few times.
- astrodust 13y agoWouldn't an emulator actually be faster on high-end hardware? Then you can run native tools at much faster than Pi execution speed, right?
- akerl_ 13y agoI'm not familiar with the fine print, but given the nature of the challenge it certainly seems a lot cooler to me that it can be done fully by the Raspberry Pi.
- j-b 13y agoFrom the article: "If you cross-compile you can get better frame times."
- bluedino 13y agoYou've got twelve hours. Today's 4/6/8 core CPU's with an SSD can build a Linux kernel in what, 5 minutes tops? I built one on an old Xeon in something like 4 minutes and it took 3x as long to upload/download the files to the system I wanted to use it on than it did to build it.
- Nanzikambe 13y agoCompiling a vanilla kernel on x86 hardware is one thing, building an ARM kernel is quite another in terms of performance, or at least that's been my experience. To give you an idea of how bad the difference is, to compile the Linux kernel in defconfig, using 2 distcc boxes each with AMD FX8320 3.5ghz (8 core) + 32gb ram + 1gb LAN. The x86 stuff boot off RAID1+0, the the PI obviously off its sdcard, here's what happens: * Compile for armv6 on pi host + distcc compile farm: 19 min 11 sec * Compile for armv6 on qemu host + distcc compile farm: 29 min 36 sec * Compile for armv6 on x86_64 hardware + cross toolchain + distcc compile farm: 1 min 59 sec * Compile for x86_64 defconfig on off-the-shelf x86_64 hardware (also fx8320) + distcc compile farm: 1 min 31 sec That's compiling "linux-3.6.9999-raspberrypi.tar.bz2" with -j20 across the board. I realise there's a number of problems with this "test" - obviously the last two are unfair, the PIs laughable shared bandwidth across network & usb gimp it horribly. I have no idea why qemu is so bad though, I pointed it at an img taken from a running PI vOv and I've probably done a million other things wrong getting the numbers. But to anyone intending to compile armv6 crap on a pi or qemu based compile farm: unless it's a one off thing or your time is worthless, don't do it. Invest the time getting crossdev, crosstool-ng etc + dist cc working properly. I only bothered because I was looking for a better way to build stuff for Android and used the setup as a testbed.
- PlaneSploit 13y agoThey explicitly recommend using a cross-compiler.
- spiritplumber 13y agoMaybe it's because I'm a tub of noob (EE here, I only write code when my hardware demands it) but setting up crosscompiling the Android kernel was physically painful, and it's one of the best-documented things out there.
- mdwrigh2 13y agoCross compiling the Android kernel is fairly straightforward. Download the whole Android source tree, source build/envsetup.sh, lunch the target you want, export ARCH=arm, SUBARCH=arm, CROSS_COMPILE=arm-eabi- and then build away in the kernel repository. Honestly, the easiest cross-compiling I've had to do this side of Go.
- raverbashing 13y agoIt's easy because the cross-compiler is included, and everything has been set up to make it easy
- mdwrigh2 13y agoSure, but most things are easy because someone else has done the heavy lifting. I was just pointing out how easy building the Android kernel is, something he described as "physically painful".
- aray 13y agoJust to separate the problems: Building a cross-compiling toolchain is hard. Totally understand that. Android [0] and Linaro [1] both provide pre-made pre-tested builds you can just pull and use. I recommend using them. Building the kernel itself. As mdwrigh2 pointed out, this is actually pretty easy. Also the kernelnewbies community is here to help! [0] http://s.android.com/source/building-kernels.html http://s.android.com/source/building-kernels.html [1] https://launchpad.net/linaro-toolchain-binaries https://launchpad.net/linaro-toolchain-binaries
- SixSigma 13y ago
- deleted 13y ago[deleted]