Bug 12186 - Raspberry Pi Zero-W build fails on newer kernel versions
Summary: Raspberry Pi Zero-W build fails on newer kernel versions
Status: RESOLVED FIXED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2019.08
Hardware: All Linux
: P5 major
Target Milestone: ---
Assignee: Peter Korsgaard
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-04 15:40 UTC by HiFiBerry (Daniel)
Modified: 2019-09-15 12:55 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
Rename bcm2708-rpi-0-w to bcm2708-rpi-zero-w (1.09 KB, patch)
2019-09-12 20:51 UTC, Grzegorz Blach
Details

Note You need to log in before you can comment on or make changes to this bug.
Description HiFiBerry (Daniel) 2019-09-04 15:40:42 UTC
On newer kernel versions of the Raspberry Pi kernel, the Raspberry Pi Zero-W overlay has been renamed from 

bcm2708-rpi-0-w.dtb

to

bcm2708-rpi-zero-w.dtb


Reproduce the problem:

make raspberrypi0w_defconfig
make

works

Now change 
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,5eeff139ea9135db6e01a58ef613338f1d0899d8)/linux-5eeff139ea9135db6e01a58ef613338f1d0899d8.tar.gz"

to 
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,8a9ebbd9b474592730dbbaee9be726600af1157b)/linux-8a9ebbd9b474592730dbbaee9be726600af1157b.tar.gz"
(current 4.19 Raspberry Pi kernel)

make now fails:

make[3]: *** No rule to make target 'arch/arm/boot/dts/bcm2708-rpi-0-w.dtb'.  Stop.
arch/arm/Makefile:343: recipe for target 'bcm2708-rpi-0-w.dtb' failed
make[2]: *** [bcm2708-rpi-0-w.dtb] Error 2
package/pkg-generic.mk:238: recipe for target '/home/matuschd/buildroot-2019.05.1/output/build/linux-custom/.stamp_built' failed
make[1]: *** [/home/matuschd/buildroot-2019.05.1/output/build/linux-custom/.stamp_built] Error 2
Makefile:84: recipe for target '_all' failed
make: *** [_all] Error 2

Some logic seems to be required here to distinguish between older and newer kernels.
Comment 1 Peter Korsgaard 2019-09-04 20:08:07 UTC
But the dts file to use is also part of the defconfig, so simply change

BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-0-w"

To

BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-zero-w"

But keep in mind that the genimage configuration also refers to the old name:

board/raspberrypi/genimage-raspberrypi0w.cfg:      "bcm2708-rpi-0-w.dtb",

Either we change that when we bump the kernel version or we add some logic to rename the file if needed.
Comment 2 Thomas Petazzoni 2019-09-11 13:33:13 UTC
Unless I'm mistaken, there is no bug. Our current RPi0w defconfig works fine, and it's only when you change it to use a different kernel version that it no longer builds. But this is obviously not a bug: if you tweak a part of a defconfig, you may need to also adjust other parts of that defconfig. In this specific example, if newer versions of the kernel have renamed the Device Tree for the platform, obviously the list of Device Trees that Buildroot will build/install should be updated accordingly.

Of course, let me know if I misunderstood. Don't hesitate to reopen the bug in such a case.
Comment 3 Grzegorz Blach 2019-09-12 20:51:46 UTC
Created attachment 8246 [details]
Rename bcm2708-rpi-0-w to bcm2708-rpi-zero-w
Comment 4 Grzegorz Blach 2019-09-12 20:52:21 UTC
I'm sure it's a bug. Yesterday I tried to build SD image for RPi0W using master branch and this failed. I've must applied a small patch to build RPi0W image correctly.

Earlier I built RPi0W image on 30 August and this worked without the patch.
Comment 5 Peter Korsgaard 2019-09-14 12:08:09 UTC
(In reply to Grzegorz Blach from comment #4)
Ahh, but that is because the kernel version got bumped last week:

commit 42d22f3bdba41da8e6b6ace2c78af2b3e34d7491
Author: Gergely Imreh <imrehg@gmail.com>
Date:   Tue Aug 27 15:14:28 2019 +0100

    {configs/raspberrypi,package/rpi-firmware}: bump kernel/firmware to 20190819 version

    It's the latest original version. The defconfig and
    package/rpi-firmware changes are done in a single patch, as they are
    going together.

    Signed-off-by: Gergely Imreh <imrehg@gmail.com>
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Which was applied on the 7th.
I have sent a patch to fix this - And while at it, also change the rpi0 defconfig to use the new dedicated dts file:

https://patchwork.ozlabs.org/patch/1162330/