5

Ubuntu 16.04 LTS running kernel 4.10.0-27-generic.

uname -a shows

Linux my-pc 4.10.0-27-generic #30~16.04.2-Ubuntu SMP Thu Jun 29 16:07:46 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

When I download the kernel source

apt-get source linux-image-4.10.0-27-generic

I get the message

Picking 'linux-hwe' as source package instead of 'linux-image-4.10.0-27-generic'

When I check the kernel version of the downloaded source

make kernelversion

The version is reported as

4.10.17

How do I download the actual source for the actual kernel I am currently running ?

When compiling the kernel, how do I specify the target architecture ? (amd64 for me).

hatterman
  • 2,330

2 Answers2

3

You downloaded the source correctly.

make kernelversion will never give you the correct Ubuntu kernel version. It outputs the mainline version.

It may be done by some command, but the easiest way is to look into debian.master/changelog.

A better way is to get sources from git. Run

git clone git://kernel.ubuntu.com/ubuntu/ubuntu-xenial.git
cd ubuntu-xenial
git checkout 6cac304f7f239ac

and you will get your 4.10.0-27 kernel source.

Pilot6
  • 92,041
2
sudo apt-get source linux-image-$(uname -r)
sudo apt-get build-dep linux-image-$(uname -r)

Also - makes sure you enable the source urls in /etc/apt/sources.list