rpi-rt-kernel icon indicating copy to clipboard operation
rpi-rt-kernel copied to clipboard

issues generating an image with RT Kernel

Open rebeccaRossRobotics opened this issue 9 months ago • 8 comments

Hi! I'm trying to use your repo to add the RT Kernel along with support for PCIE for the CM4 but I keep getting these errors. Any idea on how to fix them?

 => [27/27] ADD config.txt ./                                                                                                                                                                                 0.0s 
 => exporting to image                                                                                                                                                                                       15.1s 
 => => exporting layers                                                                                                                                                                                      15.1s
 => => writing image sha256:df7502525c6e3d2845728f087d933fbaf8808d41f41f1b51709071c864e411df                                                                                                                  0.0s
 => => naming to docker.io/library/rpi-rt-linux                                                                                                                                                               0.0s
docker rm tmp-rpi-rt-linux || true
Error response from daemon: No such container: tmp-rpi-rt-linux
docker run --privileged --name tmp-rpi-rt-linux rpi-rt-linux /raspios/build.sh
mount: /raspios/mnt/disk: wrong fs type, bad option, bad superblock on /dev/loop25, missing codepage or helper program, or other error.
mount: /raspios/mnt/boot: failed to setup loop device for /raspios/2024-03-15-raspios-bookworm-arm64-lite.img.

I did have to make some small mods to the dockerfile...

# set PLATFORM32 to something not null if you're building for older platforms, i.e. Pi 1, Pi Zero, Pi Zero W and Pi CM1
# do not define PLATFORM32 or set it to null if you're building for newer platforms, i.e. Pi 3, Pi 3+, Pi 4, Pi 400, Pi Zero 2 W, Pi CM3, Pi CM3+, Pi CM4
FROM ubuntu:20.04

ENV LINUX_KERNEL_VERSION=6.6
ENV LINUX_KERNEL_BRANCH=rpi-${LINUX_KERNEL_VERSION}.y

ENV TZ=Europe/Copenhagen
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt-get update
RUN apt-get install -y git make gcc bison flex libssl-dev bc ncurses-dev kmod
RUN apt-get install -y crossbuild-essential-arm64 crossbuild-essential-armhf
RUN apt-get install -y wget zip unzip fdisk nano curl xz-utils

WORKDIR /rpi-kernel
RUN git clone https://github.com/raspberrypi/linux.git -b ${LINUX_KERNEL_BRANCH} --depth=1
WORKDIR /rpi-kernel/linux
RUN export PATCH=$(curl -s https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/${LINUX_KERNEL_VERSION}/ | sed -n 's:.*<a href="\(.*\).patch.gz">.*:\1:p' | sort -V | tail -1) && \
    echo "Downloading patch ${PATCH}" && \
    curl https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/${LINUX_KERNEL_VERSION}/${PATCH}.patch.gz --output ${PATCH}.patch.gz && \
    gzip -cd /rpi-kernel/linux/${PATCH}.patch.gz | patch -p1 --verbose

ARG PLATFORM32

# if PLATFORM32 has been defined then set KERNEL=kernel else set KERNEL=kernel8 (arm64)
ENV KERNEL=${PLATFORM32:+kernel}
ENV KERNEL=${KERNEL:-kernel8}

# if PLATFORM32 has been defined then set ARCH=arm else set ARCH=arm64
ENV ARCH=${PLATFORM32:+arm}
ENV ARCH=${ARCH:-arm64}

# if PLATFORM32 has been defined then set CROSS_COMPILE=arm-linux-gnueabihf- else set CROSS_COMPILE=aarch64-linux-gnu-
ENV CROSS_COMPILE=${PLATFORM32:+arm-linux-gnueabihf-}
ENV CROSS_COMPILE=${CROSS_COMPILE:-aarch64-linux-gnu-}

# print the above env variables
RUN echo ${KERNEL} ${ARCH} ${CROSS_COMPILE}

RUN [ "$ARCH" = "arm" ] && make bcmrpi_defconfig || make bcm2711_defconfig
RUN ./scripts/config --disable CONFIG_VIRTUALIZATION
RUN ./scripts/config --enable CONFIG_PREEMPT_RT
RUN ./scripts/config --disable CONFIG_RCU_EXPERT
RUN ./scripts/config --enable CONFIG_RCU_BOOST
RUN [ "$ARCH" = "arm" ] && ./scripts/config --enable CONFIG_SMP || true
RUN [ "$ARCH" = "arm" ] && ./scripts/config --disable CONFIG_BROKEN_ON_SMP || true
RUN ./scripts/config --set-val CONFIG_RCU_BOOST_DELAY 500

RUN make -j4 Image modules dtbs

ARG RASPIOS_IMAGE_NAME
RUN echo "Using Raspberry Pi image ${RASPIOS_IMAGE_NAME}"
WORKDIR /raspios
RUN apt -y install
RUN export DATE=$(curl -s https://downloads.raspberrypi.org/${RASPIOS_IMAGE_NAME}/images/ | sed -n "s:.*${RASPIOS_IMAGE_NAME}-\(.*\)/</a>.*:\1:p" | tail -1) && \
    export RASPIOS=$(curl -s https://downloads.raspberrypi.org/${RASPIOS_IMAGE_NAME}/images/${RASPIOS_IMAGE_NAME}-${DATE}/ | sed -n "s:.*<a href=\"\(.*\).xz\">.*:\1:p" | tail -1) && \
    echo "Downloading ${RASPIOS}.xz" && \
    curl https://downloads.raspberrypi.org/${RASPIOS_IMAGE_NAME}/images/${RASPIOS_IMAGE_NAME}-${DATE}/${RASPIOS}.xz --output ${RASPIOS}.xz && \
    xz -d ${RASPIOS}.xz

RUN mkdir /raspios/mnt && mkdir /raspios/mnt/disk && mkdir /raspios/mnt/boot
ADD build.sh ./build.sh
ADD config.txt ./

rebeccaRossRobotics avatar May 10 '24 17:05 rebeccaRossRobotics