-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathget_kernel_source.sh
More file actions
34 lines (22 loc) · 972 Bytes
/
get_kernel_source.sh
File metadata and controls
34 lines (22 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
REV=`zcat /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz | grep '* firmware as of' | head -n 1 | sed -e 's/\ \*\ firmware as of \(.*\)$/\1/'`
REV=$(echo $REV | sed 's/^ *//g')
rm -rf rasp-tmp
mkdir -p rasp-tmp
mkdir -p rasp-tmp/linux
wget https://raw.github.com/raspberrypi/firmware/$REV/extra/git_hash -O rasp-tmp/git_hash
wget https://raw.github.com/raspberrypi/firmware/$REV/extra/Module.symvers -O rasp-tmp/Module.symvers
SOURCEHASH=`cat rasp-tmp/git_hash`
wget https://github.com/raspberrypi/linux/tarball/$SOURCEHASH -O rasp-tmp/linux.tar.gz
cd rasp-tmp
tar -xzf linux.tar.gz
OSVERSION=`uname -r`
mv raspberrypi-linux* /usr/src/linux-source-$OSVERSION
ln -s /usr/src/linux-source-$OSVERSION /lib/modules/$OSVERSION/build
cp Module.symvers /usr/src/linux-source-$OSVERSION/
zcat /proc/config.gz > /usr/src/linux-source-$OSVERSION/.config
cd /usr/src/linux-source-$OSVERSION/
make oldconfig
make prepare
make scripts
cd ~