11# Hardened Kernel Builder for Raspberry Pi
22
3- [ ![ Docker Image] ( https://github.com/tschaffter/raspberry-pi-kernel-hardened/workflows/Publish%20Docker%20Image/badge.svg )] ( https://hub.docker.com/repository/docker/tschaffter/raspberry-pi-kernel-hardened )
3+ [ ![ GitHub Stars] ( https://img.shields.io/github/stars/tschaffter/raspberry-pi-kernel-hardened.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github )] ( https://github.com/tschaffter/raspberry-pi-kernel-hardened )
4+ [ ![ GitHub Release] ( https://img.shields.io/github/release/tschaffter/raspberry-pi-kernel-hardened.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github )] ( https://github.com/tschaffter/raspberry-pi-kernel-hardened/releases )
5+ [ ![ Docker Stars] ( https://img.shields.io/docker/stars/tschaffter/raspberry-pi-kernel-hardened.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&label=stars&logo=docker )] ( https://hub.docker.com/r/tschaffter/raspberry-pi-kernel-hardened )
6+ [ ![ GitHub CI] ( https://img.shields.io/github/workflow/status/tschaffter/raspberry-pi-kernel-hardened/ci.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github )] ( https://github.com/tschaffter/raspberry-pi-kernel-hardened )
7+ [ ![ GitHub License] ( https://img.shields.io/github/license/tschaffter/raspberry-pi-kernel-hardened.svg?color=94398d&labelColor=555555&logoColor=ffffff&style=for-the-badge&logo=github )] ( https://github.com/tschaffter/raspberry-pi-kernel-hardened )
48
5- ## Overview
6-
7- Cross-compile the [ Linux kernel for Raspberry Pi] ( https://www.raspberrypi.org/documentation/linux/kernel/building.md )
8- with enhanced security using a single command.
9+ Cross-compile the [ Linux kernel for Raspberry Pi] [ raspberrypi_kernel_build ] with
10+ enhanced security support using a single command.
911
1012## Features
1113
12- - Dockerized tool to cross-compile the kernel with a single command
14+ - Dockerized tool to cross-compile an hardened kernel for the Pi with a single command
1315- Hardened kernel features
14- - Enable Audit
15- - Enable SELinux
16+ - Add Audit support
17+ - Add SELinux support
1618
17- ## Builder options
19+ ## Usage
1820
1921Run the folllowing command to see the options of the builder:
2022
@@ -28,11 +30,11 @@ Usage: build-kernel.sh [--kernel-branch <arg>] [--kernel-defconfig <arg>] [--ker
2830 -h, --help: Prints help
2931```
3032
31- ## Build the hardered kernel
33+ ## Build the hardened kernel
3234
3335### Identify the kernel version to build
3436
35- Go to the GitHub repository of the [ Linux kernel of Raspberry Pi] ( https://github.com/raspberrypi/ linux)
37+ Go to the GitHub repository of the [ Linux kernel of Raspberry Pi] [ gh_raspberrypi/ linux]
3638and identify the name of the branch or tag that you want to build.
3739
3840Examples:
@@ -42,9 +44,8 @@ Examples:
4244
4345### Identify the default configuration to use
4446
45- Go to the page [ Kernel building] ( https://www.raspberrypi.org/documentation/linux/kernel/building.md )
46- of the Raspberry Pi website to identify the default build configuration to use
47- for the target Pi.
47+ Go to the page [ Kernel building] [ raspberrypi_kernel_build ] of the Raspberry Pi
48+ website to identify the default build configuration to use for the target Pi.
4849
4950Examples:
5051
@@ -77,7 +78,7 @@ $ docker run \
7778 tschaffter/raspberry-pi-kernel-hardened \
7879 --kernel-branch rpi-5.4.y \
7980 --kernel-defconfig bcm2711_defconfig \
80- --kernel-localversion 5.4.y-20200804 -hardened
81+ --kernel-localversion 5.4.y-$(date '+%Y%m%d') -hardened
8182Cloning into '/home/builder/tools'...
8283Installing cross compiler toolchain
8384Checking out files: 100% (19059/19059), done.
@@ -95,7 +96,7 @@ sudo reboot
9596
9697ENABLE SELinux
9798sudo apt-get install selinux-basics selinux-policy-default auditd
98- sudo sh -c "echo ' selinux=1 security=selinux' >> /boot/cmdline.txt"
99+ sudo sh -c "sed -i '$ s/$/ selinux=1 security=selinux/' /boot/cmdline.txt"
99100sudo touch /.autorelabel
100101sudo reboot
101102sestatus
@@ -110,8 +111,7 @@ command.
110111## Customize your build
111112
112113- The builder uses all the CPU cores available to the Docker container. By default,
113- that is all the CPU cores of the host. Use
114- [ Docker runtime options] ( https://docs.docker.com/config/containers/resource_constraints/#cpu )
114+ that is all the CPU cores of the host. Use [ Docker runtime options] [ docker_runtime_options ]
115115to limit the usage of CPU cores by the builder.
116116
117117- The builder clones two GitHub repositories, the cross-compiler toolchain and
@@ -131,10 +131,16 @@ $ docker run \
131131 tschaffter/raspberry-pi-kernel-hardened \
132132 --kernel-branch rpi-5.4.y \
133133 --kernel-defconfig bcm2711_defconfig \
134- --kernel-localversion 5.4.y-20200804 -hardened
134+ --kernel-localversion 5.4.y-$(date '+%Y%m%d') -hardened
135135```
136136
137137## Contributing change
138138
139139Please read the [ ` CONTRIBUTING.md ` ] ( CONTRIBUTING.md ) for details on how to
140140contribute to this project.
141+
142+ <!-- Definitions -->
143+
144+ [ raspberrypi_kernel_build ] : https://www.raspberrypi.org/documentation/linux/kernel/building.md
145+ [ gh_raspberrypi/linux ] : https://github.com/raspberrypi/linux
146+ [ docker_runtime_options ] : https://docs.docker.com/config/containers/resource_constraints/#cpu
0 commit comments