Skip to content

Commit 70e335d

Browse files
committed
Export kernel source
1 parent 9eddcb9 commit 70e335d

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ to include today's date to the value of `--kernel-localversion`. The value of
8989
sudo reboot
9090
sestatus
9191

92-
After installing the above kernel, its name will be:
92+
After installing the above kernel, its version will be:
9393

94-
$ uname -a
95-
Linux raspberrypi 5.4.51-20200804-hardened+ #1 SMP Sun Jun 14 15:06:51 UTC 2020 armv7l GNU/Linux
94+
$ uname -r
95+
5.4.51-20200804-hardened+
9696

9797
**Note:** The builder inside the docker container runs as a non-root user. The command
9898
`mkdir output` included in the above command ensures that the builder will be able
@@ -104,6 +104,25 @@ Copy the Debian packages `*.deb` generated to the target Raspbery Pi, for exampl
104104
using `scp`. Then follow the instructions given at the end of the command used to
105105
build the kernel (see above).
106106

107+
- `linux-headers`: The kernel headers, required when compiling any code that
108+
interfaces with the kernel.
109+
- `linux-image`: The kernel image and the associated modules.
110+
- `linux-libc-dev`: Linux support headers for userspace development.
111+
112+
### Install the kernel source
113+
114+
You can also install the kernel source in case you need it to compile a module
115+
for the kernel in the future (e.g. for )
116+
117+
1. Copy the archive `linux-source-<version>.tar.xz` to the Pi.
118+
2. Extract the archive in `/usr/src/`.
119+
120+
tar -xf linux-source-<version>.tar.xz
121+
122+
3. Create the symbolic link `/usr/src/linux` to the folder extracted.
123+
124+
ln -s /usr/src/linux /usr/src/linux-source-<version>.tar.xz
125+
107126
## Update the kernel
108127

109128
Repeat the same protocol as given above to build and install a newer version of

build-kernel.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ ls -al
224224
echo "Moving .deb packages to $_output_dir"
225225
mv $_workdir/*.deb /output
226226

227+
echo "Compressing linux source to $_output_dir"
228+
mv linux linux-source-${_kernel_version}-${_arg_kernel_localversion}+
229+
tar cJf \
230+
$_output_dir/linux-source-${_kernel_version}-${_arg_kernel_localversion}+.tar.xz \
231+
linux-source-${_kernel_version}-${_arg_kernel_localversion}+
232+
227233

228234
echo "SUCCESS The kernel has been successfully packaged."
229235
echo ""

0 commit comments

Comments
 (0)