3

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).

  • Might have figured this out. Do I simply download the latest linux-hwe source and answer "no" to all new features at configure time ? Does that acheive the same result ? – hatterman Jul 25 '17 at 10:39
  • The target architecture will by default the same as it is already in your system. – Pilot6 Jul 26 '17 at 12:11
1
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

1

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.

  • The latest entry in that change log is for 4.10.0-26.30. I am running 4.10.0-27-generic. Does that sound right ? – hatterman Jul 26 '17 at 12:07
  • It looks almost right. I think that if you download the source again, it will be 4.10.0-27. – Pilot6 Jul 26 '17 at 12:08
  • Just did an apt-get update then performed the download again. Same version is shown in the change log. – hatterman Jul 26 '17 at 12:10
  • This looks wierd. Where did you get the 4.10.0-27? Maybe proposed repo is enabled... The current hwe kernel is 4.10.0-26. – Pilot6 Jul 26 '17 at 12:13
  • Also try sudo apt install linux-source-4.10.0. That has 4.10.0-27 version. You can also clone the source from git and checkout whatever version you like. – Pilot6 Jul 26 '17 at 12:14

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.