Are you sure that kernel requires an
initramfs? I have not seen any that do on the pi, since it is a very specific hardware platform and the kernels are built exclusively for it. The purpose of an initramfs on normal PC distros is to facilitate the use of a wide range of hardware (based on information from the BIOS or other scanning, the kernel can pick which of a number of mutually exclusive drivers to load from inside the initramfs so that can mount the root filesystem). So I would ditch that line.
I can't find those packages in the Raspbian repos, but note that a "kernel headers" package does not include the source, which is what you need.
If cross compiling is an option, I'd recommend you get the 3.18 rpi kernel source directly. Since this is for the ARMv7 pi 2, pre-built cross-compilers are available on all mainstream linux distros, which saves you a major hassle. To create the default configuration, just use
make bcmrpi_defconfig (that's what's used with the Raspbian kernels). You can also compile on the pi, but it will take a long time, as in hours.
If you do build against that source, the module created may or may not work with your current kernel; it likely may not. This will be clear one way or the other when you go to load it, because it will say something about "mismatched" symbols.
If so, you need to use a kernel built from the source you used to build the module (the issue is versioning; you can't use a module built against 3.17.1 with 3.17.2, and sometimes this gets even more finicky). In this case, possibly the kernel was already built when making the module -- the unfortunate part will be that it was not configured properly if you did not run
make bcmrpi_config earlier. Check for a
.config file in the top of the source tree, and if it is there:
mv .config .config-tmp
diff .config .config-tmp
.config didn't exist, or these are substantially different, you need to build the kernel (again). Run
make bcmrpi_defconfig if you have not yet, then:
make -j4 modules_install
These first two will take a long time on the pi. Then:
There should be a new kernel in
boot probably called
vmlinuz although it may have a more elaborate name (
make install will say what it is). You want to use that in
/boot/config.txt as your