The GCC version is a bit problematic.
I'm using rpi-source [ https://github.com/notro/rpi-source/wiki ] to download and prepare the kernel files on Raspberry itself. Rpi-source is good tool that downloads exactly the same kernel source files that the current Raspbian has been built with. However, it warns about the GCC compiler mismatch in the beginning. The default gcc for Raspbian 2015-01-31 is "gcc-4.6 (Debian 4.6.3-14+rpi1) 4.6" and the kernel has been built with "gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03)" as seen from /proc/version. The 4.8 version on Raspbian repo is "gcc-4.8 (Raspbian 4.8.2-21~rpi3rpi1) 4.8.2". Note that it's indeed 4.6.3 by default, 4.8.2 on gcc-4.8 package and 4.8.3 on toolchain.
On the first time running rpi-source, you have to have the default gcc 4.6.3. You have to also specify --skip-gcc so that rpi-source doesn't care about the different gcc in use and what's been used to build the default kernel. If you run rpi-source with 4.8.2 as the default gcc, you'll end up getting message like this during the kernel preparation (make prepare?) phase:
Code: Select all
CC arch/arm/kernel/asm-offsets.s arch/arm/kernel/asm-offsets.c:53:2: error: #error Your compiler is too buggy; it is known to miscompile kernels #error Your compiler is too buggy; it is known to miscompile kernels ^ arch/arm/kernel/asm-offsets.c:54:2: error: #error and result in filesystem corruption and oopses. #error and result in filesystem corruption and oopses. ^
That's why you have to first run rpi-source with the default gcc 4.6.3 with --skip-gcc parameter. After rpi-source gets all done, you have to change to gcc 4.8.2. The kernel doesn't let you compile the kernel itself, but you can compile compatible modules for it. It's bit tricky . It would be great if the default Raspbian gcc would compile compatible modules. Maybe gcc 4.8.3 would not complain about the kernel miscompile problem?
Of course it's not good idea to compile whole new kernels or anything like that on Raspberry device - because it's so slow - but sometimes you need to do some small stuff like compile WLAN driver module