xXANGELXx
Posts: 6
Joined: Tue Oct 11, 2016 6:26 am

[Custom Kernel] after compilation dtb modules are missing

Fri Dec 09, 2016 12:06 pm

Hello everyone, I followed this guide https://www.raspberrypi.org/documentati ... uilding.md
For building a custom kernel for a rpi3 (based on the version:

Code: Select all

rpi-4.1.y
Every seemed to be good. Compilation finished with no errors or warnings, but when trying to execute this:

Code: Select all

sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
The output is:

Code: Select all

stat failed.... no such file or directory
And actually there are no files with *.dtb* extension in those directories

So... does anyone know that is going on here?

Any help will be deeply appreciate it.

Cheers!

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

Re: [Custom Kernel] after compilation dtb modules are missin

Fri Dec 09, 2016 1:59 pm

This is the line of the script that does most of the work:

Code: Select all

make -j4 zImage modules dtbs
You can break it down into three separate stages:

Code: Select all

make -j4 zImage
make -j4 modules
make -j4 dtbs
The final line builds the dtbs and overlays. Try running it on its own, read any messages it displays, then look again for the .dtb and .dtbo files.

Starting from nothing, the minimum you need to build the Device Tree files is:

Code: Select all

git clone --depth 1 [email protected]:raspberrypi/linux.git
cd linux
make bcm2709_defconfig
make dtbs
N.B. That won't build the kernel or modules.

xXANGELXx
Posts: 6
Joined: Tue Oct 11, 2016 6:26 am

Re: [Custom Kernel] after compilation dtb modules are missin

Sat Dec 10, 2016 7:00 am

Hey! PhilE thank you very much for your answer, well.. these are the respective command outcomes:

Code: Select all

 $ make -j4 zImage
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
  CHK     include/generated/bounds.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  Kernel: arch/arm/boot/Image is ready
  Kernel: arch/arm/boot/zImage is ready
for the modules:

Code: Select all

 $ make -j4 modules
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
  CHK     include/generated/bounds.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     kernel/config_data.h
  Building modules, stage 2.
  MODPOST 1380 modules
and for the *.dtb* modules:

Code: Select all

 $ make dtbs
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
  CHK     include/generated/bounds.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
happens that in the /../boot/dts/ directory there are tons of *.dts and *.dtsi files but *.dtb* ...

Edit:
I tried to go ahead to the next step:

Code: Select all

sudo scripts/mkknlimg arch/arm/boot/zImage /boot/$KERNEL.img
and the output is:

Code: Select all

* This doesn't look like a Raspberry Pi kernel. In pass-through mode.
giving that it's a custom kernel should it look like a untouched rpi kernel?... actually.. I haven't made so much modifications, just added some network functions, everything else is untouched, so...

did I miss something?... do you think I should recompile again from scratch? ....

Cheers!

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

Re: [Custom Kernel] after compilation dtb modules are missin

Mon Dec 12, 2016 9:23 am

Can you please try the minimal steps I listed:

Code: Select all

git clone --depth 1 [email protected]:raspberrypi/linux.git
cd linux
make bcm2709_defconfig
make dtbs
You can probably skip the first two steps. Note that these instructions are for running on the Pi itself; if you are cross-compiling you will need to add "ARCH=arm" and "CROSS_COMPILE=<prefix for your toolchain>".

xXANGELXx
Posts: 6
Joined: Tue Oct 11, 2016 6:26 am

Re: [Custom Kernel] after compilation dtb modules are missin

Tue Mar 07, 2017 3:02 am

PhilE wrote:Can you please try the minimal steps I listed:

Code: Select all

git clone --depth 1 [email protected]:raspberrypi/linux.git
cd linux
make bcm2709_defconfig
make dtbs
You can probably skip the first two steps. Note that these instructions are for running on the Pi itself; if you are cross-compiling you will need to add "ARCH=arm" and "CROSS_COMPILE=<prefix for your toolchain>".
Hi!! thanks for your answer and so sorry for very late reply... got a medical condition that took me off the game for quite some time til now... :/ ... anyways...

going back to the topic: YES, I did try the steps you listed, and when I build from the RPI source (untouched)... everything goes fine, but as I'm trying to build a Custom Kernel (not the RPI untouched source)... then is when the dtbs are not built...

(as I'm new on compiling kernels for Linux/Debian/RPI )... is there any chance to know which configuration files should I re-configure to let the dtbs be build and moreover.. to get a successful custom kernel running on my rpi3?

thank you very much!

kind regards

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

Re: [Custom Kernel] after compilation dtb modules are missin

Tue Mar 07, 2017 7:17 am

I'm not going to play a guessing game to work out what has been changed. If they are your modifications you can tell me, otherwise you need to ask the provider of the custom kernel why you can't build DTBs.

xXANGELXx
Posts: 6
Joined: Tue Oct 11, 2016 6:26 am

Re: [Custom Kernel] after compilation dtb modules are missin

Wed Mar 22, 2017 4:59 am

PhilE wrote:I'm not going to play a guessing game to work out what has been changed. If they are your modifications you can tell me, otherwise you need to ask the provider of the custom kernel why you can't build DTBs.
modifications are for the kernel to be able to handle multiple tcp connections at the same time (multipath tcp) ... the kernel source the project has is available at ( https://github.com/multipath-tcp/mptcp )... which is written for x86/amd64 architectures ... I performed an auto-merging process (as I lack lot of knowledge about this kind of process) with

Code: Select all

git merge -X theirs repo/branch
please let me know what other data should I include.

thanks!

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

Re: [Custom Kernel] after compilation dtb modules are missin

Wed Mar 22, 2017 9:31 am

The merge must have broken the dtbo rules. Compare scripts/Makefile.dtbinst in the two trees and you should find the problem. This is the patch we apply in the rpi kernels:

Code: Select all

--- a/scripts/Makefile.dtbinst
+++ b/scripts/Makefile.dtbinst
@@ -27,6 +27,7 @@ ifeq ("$(dtbinst-root)", "$(obj)")
 endif
 
 dtbinst-files  := $(dtb-y)
+dtboinst-files := $(dtbo-y)
 dtbinst-dirs   := $(dts-dirs)
 
 # Helper targets for Installing DTBs into the boot directory
@@ -35,15 +36,18 @@ quiet_cmd_dtb_install =     INSTALL $<
 
 install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj))
 
-$(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep
+$(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs): | __dtbs_install_prep
 
 $(dtbinst-files): %.dtb: $(obj)/%.dtb
        $(call cmd,dtb_install,$(install-dir))
 
+$(dtboinst-files): %.dtbo: $(obj)/%.dtbo
+       $(call cmd,dtb_install,$(install-dir))
+
 $(dtbinst-dirs):
        $(Q)$(MAKE) $(dtbinst)=$(obj)/[email protected]
 
-PHONY += $(dtbinst-files) $(dtbinst-dirs)
-__dtbs_install: $(dtbinst-files) $(dtbinst-dirs)
+PHONY += $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs)
+__dtbs_install: $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs)
 
 .PHONY: $(PHONY)


3x3cut0r
Posts: 6
Joined: Fri Dec 08, 2017 4:45 pm

Re: [Custom Kernel] after compilation dtb modules are missing

Fri Dec 08, 2017 4:54 pm

Hi
I have the same problem with compiling a raspbian kernel with mptcp integrated.
no dtb files in boot/dts/overlays at all.
no errors at all while compiling ...

could somebody tell me how i can fix this?

What i have done:

Code: Select all

# CROSS COMPILE A RASPBERRY PI 3 KERNEL WITH MPTCP v0.93:
sudo su
apt install git bc make ncurses-dev gcc gcc-arm-linux-gnueabihf wget unzip
git clone --depth 1 git://github.com/raspberrypi/linux.git
cd linux
git init
git remote add mptcp https://github.com/multipath-tcp/mptcp.git
git fetch mptcp --depth 1
cd .git
git branch -a
cd ..
git checkout -b rpi_mptcp origin/rpi-4.9.y
git config --global user.email "[email protected]"
git merge -X theirs mptcp/mptcp_v0.93
# -> STRG+X
git clone https://github.com/raspberrypi/tools ~/tools
echo PATH=\$PATH:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin >> ~/.bashrc
source ~/.bashrc
make mrproper
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- nconfig
# Changing the following module from <M> to <*> with <space>:
# 	Networking support --->
# 	Networking options --->
# 	<*> The IPv6 protocol --->
# Changing the now visible modules MPTCP from [ ] to [*] with <space>:
# 	[*] MPTCP protocol (NEW)
# 	[*] 	MPTCP: advanced path-manager control (NEW) ----
# 	[*] MPTCP: advanced scheduler control (NEW) ----
# 3x <ESC> + 2x ENTER (<save> and <ok>)
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j 4 zImage
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j 4 modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j 4 dtbs
wget https://downloads.raspberrypi.org/raspbian_lite_latest
unzip raspbian_lite_latest
mv *.img raspbian.img
fdisk -l raspbian.img
mkdir -p mnt/fat32
mkdir mnt/ext4
mount -v -o offset=4194304 -t vfat raspbian.img mnt/fat32
mount -v -o offset=48234496 -t ext4 raspbian.img mnt/ext4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 -j 4 modules_install
KERNEL=kernel7
cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img
cp arch/arm/boot/zImage mnt/fat32/$KERNEL.img
cp arch/arm/boot/dts/*.dtb mnt/fat32/

# HERE I GOT THE ERROR: NO FILE OR DIRECTORY
cp arch/arm/boot/dts/overlays/*.dtb* mnt/fat32/overlays/

cp arch/arm/boot/dts/overlays/README mnt/fat32/overlays/
echo "kernel=kernel7.img" >> mnt/fat32/config.txt
umount mnt/fat32
umount mnt/ext4
sudo dd bs=1m if=raspbian.img of=/dev/<SDCARD>

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

Re: [Custom Kernel] after compilation dtb modules are missing

Fri Dec 08, 2017 6:27 pm

You need a "mkdir mnt/fat32/overlays" before the copy.

3x3cut0r
Posts: 6
Joined: Fri Dec 08, 2017 4:45 pm

Re: [Custom Kernel] after compilation dtb modules are missing

Sat Dec 09, 2017 10:09 am

no, because it is already present in the img. that is not the problem. the problem is, that nothing was created in overlays while compiling.

Code: Select all

[email protected]:~/linux# ls -la arch/arm/boot/dts/overlays/*.dtb*
ls: cannot access 'arch/arm/boot/dts/overlays/*.dtb*': no such file or directory
no *.dtb* files, but tonns of *.dts* files!

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

Re: [Custom Kernel] after compilation dtb modules are missing

Sat Dec 09, 2017 10:58 am

Use "make ... savedefconfig" to save a new defconfig, then diff that against bcm2709_defconfig to see what has changed.

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

Re: [Custom Kernel] after compilation dtb modules are missing

Sat Dec 09, 2017 11:14 am

No, forget that. You almost certainly have exactly the same problem as the previous poster, with the same solution - don't use "git merge -X theirs".

3x3cut0r
Posts: 6
Joined: Fri Dec 08, 2017 4:45 pm

Re: [Custom Kernel] after compilation dtb modules are missing

Sat Dec 09, 2017 12:14 pm

without that it is nothing different. also no dtb files in overlays after make dtbs ...
(git merge mptcp/mptcp_v0.93)

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

Re: [Custom Kernel] after compilation dtb modules are missing

Sat Dec 09, 2017 5:16 pm

I've found the problem, and I also understand why I couldn't reproduce it the last time I tried.

The issue is caused by the use of the "--depth 1" option. This tells git to effectively squash all of its history down to a single commit, and is great for saving download time and disk space. However, it plays havoc with git's merge strategies, because for every file it does one merge - ours vs theirs - and the "-X theirs" tells it to use theirs if there are any conflicts. By preserving the revision history, git can do a series of smaller merges, each of which is much more likely to succeed without conflict.

Try this edited version of your script (with some unnecessary steps removed):

Code: Select all

# CROSS COMPILE A RASPBERRY PI 3 KERNEL WITH MPTCP v0.93:
# Common setup first - only necesssary once
sudo su
apt install git bc make ncurses-dev gcc gcc-arm-linux-gnueabihf wget unzip
git config --global user.email "[email protected]"
git clone https://github.com/raspberrypi/tools ~/tools
echo PATH=\$PATH:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin >> ~/.bashrc
source ~/.bashrc
# Create the linux repo, then configure and build it
git clone git://github.com/raspberrypi/linux.git
cd linux
git remote add mptcp https://github.com/multipath-tcp/mptcp.git
git fetch mptcp
git checkout -b rpi_mptcp origin/rpi-4.9.y
git merge -X theirs mptcp/mptcp_v0.93
# -> STRG+X
make mrproper
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- nconfig
# Changing the following module from <M> to <*> with <space>:
# 	Networking support --->
# 	Networking options --->
# 	<*> The IPv6 protocol --->
# Changing the now visible modules MPTCP from [ ] to [*] with <space>:
# 	[*] MPTCP protocol (NEW)
# 	[*] 	MPTCP: advanced path-manager control (NEW) ----
# 	[*] MPTCP: advanced scheduler control (NEW) ----
# 3x <ESC> + 2x ENTER (<save> and <ok>)
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j 4 zImage modules dtbs
wget https://downloads.raspberrypi.org/raspbian_lite_latest
unzip raspbian_lite_latest
mv *.img raspbian.img
fdisk -l raspbian.img
mkdir -p mnt/fat32
mkdir mnt/ext4
mount -v -o offset=4194304 -t vfat raspbian.img mnt/fat32
mount -v -o offset=48234496 -t ext4 raspbian.img mnt/ext4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 -j 4 modules_install
KERNEL=kernel7
cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img
cp arch/arm/boot/zImage mnt/fat32/$KERNEL.img
cp arch/arm/boot/dts/*.dtb mnt/fat32/
cp arch/arm/boot/dts/overlays/*.dtb* mnt/fat32/overlays/
cp arch/arm/boot/dts/overlays/README mnt/fat32/overlays/
echo "kernel=kernel7.img" >> mnt/fat32/config.txt
umount mnt/fat32
umount mnt/ext4
sudo dd bs=1m if=raspbian.img of=/dev/<SDCARD>

3x3cut0r
Posts: 6
Joined: Fri Dec 08, 2017 4:45 pm

Re: [Custom Kernel] after compilation dtb modules are missing

Sun Dec 10, 2017 9:34 pm

Hey
thank you for your help ... really!
with this method i can successfully build the overlays with the dtbs ... but now i can't make the zImage!

Code: Select all

...
  CC      net/netlink/af_netlink.o
net/ipv4/tcp_ipv4.c: In function ‘tcp_v4_init_req’:
net/ipv4/tcp_ipv4.c:1239:6: error: ‘struct inet_request_sock’ has no member named ‘opt’
  ireq->opt = tcp_v4_save_options(skb);
      ^
scripts/Makefile.build:293: recipe for target 'net/ipv4/tcp_ipv4.o' failed
make[2]: *** [net/ipv4/tcp_ipv4.o] Error 1
  CC      net/netfilter/core.o
scripts/Makefile.build:544: recipe for target 'net/ipv4' failed
make[1]: *** [net/ipv4] Error 2
make[1]: *** Waiting for unfinished jobs....
  CC      net/netfilter/nf_log.o
  CC      net/netfilter/nf_queue.o
  CC      net/netfilter/nf_sockopt.o
  CC      net/netlink/genetlink.o
  CC      net/mptcp/mptcp_ipv4.o
  LD      net/netfilter/ipset/built-in.o
  CC      net/mptcp/mptcp_pm.o
  LD      net/netfilter/ipvs/built-in.o
  LD      net/netfilter/netfilter.o
  LD      net/netfilter/built-in.o
  CC      net/mptcp/mptcp_output.o
  CC      net/mptcp/mptcp_input.o
  LD      net/netlink/built-in.o
  CC      net/mptcp/mptcp_sched.o
  CC      net/mptcp/mptcp_ipv6.o
  LD      net/mptcp/mptcp.o
  LD      net/mptcp/built-in.o
Makefile:991: recipe for target 'net' failed
make: *** [net] Error 2

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

Re: [Custom Kernel] after compilation dtb modules are missing

Mon Dec 11, 2017 4:02 pm

Yes, I get the same now, having allowed the build to run to completion. It looks like merging two sets of patches - ours again upstream, mptcp against upstream - is problematic.

I've tried several different merge orders with no luck, so I suggest you try the following:

1. Take a copy of the working scripts/Makefile.dtbinst.
2. Follow the original clone and merge instructions including "--depth 1" and "-X theirs".
3. Copy the saved scripts/Makefile.dtbinst back.
4. Follow the remaining build instructions.

3x3cut0r
Posts: 6
Joined: Fri Dec 08, 2017 4:45 pm

Re: [Custom Kernel] after compilation dtb modules are missing

Tue Dec 12, 2017 9:19 pm

I already did this and i wasn't able to build the dtbs too ... but ...

At the moment I wrote my next sentence "I think I will give this up" ... was the moment i got an email from the mptcp project that a new branch was released on github "mptcp_v0.94".
This branch is based on upstream Linux v4.14 LTS release. (not like the branch mptcp_v0.93 which is based on Linux v4.9)

And i thought ... hmm ... I will give this a last try ... and BAM!
Compilation worked like a charm.
I have now a working and booting! Raspberry Pi 3 Image with Linux Kernel v4.14.66-v7+ and MPTCP v0.94 !!!

Here the steps i did:

Code: Select all

# CROSS COMPILE A RASPBERRY PI 3 KERNEL 4.14.y WITH MPTCP v0.94:
sudo su
# <Enter user password>
apt update
apt upgrade
# INSTALL PREREQUISITES:
apt install git bc make ncurses-dev gcc gcc-arm-linux-gnueabihf wget unzip
# DOWNLOAD RASPBERRYPI KERNEL AND MERGE WITH MPTCP:
git clone git://github.com/raspberrypi/linux.git
cd linux
git remote add mptcp https://github.com/multipath-tcp/mptcp.git
git fetch mptcp
git checkout -b rpi_mptcp origin/rpi-4.14.y
# SETTING UP GIT EMAIL (CAN BE A TRASH MAIL OR JUST [email protected])
git config --global user.email "[email protected]"
git merge mptcp/mptcp_v0.94
# -> STRG+X
# INSTALL TOOLCHAIN:
git clone https://github.com/raspberrypi/tools ~/tools
echo PATH=\$PATH:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin >> ~/.bashrc
source ~/.bashrc
# CROSS COMPILE:
make mrproper
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- nconfig
# Enable the following modules with <space>:
# 	[*] Networking support --->
# 	          Networking options --->
#                    [*] TCP/IP networking
#                        [*] IP: advanced router
#                            [*] IP: policy routing
#                    ...
#                    [*] TCP: advanced congestion control  --->
#                        <*> MPTCP Linked Increase
#                        <*> MPTCP Opportunistic Linked Increase
#                        <*> MPTCP WVEGAS CONGESTION CONTROL
#                        <*> MPTCP BALIA CONGESTION CONTROL
#                               Default TCP congestion control (Lia)  --->
#                                   <X> Lia
#                    ...
# 	              <*> The IPv6 protocol --->
# 	              [*] MPTCP protocol (NEW)
# 	              [*] MPTCP: advanced path-manager control (NEW) ----
#                       <*> MPTCP Full-Mesh Path-Manager 
#                       <*> MPTCP ndiff-ports 
#                       <*> MPTCP Binder
#                              Default MPTCP Path-Manager (Full mesh)  --->
#                                  <X> Full mesh      
# 	              [*] MPTCP: advanced scheduler control (NEW) ----
#                       <*> MPTCP Round-Robin
#                       <*> MPTCP Redundant 
#                              Default MPTCP Scheduler (Default)  ---> 
#                                  <X> Default
#
# 3-5x <ESC> + 2x ENTER (<save> and <ok>)
#
# the "-j 4" is the number of tasks/cores you will use:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j 4 zImage
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j 4 modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j 4 dtbs
# DOWNLOAD LATEST RASPBIAN LITE IMAGE:
wget https://downloads.raspberrypi.org/raspbian_lite_latest
unzip raspbian_lite_latest
mv *.img raspbian.img
fdisk -l raspbian.img
# YOU WILL GET SOMETHING LIKE THAT:
#
# Disk raspbian.img: 1.7 GiB, 1858076672 bytes, 3629056 sectors
# Units: sectors of 1 * 512 = 512 bytes
# Sector size (logical/physical): 512 bytes / 512 bytes
# I/O size (minimum/optimal): 512 bytes / 512 bytes
# Disklabel type: dos
# Disk identifier: 0x37665771
#
# Device        Boot Start     End Sectors  Size Id Type
# raspbian.img1        8192   96663    88472 43,2M  c W95 FAT32 (LBA)
# raspbian.img2       98304 3637247  3538944  1,7G 83 Linux
#
# CALCULATE THE OFFSET OF BOTH PARTITIONS:
# <PARTITION>:	<UNITS IN BYTES> * <START OF PARTITION> = <OFFSET>
# PARTITION 1: 	512 		 * 8192 	 	= 4194304
# PARTITION 2:	512		 * 98304		= 50331648
#
# THEN MOUNT BOTH PARTITIONS:
mkdir -p mnt/fat32
mkdir mnt/ext4
mount -v -o offset=48234496 -t ext4 raspbian.img mnt/ext4
# INSTALL MODULES:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 -j 4 modules_install
KERNEL=kernel7
umount mnt/ext4
mount -v -o offset=4194304 -t vfat raspbian.img mnt/fat32
cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img
cp arch/arm/boot/zImage mnt/fat32/$KERNEL.img
cp arch/arm/boot/dts/*.dtb mnt/fat32/
cp arch/arm/boot/dts/overlays/*.dtb* mnt/fat32/overlays/
cp arch/arm/boot/dts/overlays/README mnt/fat32/overlays/
echo "kernel=kernel7.img" >> mnt/fat32/config.txt
umount mnt/fat32
# DONE
# COPY raspbian.img TO SDCARD:
sudo diskutil list
# look for your SD-Card: e.g. /dev/disk5
diskutil unmountDisk /dev/disk5
sudo dd if=raspbian.img of=/dev/rdisk5 bs=1m conv=sync
tomorrow I will upload the image to a file hoster where other people can download it.

thank u again for you help PhilE !!!

//EDIT:
Here the image:
Raspbian_RPi3_4.1.39-v7+_mptcp_0.91.img
Raspbian_RPi3_4.9.87-v7+_mptcp_0.93.img
Raspbian_RPi3_4.14.66-v7+_mptcp_0.94.img
Last edited by 3x3cut0r on Wed Aug 29, 2018 7:22 am, edited 10 times in total.

robiwan
Posts: 13
Joined: Tue Apr 10, 2012 11:12 am

Re: [Custom Kernel] after compilation dtb modules are missing

Mon Feb 12, 2018 2:41 pm

I have the same exact problem, running:

Code: Select all

make dtbs
only yields:

Code: Select all

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
but NO .dtb files are generated. I've posted this here aswell.

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

Re: [Custom Kernel] after compilation dtb modules are missing

Mon Feb 12, 2018 4:43 pm

What are you building on? I'm not near a computer, but you should at least include ARCH=arm in the make command line.

Return to “Device Tree”