tty1
Posts: 18
Joined: Fri Feb 16, 2018 9:45 am

Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Feb 16, 2018 10:07 am

I'm currently working on a project that automatically builds the Raspberry Pi kernels as real-time kernels.
Everything seems to work as expected so far. But it looks like I'm missing a directory after the build process.

Code: Select all

$ cp -r /linux/arch/arm/boot/dts/overlays $INSTALL_MOD_PATH/boot
cp: cannot stat '/linux/arch/arm/boot/dts/overlays': No such file or directory
Here is the complete build output if you care: https://gitlab.com/T-vK/rpi-rt-kernel/-/jobs/52821248

My build script is based on these instructions: https://www.raspberrypi.org/documentati ... uilding.md

And according to those, there should be a `arch/arm/boot/dts/overlays` directory.
sudo cp arch/arm/boot/dts/overlays/*.dtb* mnt/fat32/overlays/
Any ideas what went wrong here? I mean the whole build didn't throw any errors.
Is it possible that the official instructions are wrong or outdated?

The build was done with commit 81d0cc85caabe062991ea45ddada814835d47fb0 which should be Kernel version 4.14.18

I picked that exact commit because for the latest commit of rpi-4.14.y there is no matching real time patch set.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1734
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Wed Feb 21, 2018 9:23 pm

My build script is based on these instructions: https://www.raspberrypi.org/documentati ... uilding.md
Without seeing your build script I'm not sure in what way you've broken it. Post it here and I'll tell you.

tty1
Posts: 18
Joined: Fri Feb 16, 2018 9:45 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Feb 23, 2018 8:38 am

The build happens inside a debian:stretch docker container.

Code: Select all

    cd /
    apt-get update
    apt-get install -y git curl wget make gcc bc libncurses-dev
    git clone --recursive https://github.com/raspberrypi/linux.git
    git clone --recursive https://github.com/raspberrypi/tools.git
    mkdir rtkernel

    export ARCH=arm
    export PATH=$PATH:/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
    export CROSS_COMPILE=arm-linux-gnueabihf-
    export INSTALL_MOD_PATH=/rtkernel
    export KERNEL=kernel7

    cd /linux
    # 4.14.18
    git checkout 81d0cc85caabe062991ea45ddada814835d47fb0
    wget -O rt.patch.gz https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patch-4.14.18-rt15.patch.gz
    zcat rt.patch.gz | patch -p1
    wget -O .config https://gitlab.com/T-vK/rpi-rt-kernel/blob/master/rpi23b-rt.config
    make -j2 zImage
    make -j2 modules
    make -j2 dtbs
    make -j2 modules_install
    cp /linux/arch/arm/boot/zImage $INSTALL_MOD_PATH/boot/$KERNEL.img
    cp /linux/arch/arm/boot/dts/*.dtb $INSTALL_MOD_PATH/boot/
    cp -r /linux/arch/arm/boot/dts/overlays $INSTALL_MOD_PATH/boot || true
    cd $INSTALL_MOD_PATH
    tar -zcvf /rpi-rt-kernel.tar.gz *
The tar.gz that is created in the end can be downloaded here in case you'd like to look at it: https://gitlab.com/T-vK/rpi-rt-kernel/- ... nel.tar.gz

I made some changes so that the build ignores the missing overlays directory.
The output for that new build can be found here: https://gitlab.com/T-vK/rpi-rt-kernel/-/jobs/53068133/

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1734
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Feb 23, 2018 10:53 am

Your problem is this line:

Code: Select all

git checkout 81d0cc85caabe062991ea45ddada814835d47fb0
That commit, titled "Linux 4.4.18" is in an upstream branch and thus has no Raspberry Pi modifications (including the overlays). The downstream branches exist in parallel, with pointers (merge commits) back into upstream branches interspersed with downstream-only content.

Tiejun Chen is trying to create an official rpi-4.14.y-rt branch, merging the upstream and rpi branches and rebasing the -rt commits, applying any fixups needed at the same time. The nice thing about this approach is that it will be just one repo to visit and all the Pi-specific changes will already have been made. I've been supporting him with some guidance, but the mechanics of the hosting haven't been resolved yet. In the meantime you can see his efforts in his own repo: https://github.com/TiejunChina/linux/tree/rpi-4.14.y-rt - just replace the raspberrypi/linux reference in your instructions with this one, making sure you are in the rpi-4.14.y-rt branch, and delete the two wgets and the zcat.

There's some discussion in this old issue: https://github.com/raspberrypi/linux/issues/2244

tty1
Posts: 18
Joined: Fri Feb 16, 2018 9:45 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Feb 23, 2018 11:53 am

Awesome! Does running `make bcm2709_defconfig` result in the desired .config or do I have to manually go through `make menuconfig` to set `Preemption Model` to `Fully Preemptible Kernel (RT)`?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1734
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Feb 23, 2018 1:52 pm

I was going to say that it should all just work, but the final step of patching the defconfigs hasn't been done yet, so for now you will still need to use menuconfig (or equivalent).

tty1
Posts: 18
Joined: Fri Feb 16, 2018 9:45 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Feb 23, 2018 4:17 pm

Thank you so much PhilE!
I managed to successfully build both, the image and the deb packages.

image build output | image download
deb packages build output | deb packages download

Now I just need to test it. :)

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1734
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Feb 23, 2018 4:19 pm

Let me know how it goes - I've not got further than building and booting the RT kernel because I don't have any use cases for it.

tty1
Posts: 18
Joined: Fri Feb 16, 2018 9:45 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Mar 02, 2018 10:15 am

No success so far. As soon as I put the kernel on my Pi, it will fail somewhere in the boot process. So I tried to flash a fresh install of Raspbian, but again the rt-kernel breaks it.

I also tried to flash the pre-built kernel that is provided in this guide: http://download.frank-durr.de/kernel-4.4.9-rt17.tgz
But it fails as well...

Can you provide the kernel that you have booted successfully? I would like to compare it to mine.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1734
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Mar 02, 2018 10:18 am

If you have a kernel7.img built from the current head of the -rt tree, upload it somewhere so that I can test it - I have more chance of figuring out why it doesn't boot.

tty1
Posts: 18
Joined: Fri Feb 16, 2018 9:45 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Mar 02, 2018 10:23 am

The kernel7.img file is inside the boot folder of this tar.gz: https://gitlab.com/T-vK/rpi-rt-kernel-b ... nel.tar.gz

tty1
Posts: 18
Joined: Fri Feb 16, 2018 9:45 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Mar 02, 2018 11:31 am

Oh, I'm really sorry. The file I provided is not actually the latest head anymore. :oops:
Last edited by tty1 on Fri Mar 02, 2018 11:38 am, edited 2 times in total.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1734
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Mar 02, 2018 11:32 am

It's OK - I haven't got round to looking at it yet.

tty1
Posts: 18
Joined: Fri Feb 16, 2018 9:45 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Mar 02, 2018 11:39 am

I'm currently building the latest one. When it is done I'll try that one and report how it went. https://gitlab.com/T-vK/rpi-rt-kernel-b ... s/55360707

tty1
Posts: 18
Joined: Fri Feb 16, 2018 9:45 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Mar 02, 2018 7:07 pm

I still can't get it to work. Here's the latest kernel image: https://gitlab.com/T-vK/rpi-rt-kernel-b ... nel.tar.gz (as before, the kernel7.img is in the boot folder).

This is how I copied it over:

Code: Select all

export KERNEL=kernel7
sudo cp /run/media/fedora/boot/$KERNEL.img /run/media/fedora/boot/$KERNEL-backup.img
cd boot
sudo cp -rd * /run/media/fedora/boot/
cd ../lib
sudo cp -dr * /run/media/fedora/b4ea8e46-fe87-4ddd-9e94-506c37005ac5/lib/
cd ..
sudo umount /run/media/fedora/boot
sudo umount /run/media/fedora/b4ea8e46-fe87-4ddd-9e94-506c37005ac5
The Pi had an older isntallation of 2017-09-07-raspbian-stretch at that time.
Here is what I got:
kernel_error_lq.jpg
kernel_error_lq.jpg (153.33 KiB) Viewed 2278 times
Then I downloaded the latest raspbian which is 2017-11-29-raspbian-stretch and flashed it. Then I ran:

Code: Select all

export KERNEL=kernel7
sudo cp /run/media/fedora/boot/$KERNEL.img /run/media/fedora/boot/$KERNEL-backup.img
sudo rm -r /run/media/fedora/boot/overlays/
sudo rm -r /run/media/fedora/rootfs/lib/firmware/

cd boot
sudo cp -rd * /run/media/fedora/boot/
cd ../lib
sudo cp -dr * /run/media/fedora/rootfs/lib/
cd ..
sudo umount /run/media/fedora/boot
sudo umount /run/media/fedora/rootfs
This time the output was:
IMG_20180302_195404.jpg
IMG_20180302_195404.jpg (66.27 KiB) Viewed 2278 times

Edit:
I just tried it a third time. This time I installed everything directly onto the SD card and pretty much followed the official build manual step by step. I also noticed that the .config file now automatically comes with `Preemption Model` set to `Fully Preemptible Kernel (RT)` when you run `make bcm2709_defconfig`. So I didn't use a .config modified by `make menuconfig` this time.
But again, it failed:
kernel_3rd_try_.jpg
kernel_3rd_try_.jpg (77.18 KiB) Viewed 2237 times
Here is the kernel7.img:
http://www108.zippyshare.com/v/0aVCzACo/file.html


Tiejun
Posts: 6
Joined: Mon Mar 05, 2018 11:29 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Mon Mar 05, 2018 11:41 am

First of all, PREEMPT_RT is already enabled by default so we don't need to enable that manually.

I tested -rt branch in the case of aarch64 before. I noticed there was a warnning message: Failed to start Load Kernel Modules. in your case. I recommend you can install kernel with rpm.

In the -rt branch,
$ make bcm2709_defconfig
$ make rpm

And then copy rpm file to your target to install that as follows:

$ rpm -ivh xxx.rpm

tty1
Posts: 18
Joined: Fri Feb 16, 2018 9:45 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Mon Mar 05, 2018 12:46 pm

Tiejun wrote:
Mon Mar 05, 2018 11:41 am
First of all, PREEMPT_RT is already enabled by default so we don't need to enable that manually.
Yes, I already realized that . :D
Tiejun wrote:
Mon Mar 05, 2018 11:41 am
I tested -rt branch in the case of aarch64 before. I noticed there was a warnning message: Failed to start Load Kernel Modules. in your case. I recommend you can install kernel with rpm.

In the -rt branch,
$ make bcm2709_defconfig
$ make rpm

And then copy rpm file to your target to install that as follows:

$ rpm -ivh xxx.rpm
I'm a bit confused. I'm running Raspbian (2017-11-29-raspbian-stretch) on my Pi (Raspberry Pi 3 model B). Are you sure that rpm will work? Maybe I should try `make deb-pkg` instead?

edit:
`make rpm` failed: https://gitlab.com/T-vK/rpi-rt-kernel-b ... s/55740560

Code: Select all

make rpm
scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  UPD     include/config/kernel.release
make clean
/bin/bash ./scripts/package/mkspec >./kernel.spec
  TAR     kernel-4.14.22_rt17_v7+.tar.gz
rpmbuild  --target arm -ta kernel-4.14.22_rt17_v7+.tar.gz
make[1]: rpmbuild: Command not found
scripts/package/Makefile:49: recipe for target 'rpm' failed
make[1]: *** [rpm] Error 127
Makefile:1349: recipe for target 'rpm' failed
make: *** [rpm] Error 2

Tiejun
Posts: 6
Joined: Mon Mar 05, 2018 11:29 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Mon Mar 05, 2018 9:43 pm

tty1 wrote:
Tiejun wrote:
Mon Mar 05, 2018 11:41 am
First of all, PREEMPT_RT is already enabled by default so we don't need to enable that manually.
Yes, I already realized that . :D
Tiejun wrote:
Mon Mar 05, 2018 11:41 am
I tested -rt branch in the case of aarch64 before. I noticed there was a warnning message: Failed to start Load Kernel Modules. in your case. I recommend you can install kernel with rpm.

In the -rt branch,
$ make bcm2709_defconfig
$ make rpm

And then copy rpm file to your target to install that as follows:

$ rpm -ivh xxx.rpm
I'm a bit confused. I'm running Raspbian (2017-11-29-raspbian-stretch) on my Pi (Raspberry Pi 3 model B). Are you sure that rpm will work? Maybe I should try `make deb-pkg` instead?

edit:
`make rpm` failed: https://gitlab.com/T-vK/rpi-rt-kernel-b ... s/55740560

Code: Select all

make rpm
scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  UPD     include/config/kernel.release
make clean
/bin/bash ./scripts/package/mkspec >./kernel.spec
  TAR     kernel-4.14.22_rt17_v7+.tar.gz
rpmbuild  --target arm -ta kernel-4.14.22_rt17_v7+.tar.gz
make[1]: rpmbuild: Command not found
scripts/package/Makefile:49: recipe for target 'rpm' failed
make[1]: *** [rpm] Error 127
Makefile:1349: recipe for target 'rpm' failed
make: *** [rpm] Error 2
You are compiling kernel on your rpi, right? Oftentimes I build my kernel on my PC in the way of cross-compiling :)

tty1
Posts: 18
Joined: Fri Feb 16, 2018 9:45 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Mon Mar 05, 2018 10:05 pm

No, I'm actually building the kernel on an x64 build server inside a debian based docker container. (Well, for the last screenshot I actually ran the docker container on my local x64 Fedora machine so that I could mount the SD card to the container and install everything directly onto it.)

So yeah, I'm cross-compiling as well. I still don't understand why I should build rpm packages, though. I mean, sure my Fedora machine uses rpm, but I want to install the kernel on my rpi which runs Raspbian and uses dpkg.

I already went ahead and built the .deb packages (https://gitlab.com/T-vK/rpi-rt-kernel-b ... cts/browse) and installed them on my Pi.
It still boots into the 4.9 kernel, though.

I'm not sure, maybe I have to change the config.txt to point to a different kernel image that got installed from the .deb packages. But I don't know where that would be...

edit:
These are the only .img files on my rpi:

Code: Select all

/lib/firmware/RTL8192E/data.img
/lib/firmware/RTL8192E/main.img
/lib/firmware/RTL8192E/boot.img
/boot/kernel.img
/boot/kernel7.img
I don't get it...

edit:
Okay, the .deb packages only contain a vmlinuz image which is different from the .img images. So this can't work.

edit:
Maybe there is a simple way to include the .img file(s) in the .deb packages . That way it may work...

edit:
I just replaced the kernel7.img with the rt image on the Pi and now it just boots into this weird square rainbow screen. No text output is visible.
Image

Could one of you please provide a built kernel so that I can compare it to mine? :|

Tiejun
Posts: 6
Joined: Mon Mar 05, 2018 11:29 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Mar 09, 2018 3:50 am

Could you connect with serial port? I think this can help us figure out where kernel stalled.

But go back to this in the beginning, I think the problme has not been related to -rt so far. The first step is to make sure you can boot successfully with the standard branch. Here the thing is, you should regenerate initramfs. This is why your kernel cannot load modules at stage 0.

User avatar
DougieLawson
Posts: 32702
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Fri Mar 09, 2018 12:21 pm

tty1 wrote:
Mon Mar 05, 2018 10:05 pm

edit:
I just replaced the kernel7.img with the rt image on the Pi and now it just boots into this weird square rainbow screen. No text output is visible.
Image

Could one of you please provide a built kernel so that I can compare it to mine? :|
It didn't boot, that's the bootcode.bin splashscreen when it fails to load the linux kernel. The failure is indicated by a flashing sequence on the green LED activity light.

https://elinux.org/R-Pi_Troubleshooting ... ic_pattern
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

Tiejun
Posts: 6
Joined: Mon Mar 05, 2018 11:29 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Tue Mar 13, 2018 3:41 pm

What I meant is, please go to rpi-v4.14.y to check if this standard branch works for you, not rpi-v4.14.y-rt.

Tiejun
Posts: 6
Joined: Mon Mar 05, 2018 11:29 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Mon Mar 19, 2018 12:56 am

Can you try the latest rpi-4.14.y-rt? I validated this with my pi3 mode B. Just please follow those instructions provided by raspberrypi.

tty1
Posts: 18
Joined: Fri Feb 16, 2018 9:45 am

Re: Can't find `arch/arm/boot/dts/overlays` when building kernel

Tue Mar 20, 2018 9:11 pm

Hey it's me again, I already gave up and concluded that the official build instructions must be incorrect or the kernel sources are broken.

I tried to use the non-rt rpi-4.14.y branch and it seems to have booted into the desktop environment, but both mouse and keyboard don't seem to work.

Here is what I did: First I flashed 2017-11-29-raspbian-stretch.img using Etcher. Then I did the following:

Code: Select all

#!/bin/bash
export KERNEL=kernel7

mkdir ./tmp
cd ./tmp
wget https://gitlab.com/T-vK/rpi-rt-kernel-build-project/-/jobs/58346488/artifacts/raw/rpi-4.14.y-8396667a1b2e.tar.gz
tar -xvzf ./rpi-4.14.y-8396667a1b2e.tar.gz
#sudo cp /run/media/fedora/boot/$KERNEL.img /run/media/fedora/boot/$KERNEL-backup.img
sudo rm "/run/media/fedora/boot/$KERNEL.img"
sudo rm -r /run/media/fedora/boot/overlays/
sudo rm -r /run/media/fedora/rootfs/lib/firmware/

#sudo cp ./boot/$KERNEL.img /run/media/fedora/boot/$KERNEL.img
#sudo cp ./boot/dts/*.dtb /run/media/fedora/boot/
#sudo cp ./boot/dts/overlays/*.dtb* /run/media/fedora/boot/overlays/
#sudo cp ./boot/dts/overlays/README /run/media/fedora/boot/overlays/

cd boot
sudo cp -rd * /run/media/fedora/boot/
cd ../lib
sudo cp -dr * /run/media/fedora/rootfs/lib/
cd ..
sudo umount /run/media/fedora/boot
sudo umount /run/media/fedora/rootfs
The build script for the kernel: https://gitlab.com/T-vK/rpi-rt-kernel/b ... lab-ci.yml
The docker file which tavk/raspi-rt-kernel-build-env:1.19 has been built with: https://gitlab.com/T-vK/rpi-rt-kernel/b ... Dockerfile
Build output: https://gitlab.com/T-vK/rpi-rt-kernel/-/jobs/53067695

I tried that twice, just to make sure...


I might give the rt branch another chance tomorrow. If it doesn't work I give up and there is nothing more I can do unless someone is willing to verify my kernel build or send me one that has worked on a different pi.

Return to “Linux Kernel”

Who is online

Users browsing this forum: No registered users and 2 guests