Clone Ubuntu git: just the source ma'am
I got the Trusty source
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-trusty.git
henry@Zotac64:~/work/ubuntu-trusty$ cp /boot/config-3.13.0-37-generic .config
henry@Zotac64:~/work/ubuntu-trusty$ make oldconfig
henry@Zotac64:~/work/ubuntu-trusty$ make
henry@Zotac64:~/work/ubuntu-trusty$ ls -lh vmlinux -rwxrwxr-x 1 henry henry 151M Oct 23 19:18 vmlinux
Since this kernel should be compatible with my running kernel (where I am typing this blog entry) I can use this repository to write kernel modules and play around, WITHOUT changing my working kernel.
The "debian way": not so useful for kernel module development
apt-get source linux-image-$(uname -r)
sudo apt-get build-dep linux-image-$(uname -r)
Undefine CROSS_COMPILE, otherwise the build gets confused:
export CROSS_COMPILE=
The kernel source is at ~/work/ubuntu/linux-3.13.0. First generate the config files (use generic) with these commands:
chmod a+x debian/scripts/* chmod a+x debian/scripts/misc/* fakeroot debian/rules clean fakeroot debian/rules editconfigs
After entering the last command, type 'n' a few times. Build the kernel with this command:
fakeroot debian/rules clean fakeroot debian/rules binary-headers binary-generic
If the build is successful, a set of three .deb binary package files will be produced in the directory above the build root directory, as you can see below:
henry@Zotac64:~/work/ubuntu$ ls linux-3.13.0 linux_3.13.0-37.64.diff.gz linux_3.13.0-37.64.dsc linux_3.13.0.orig.tar.gz linux-cloud-tools-3.13.0-37-generic_3.13.0-37.64_amd64.deb linux-headers-3.13.0-37_3.13.0-37.64_all.deb linux-headers-3.13.0-37-generic_3.13.0-37.64_amd64.deb linux-image-3.13.0-37-generic_3.13.0-37.64_amd64.deb linux-image-extra-3.13.0-37-generic_3.13.0-37.64_amd64.deb linux-tools-3.13.0-37-generic_3.13.0-37.64_amd64.deb