Skip to content
Snippets Groups Projects
Commit 3c1f588f authored by Johannes Mey's avatar Johannes Mey
Browse files

Merge branch 'ci'

parents 5ff7e559 69668bd0
No related branches found
No related tags found
No related merge requests found
Pipeline #6592 passed
*.deb filter=lfs diff=lfs merge=lfs -text
stages:
- build
build-kernel:
image: ubuntu:bionic
stage: build
artifacts:
paths:
- "*.deb"
script:
- apt-get update
- apt-get install -y build-essential curl bison flex bc rsync kmod cpio lsb-release libssl-dev
- ./compile.bash
tags:
- highmem
# Realtime Kernel for Ubuntu 18.4 # Realtime Kernel for Ubuntu 18.4
⚠ this repository uses git-lfs. when cloning, make sure LFS is installed locally. These are `deb` packages built for Ubuntu Bionic. The packages are created following advice from [Stackoverflow](https://stackoverflow.com/questions/51669724/install-rt-linux-patch-for-ubuntu) and the [Panda manuals](https://frankaemika.github.io/docs/installation_linux.html#setting-up-the-real-time-kernel).
These are deb packages built for Ubuntu Bionic. ## Information
Used Kernel sources: The kernel is built automatically by the CI from the [linux kernel sources](https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/) version 5.4, using the latest kernel version for which a [real time patch](https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/5.4/) is available. For more information on how the kernel is built, please review the `compile.bash` script.
- kernel `linux-5.4.19-rt11_5.4.19-rt11.orig.tar.gz`
- realtime patch `linux-5.4.19-rt11_5.4.19-rt11-1.diff.gz`
Kernel config: It's `config` file is based on the config provided by a Unbuntu Bionic installation with two changes:
- Preemption Model: Fully Preemptible Kernel (RT) - The `preemption model` ist set to `Fully Preemptible Kernel (RT)`.
- `Compile the kernel with debug info (DEBUG_INFO)` is set to `no`.
Before the build, if the new kernel version contains new config keys, the corresponding values are set to their defaults.
## Installation ## Installation
- ⚠ make sure secureboot is disabled. - **⚠ ATTENTION** Make sure secureboot is disabled. Currently, the compiled kernel is unsigned and thus, will not work with secureboot.
- simply install the packages using `dpkg -i` - **⚠ ATTENTION** The repository does not contain the kernel packges, they are built by the CI and and can be downloaded.
- [Download the latest kernel packages built by the CI](https://git-st.inf.tu-dresden.de/ceti/realtime-kernel/-/jobs/artifacts/master/browse?job=build-kernel).
- Install the packages using `dpkg -i`.
## Verifying that the Realtime Kernel is Running ## Verifying that the Realtime Kernel is Running
- reboot after kernel installation, selecting the new kernel in Grub - Reboot after kernel installation, selecting the new kernel in the boot loader.
- run `uname -a`, the result should contains `PREEMPT RT` - Run `uname -a`, the result should contain the kernel version number from the installed `deb` package as well as `PREEMPT RT`.
## Set User Permissions ## Set User Permissions
- add a group named realtime and add the user controlling your robot to this group: - Add a group named realtime and add the user controlling your robot to this group:
``` ```
sudo addgroup realtime sudo addgroup realtime
sudo usermod -a -G realtime $(whoami) sudo usermod -a -G realtime $(whoami)
``` ```
- add the following limits to the realtime group in /etc/security/limits.conf: - Add the following limits to the realtime group in /etc/security/limits.conf:
``` ```
@realtime soft rtprio 99 @realtime soft rtprio 99
@realtime soft priority 99 @realtime soft priority 99
...@@ -37,4 +40,5 @@ Kernel config: ...@@ -37,4 +40,5 @@ Kernel config:
@realtime hard priority 99 @realtime hard priority 99
@realtime hard memlock 102400 @realtime hard memlock 102400
``` ```
- log out and in again (or restart) - Log off and on again to let the group assignment and realtime priorities take effect (or, to be safe, restart). Use the command `groups` to check if the the current user belongs to the realtime group.
\ No newline at end of file
#!/bin/bash
# get current kernel and realtime patch version
FILE=`curl -s https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/5.4/`
KERNEL=`echo $FILE | sed -n 's/.*patch-5.4.\(.*\)-rt.*.patch.gz.*/\1/p'`
RTPATCH=`echo $FILE | sed -n 's/.*patch-5.4..*-rt\(.*\).patch.gz.*/\1/p'`
echo "using kernel 5.4.$KERNEL with realtime patch $RTPATCH"
# get kernel file names and location
KERNELURL=https://www.kernel.org/pub/linux/kernel/v5.x/
KERNELNAME=linux-5.4.${KERNEL}
KERNELFILE=linux-5.4.${KERNEL}.tar
KERNELFILEXZ=linux-5.4.${KERNEL}.tar.xz
KERNELSIGN=linux-5.4.${KERNEL}.tar.sign
PATCHURL=https://www.kernel.org/pub/linux/kernel/projects/rt/5.4/
PATCHFILE=patch-5.4.${KERNEL}-rt${RTPATCH}.patch
PATCHFILEXZ=patch-5.4.${KERNEL}-rt${RTPATCH}.patch.xz
PATCHSIGN=patch-5.4.${KERNEL}-rt${RTPATCH}.patch.sign
# download kernel
echo "downloading kernel from ${PATCHURL}${PATCHFILE}"
curl -SLO ${KERNELURL}${KERNELFILEXZ}
curl -SLO ${KERNELURL}${KERNELSIGN}
echo "downloading patch from ${PATCHURL}${PATCHSIGN}"
curl -sLO ${PATCHURL}${PATCHFILEXZ}
curl -sLO ${PATCHURL}${PATCHSIGN}
# unzip kernel (required for verification)
xz -d $KERNELFILEXZ
xz -d $PATCHFILEXZ
# verify the kernel
gpg --verify --keyserver hkp://keys.gnupg.net --auto-key-retrieve $KERNELSIGN
gpg --verify --keyserver hkp://keys.gnupg.net --auto-key-retrieve $PATCHSIGN
# unpack kernel
tar xf $KERNELFILE
cd $KERNELNAME
patch -p1 < ../${PATCHFILE}
# build the kernel
# use the kernel config build on a normal ubuntu 18.4
cp ../config .config
# update config with defaults if new options have been added
make olddefconfig
make deb-pkg
config 0 → 100644
This diff is collapsed.
File deleted
File deleted
File deleted
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment