notro
Posts: 755
Joined: Tue Oct 16, 2012 6:21 pm
Location: Drammen, Norway

Linux kernel source installer

Fri May 02, 2014 7:01 pm

I have made a script that can install and prepare the kernel source for the running kernel.
This makes it easy to build kernel modules, both in-tree and external.
It works on a fresh Raspian image and on a rpi-update'd image.
Wiki: https://github.com/notro/rpi-source/wiki
Some examples: https://github.com/notro/rpi-source/wik ... us-modules

Code: Select all

$ rpi-source -h
usage: rpi-source [-h] [-d DEST] [--nomake] [--uri URI] [--delete] [-s]
                  [--verbose] [-q] [--skip-gcc] [--skip-space]

Raspberry Pi kernel source installer

optional arguments:
  -h, --help            show this help message and exit
  -d DEST, --dest DEST  Destination directory. Default is $HOME
  --nomake              Don't run 'make modules_prepare'
  --uri URI             Github repository to use. Default is
                        'https://github.com/Hexxeh/rpi-firmware'
  --delete              Delete downloaded archive
  -s, --dry-run         No action; perform a simulation of events that would
                        occur but do not actually change the system.
  --verbose             Verbose
  -q, --quiet           Quiet
  --skip-gcc            Skip gcc version check
  --skip-space          Skip disk space check

For more help see: https://github.com/notro/rpi-source/wiki
Comments are welcome.

domi-flo
Posts: 2
Joined: Mon May 19, 2014 7:12 pm

Re: Linux kernel source installer

Mon May 19, 2014 7:17 pm

Hi,

I tried to use your package "rpi-source" to get the latest kernel.
Installed it with

Code: Select all

sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source
, but when i try to run it, i got the error "rpi-source: command not found".

What i'm doing wrong?

Thanks!

User avatar
patrikg
Posts: 168
Joined: Sun Mar 18, 2012 10:19 pm

Re: Linux kernel source installer

Mon May 19, 2014 9:26 pm

You have to copy the hole line from the wiki:

Code: Select all

sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source && sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update

domi-flo
Posts: 2
Joined: Mon May 19, 2014 7:12 pm

Re: Linux kernel source installer

Tue May 20, 2014 2:57 pm

Thanks!

Now it's working! ;)

plugh
Posts: 47
Joined: Sun Dec 02, 2012 6:58 pm

Re: Linux kernel source installer

Fri Aug 22, 2014 6:53 pm

notro wrote:I have made a script that can install and prepare the kernel source for the running kernel.
...
Comments are welcome.
Since you've got PMs disabled, I'm posting this here:

"Many Thanks!"

The directions on your wiki worked exactly as stated,
and I successfully ran through the 'hello world' example.
On to the hard part...

User avatar
PeterO
Posts: 6095
Joined: Sun Jul 22, 2012 4:14 pm

Re: Linux kernel source installer

Tue Mar 31, 2015 6:18 pm

I've just worked out how to get this working again on a PI2 :-) Once I've discussed the required changes with notro I will update github.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 6095
Joined: Sun Jul 22, 2012 4:14 pm

Re: Linux kernel source installer

Thu Apr 02, 2015 4:29 pm

The changes have now been made and this should be working again on Pi1s and Pi2s

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Alban_T
Posts: 1
Joined: Sun Apr 10, 2016 5:53 pm

Re: Linux kernel source installer

Mon Apr 11, 2016 6:52 pm

Maybe not the correct location!? If so, I'm sorry :)

I tried to install rpi-source follwing the install steps on: https://github.com/notro/rpi-source/wiki
But I never get past this:

Code: Select all

pi@raspberrypi:~ $ sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source && sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update
--2016-04-11 20:43:28--  https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 23.235.43.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|23.235.43.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12471 (12K) [text/plain]
Saving to: ‘/usr/bin/rpi-source’

/usr/bin/rpi-source                                         100%[==========================================================================================================================================>]  12.18K  --.-KB/s   in 0s

2016-04-11 20:43:29 (27.7 MB/s) - ‘/usr/bin/rpi-source’ saved [12471/12471]

pi@raspberrypi:~ $ sudo rpi-source
ERROR:
gcc version check: mismatch between gcc (4.9.2) and /proc/version (4.7.1)
Skip this check with --skip-gcc

Help: https://github.com/notro/rpi-source/wiki
pi@raspberrypi:~ $
I'm running a fresh jessie (2016-03-18-raspbian-jessie.img) on my Raspberry Pi2
I hope someone can explain to me what I'm doing wrong

According to the github page the error means:
"rpi-source complains if the major.minor version of gcc differs from the one used to build the kernel."

Code: Select all

pi@raspberrypi:~ $ cat /proc/version
Linux version 3.18.16-v7 (ubuntu@ubuntu) (gcc version 4.7.1 20120402 (prerelease) (crosstool-NG 1.15.2) ) #4 SMP PREEMPT Thu Sep 10 22:40:21 CST 2015
pi@raspberrypi:~ $ gcc --version | grep gcc
gcc (Raspbian 4.9.2-10) 4.9.2
pi@raspberrypi:~ $
But what I need to do fix it is not very clear to me :(

jimjulian
Posts: 67
Joined: Mon Apr 04, 2016 12:09 am

Re: Linux kernel source installer

Sun Sep 18, 2016 5:48 pm

When you run the program, you get the following message :

ERROR:
gcc version check: mismatch between gcc (4.9.2) and /proc/version (4.7.1)
Skip this check with --skip-gcc

I would suggest adding the mentioned flag to bypass the check and then try.

Hope this helps.

Return to “Advanced users”