dogmarcopolo
Posts: 6
Joined: Fri Apr 17, 2015 5:53 pm

How to download kernel source for a particular build?

Thu Apr 23, 2015 5:50 pm

I need to compile a module for raspberry Pi 2. downloaded the latest kernel from:

https://github.com/raspberrypi/linux

compiled ok, but can't load the module with modprobe due to vermagic dismatch. (modprobe -f didn't work either). my kernel is 3.18.7-v7+ and the latest source is already 3.18.11... something.

i'm not that familiar with github (i just downloaded the zip file) but there is no option to select that particular build. do i have to clone and checkout? or some other procedure? I'm trying to get it as simple as possible. i just need the kernel header files to compile the device driver module.

any pointer is deeply appreciated.


dogmarcopolo
Posts: 6
Joined: Fri Apr 17, 2015 5:53 pm

Re: How to download kernel source for a particular build?

Thu Apr 23, 2015 7:38 pm

Sorry. after reading that thread, I still have no idea how to pull kernel source for build 3.18.7-v7+, don't know how to associate commit with the build number.

ktb
Posts: 1447
Joined: Fri Dec 26, 2014 7:53 pm

Re: How to download kernel source for a particular build?

Thu Apr 23, 2015 8:22 pm

If you have already cloned the source from GitHub, then you can use the command I posted in that thread which I directly linked for you.

If you have not cloned the source from GitHub, then you can do something like this (this example is from a full kernel build on the Pi2B):
~ $ mkdir software/build && cd software/build
~/software/build/ $ git clone git://github.com/raspberrypi/linux.git
~/software/build/ $ cd linux
~/software/build/linux/ $ git checkout 22364b2b98c2cf09d2628ec5770a7850bfe50ba2

~/software/build/linux $ make mrproper
~/software/build/linux $ zcat /proc/config.gz > .config
~/software/build/linux $ make oldconfig
~/software/build/linux $ make menuconfig
~/software/build/linux $ make -j4 > make.log 2>&1
~/software/build/linux $ make modules > make-modules.log 2>&1
~/software/build/linux $ sudo make modules_install > sudo-make-modules_install.log 2>&1

Return to “General discussion”