Skip to contentSkip to conversation

RPi: enable building a device-tree-enabled kernel (branch yem/rpi-dt)

PATCH Superseded Yann E. MORIN 2 participants 10 messages Jan 9, 2015 – Jan 10, 2015 Broadcom BCM2711/BCM2835 Arm architecture

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover RPi: enable building a device-tree-enabled kernel (branch yem/rpi-dt)

Hello All!

Recently, the Raspberry Pi fork of the kernel has gained support for the device tree.

This series is an attempt at making it smoothly available in Buildroot:

- add the necessary infrastructure: install DTBs from rpi-firmware,

    and install a script to mark the kernel (see below);

- update the board documentation;

- add a defconfig.

It is to be moted that the device tree support on the Raspberry Pi is not trivially similar to how all other boards behave:

====
First, the bootloader needs to know if the kernel has DT support or not, so it looks for a magic DTOK footer (a header at the end); if this header is present, DT support is assumed, and the bootloader loads the DTB.

This is not very much like what is done on other boards...

====
Second, the bootloader knows what model of the RPi it boots on, and is thus capable of loading the correct DTB. This is nice, because it means that a single firmware will work on all RPI models, auto magically.

This requires the kernel image has the footer appended, of course.

===
Third, if the kernel does not have a DTOK footer, it is possible to force-load a DTB, by adding a directive in the config.txt file (the configuration of the bootloader).

In this case, the bootloader will force-load that file as a DTB before booting the kernel.

But we loose the autodetection of the model we are running on, and it is not longer possible to run the same firmware on all models.

===
Eventually, there is a not-so-simple perl script that is provided in a separate RPi repository. Since this repository is rather huge, we just copied that script and bundled it in Buildroot.

Notes: I've upstreamed a fix for that perl script, that has been accepted. Round-trip: 2 hours! Yeah! :-)

===
This has been tested to work great with the currently-latest cset on the rpi-3.18.y branch, at:

    https://github.com/raspberrypi/linux/tree/rpi-3.18.y
    b9c9f8fc69aaba236169798c18dc1590fccf7acd

Since this is not their stable branch, that specific commit may disapear any time; just use the latest commit on rpi-3.18.y .

Changes v1 -> v2:
- do not force DT support in the kernel (thomas P., Peter)
- update the marking script
- update the board documentation

Regards,
Yann E. MORIN.

The following changes since commit 799c12ebe6c830338124f90a81d12feaa08de391:

xz-utils: needs threads (2015-01-09 13:26:27 +0100)

are available in the git repository at:

git://git.busybox.net/~ymorin/git/buildroot yem/rpi-dt

for you to fetch changes up to b65d009bf4aeb83b97e02a9fd03c14888b5f1ce2:

configs: add a DT-enabled Raspberry Pi defconfig (2015-01-09 23:27:28 +0100)

----------------------------------------------------------------
Yann E. MORIN (5):
package/rpi-firmware: add DT-aware marking script package/rpi-firmware: install DTB blobs boards/raspberrypi: don't document non-existent files boards/raspberrypi: update readme with Device Tree instructions
configs: add a DT-enabled Raspberry Pi defconfig

 board/raspberrypi/readme.txt         |  33 ++++-
 configs/raspberrypi_dt_defconfig     |  12 ++
 package/rpi-firmware/Config.in       |  11 ++
 package/rpi-firmware/mkknlimg        | 227 +++++++++++++++++++++++++++++++++++
 package/rpi-firmware/rpi-firmware.mk |  24 ++++
 5 files changed, 301 insertions(+), 6 deletions(-)
 create mode 100644 configs/raspberrypi_dt_defconfig
 create mode 100755 package/rpi-firmware/mkknlimg
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH v2 1/5 package/rpi-firmware: add DT-aware marking script

The Raspberry Pi can boot a kernel with device tree support. But at the same time, the RPi folks wante to keep the old-fashioned, ATAG-based way of booting (don't ask...).

So, the bootloader needs to know whether the kernel it is loading has DT support or not. For that, it looks at the end of the kernel image for a magic footer. If found, it loads a device tree and sets the registers appropriately so that the kernel finds the DTB. If not found, it loads the kernel with the traditional ATAGS.

Where it becomes a bit tricky, is that the DTB is different for models A/B and A+/B+ (that is A and B use the same DTB, while the A+ and B+ use a second DTB). The bootloader is capable to load the correct DTB from a specially named file. That is:
- on A/B, it loads bcm2708-rpi-b.dtb
- on A+/B+, it loads bcm2708-rpi-b-plus.dtb

If the DTB is differently named, the bootloader won't find it, will not load any DTB at all, and revert to booting with ATAGS.

It is possible to specify what DTB to load, by adding an new config option 'device_tree=file.dtb' in config.txt, but then the firmware on the SDcard is no longer bootable on both the original models and the Plus models.

So, add a script that appends the appropriate footer to the kernel image. The script is vampirised from the RPi's tools repository, but a new package is *not* added just for that script: the whole repository is 300+ MiB, and a checkout is 600+ MiB; it is not pertinent to add this as a new package for a script that weights a few KiB...

Install that script as a host utility, too.

Notes: lots of information is available in this thread on the RPi forums:

    http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=93015
---
 package/rpi-firmware/mkknlimg        | 227 +++++++++++++++++++++++++++++++++++
 package/rpi-firmware/rpi-firmware.mk |  10 ++
 2 files changed, 237 insertions(+)
 create mode 100755 package/rpi-firmware/mkknlimg
package/rpi-firmware/mkknlimg new file +227 -0
new file mode 100755
index 0000000..f377947
@@ -0,0 +1,227 @@
+#!/usr/bin/env perl
+#
+# Originaly from: https://github.com/raspberrypi/tools/blob/master/mkimage/mkknlimg
+# Original cset : 92a2df13b887f4799554bf92c4fc78d53668c868
+
+use strict;
+use integer;
+
+my $trailer_magic = 'RPTL';
+
+my $tmpfile1 = "/tmp/mkknlimg_$$.1";
+my $tmpfile2 = "/tmp/mkknlimg_$$.2";
+
+my $dtok = 0;
+
+while ($ARGV[0] =~ /^-/)
+{
+    my $arg = shift(@ARGV);
+    if ($arg eq '--dtok')
+    {
+	$dtok = 1;
+    }
+    else
+    {
+	print ("* Unknown option '$arg'\n");
+	usage();
+    }
+}
+
+usage() if (@ARGV != 2);
+
+my $kernel_file = $ARGV[0];
+my $out_file = $ARGV[1];
+
+my @wanted_config_lines =
+(
+	'CONFIG_BCM2708_DT'
+);
+
+my @wanted_strings =
+(
+	'bcm2708_fb',
+	'brcm,bcm2708-pinctrl',
+	'brcm,bcm2835-gpio',
+	'of_find_property'
+);
+
+my $res = try_extract($kernel_file, $tmpfile1);
+
+$res = try_decompress('\037\213\010', 'xy',    'gunzip', 0,
+		      $kernel_file, $tmpfile1, $tmpfile2) if (!$res);
+$res = try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1,
+		      $kernel_file, $tmpfile1, $tmpfile2) if (!$res);
+$res = try_decompress('BZh',          'xy',    'bunzip2', 0,
+		      $kernel_file, $tmpfile1, $tmpfile2) if (!$res);
+$res = try_decompress('\135\0\0\0',   'xxx',   'unlzma', 0,
+		      $kernel_file, $tmpfile1, $tmpfile2) if (!$res);
+$res = try_decompress('\211\114\132', 'xy',    'lzop -d', 0,
+		      $kernel_file, $tmpfile1, $tmpfile2) if (!$res);
+
+my $append_trailer;
+my $trailer;
+
+if ($res)
+{
+    print("Version: $res->{''}\n");
+
+    $append_trailer = $dtok;
+    if (!$dtok)
+    {
+	if (config_bool($res, 'bcm2708_fb'))
+	{
+	    $dtok ||= config_bool($res, 'CONFIG_BCM2708_DT');
+	    $dtok ||= config_bool($res, 'brcm,bcm2708-pinctrl');
+	    $dtok ||= config_bool($res, 'brcm,bcm2835-gpio');
+	    $append_trailer = 1;
+	}
+	else
+	{
+	    print ("* This doesn't look like a Raspberry Pi kernel. In pass-through mode.\n");
+	}
+    }
+}
+else
+{
+    print ("* Is this a valid kernel? In pass-through mode.\n");
+}
+
+if ($append_trailer)
+{
+    printf("DT: %s\n", $dtok ? "y" : "n");
+
+    my @atoms;
+
+    push @atoms, [ $trailer_magic, pack('V', 0) ];
+    push @atoms, [ 'KVer', $res->{''} ];
+    push @atoms, [ 'DTOK', pack('V', $dtok) ];
+
+    $trailer = pack_trailer(\@atoms);
+    $atoms[0]->[1] = pack('V', length($trailer));
+
+    $trailer = pack_trailer(\@atoms);
+}
+
+die "* Failed to open '$kernel_file'\n" if (!open(my $ifh, '<', $kernel_file));
+die "* Failed to create '$out_file'\n" if (!open(my $ofh, '>', $out_file));
+
+my $copybuf;
+my $total_len = 0;
+while (1)
+{
+	my $bytes = sysread($ifh, $copybuf, 64*1024);
+	last if (!$bytes);
+	syswrite($ofh, $copybuf, $bytes);
+	$total_len += $bytes;
+}
+
+if ($trailer)
+{
+    # Pad to word-alignment
+    syswrite($ofh, "\x000\x000\x000", (-$total_len & 0x3));
+    syswrite($ofh, $trailer);
+}
+
+close($ifh);
+close($ofh);
+
+exit($trailer ? 0 : 1);
+
+END {
+	unlink($tmpfile1) if ($tmpfile1);
+	unlink($tmpfile2) if ($tmpfile2);
+}
+
+
+sub usage
+{
+	print ("Usage: mkknlimg [--dtok] <vmlinux|zImage|bzImage> <outfile>\n");
+	exit(1);
+}
+
+sub try_extract
+{
+	my ($knl, $tmp) = @_;
+
+	my $ver = `strings "$knl" | grep -a -E "^Linux version [1-9]"`;
+
+	return undef if (!$ver);
+
+	chomp($ver);
+
+	my $res = { ''=>$ver };
+	my $string_pattern = '^('.join('|', @wanted_strings).')$';
+
+	my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`;
+	foreach my $match (@matches)
+	{
+	    chomp($match);
+	    $res->{$match} = 1;
+	}
+
+	my $config_pattern = '^('.join('|', @wanted_config_lines).')=(.*)$';
+	my $cf1 = 'IKCFG_ST\037\213\010';
+	my $cf2 = '0123456789';
+
+	my $pos = `tr "$cf1\n$cf2" "\n$cf2=" < "$knl" | grep -abo "^$cf2"`;
+	if ($pos)
+	{
+		$pos =~ s/:.*[\r\n]*$//s;
+		$pos += 8;
+		my $err = (system("tail -c+$pos \"$knl\" | zcat > $tmp 2> /dev/null") >> 8);
+		if (($err == 0) || ($err == 2))
+		{
+			if (open(my $fh, '<', $tmp))
+			{
+				while (my $line = <$fh>)
+				{
+					chomp($line);
+					$res->{$1} = $2 if ($line =~ /$config_pattern/);
+				}
+
+				close($fh);
+			}
+		}
+	}
+
+	return $res;
+}
+
+
+sub try_decompress
+{
+	my ($magic, $subst, $zcat, $idx, $knl, $tmp1, $tmp2) = @_;
+
+	my $pos = `tr "$magic\n$subst" "\n$subst=" < "$knl" | grep -abo "^$subst"`;
+	if ($pos)
+	{
+		chomp($pos);
+		$pos = (split(/[\r\n]+/, $pos))[$idx];
+		$pos =~ s/:.*[\r\n]*$//s;
+		my $cmd = "tail -c+$pos \"$knl\" | $zcat > $tmp2 2> /dev/null";
+		my $err = (system($cmd) >> 8);
+		return undef if (($err != 0) && ($err != 2));
+
+		return try_extract($tmp2, $tmp1);
+	}
+
+	return undef;
+}
+
+sub pack_trailer
+{
+	my ($atoms) = @_;
+	my $trailer = pack('VV', 0, 0);
+	for (my $i = $#$atoms; $i>=0; $i--)
+	{
+		my $atom = $atoms->[$i];
+		$trailer .= pack('a*x!4Va4', $atom->[1], length($atom->[1]), $atom->[0]);
+	}
+	return $trailer;
+}
+
+sub config_bool
+{
+	my ($configs, $wanted) = @_;
+	return (($configs->{$wanted} eq 'y') || ($configs->{$wanted} eq '1'));
+}
package/rpi-firmware/rpi-firmware.mk +10 -0
index 571a546..eb835ee 100644
@@ -19,4 +19,14 @@ define RPI_FIRMWARE_INSTALL_IMAGES_CMDS
 	$(INSTALL) -D -m 0644 package/rpi-firmware/cmdline.txt $(BINARIES_DIR)/rpi-firmware/cmdline.txt
 endef
 
+# We have no host sources to get, since we already
+# bundle the script we want to install.
+HOST_RPI_FIRMWARE_SOURCE =
+HOST_RPI_FIRMWARE_DEPENDENCIES =
+
+define HOST_RPI_FIRMWARE_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 package/rpi-firmware/mkknlimg $(HOST_DIR)/usr/bin/mkknlimg
+endef
+
 $(eval $(generic-package))
+$(eval $(host-generic-package))
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/5 package/rpi-firmware: install DTB blobs

In reply to Yann E. MORIN

Add an option to install all the DTBs:
- standard DTBs for standalon A/B and A+/B+ models;
- overlay DTBs for the 'hats' addon boards.

Install the DTBs as per the traditional layout expected by all RPi users, that is:
- base DTBs alongside the other boot files;
- overlay DTBs in a sub-directory.

This requires the user provide a specially configured Linux defconfig file, as the default ones do not enable USE_OF.

---
 package/rpi-firmware/Config.in       | 11 +++++++++++
 package/rpi-firmware/rpi-firmware.mk | 14 ++++++++++++++
 2 files changed, 25 insertions(+)
package/rpi-firmware/Config.in +11 -0
index cd45be4..80ba88a 100644
@@ -45,4 +45,15 @@ config BR2_PACKAGE_RPI_FIRMWARE_BOOT
 	default "_x"    if BR2_PACKAGE_RPI_FIRMWARE_X
 	default "_cd"   if BR2_PACKAGE_RPI_FIRMWARE_CD
 
+config BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTBS
+	bool "Install Device Tree Blobs (DTBs)"
+	help
+	  Say 'y' here if you want to boot your kernel that has support
+	  for the device tree.
+
+	  Note that the defconfig files in the Raspberry Pi fork of the
+	  Linux kernel do not enable support for the Device Tree. You'll
+	  have to provide your own Linux config or defconfig file with
+	  device tree enabled, to make use of those DTBs.
+
 endif # BR2_PACKAGE_RPI_FIRMWARE
package/rpi-firmware/rpi-firmware.mk +14 -0
index eb835ee..04c6160 100644
@@ -11,12 +11,26 @@ RPI_FIRMWARE_LICENSE_FILES = boot/LICENCE.broadcom
 RPI_FIRMWARE_INSTALL_TARGET = NO
 RPI_FIRMWARE_INSTALL_IMAGES = YES
 
+ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTBS),y)
+RPI_FIRMWARE_DEPENDENCIES += host-rpi-firmware
+# Override the version in this case.
+RPI_FIRMWARE_VERSION = 09627457b9e15bf4ea4e6751d3c173a3fb65df07
+define RPI_FIRMWARE_INSTALL_DTB
+	$(INSTALL) -D -m 0644 $(@D)/boot/bcm2708-rpi-b.dtb $(BINARIES_DIR)/rpi-firmware/bcm2708-rpi-b.dtb
+	$(INSTALL) -D -m 0644 $(@D)/boot/bcm2708-rpi-b-plus.dtb $(BINARIES_DIR)/rpi-firmware/bcm2708-rpi-b-plus.dtb
+	for ovldtb in  $(@D)/boot/overlays/*.dtb; do \
+		$(INSTALL) -D -m 0644 $${ovldtb} $(BINARIES_DIR)/rpi-firmware/overlays/$${ovldtb##*/} || exit 1; \
+	done
+endef
+endif
+
 define RPI_FIRMWARE_INSTALL_IMAGES_CMDS
 	$(INSTALL) -D -m 0644 $(@D)/boot/bootcode.bin $(BINARIES_DIR)/rpi-firmware/bootcode.bin
 	$(INSTALL) -D -m 0644 $(@D)/boot/start$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).elf $(BINARIES_DIR)/rpi-firmware/start.elf
 	$(INSTALL) -D -m 0644 $(@D)/boot/fixup$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).dat $(BINARIES_DIR)/rpi-firmware/fixup.dat
 	$(INSTALL) -D -m 0644 package/rpi-firmware/config.txt $(BINARIES_DIR)/rpi-firmware/config.txt
 	$(INSTALL) -D -m 0644 package/rpi-firmware/cmdline.txt $(BINARIES_DIR)/rpi-firmware/cmdline.txt
+	$(RPI_FIRMWARE_INSTALL_DTB)
 endef
 
 # We have no host sources to get, since we already
Signature · 1 line
1.9.1
#3 lore raw

PATCH v2 3/5 boards/raspberrypi: don't document non-existent files

In reply to Yann E. MORIN

Those files were preiously installed, but that's no longer the case since we select in the menuconfig which version of the bootloader we install.

---
 board/raspberrypi/readme.txt | 2 --
 1 file changed, 2 deletions(-)
board/raspberrypi/readme.txt +0 -2
index 8532de4..a6d3dd4 100644
@@ -55,9 +55,7 @@ After building, you should obtain this tree:
     +-- rpi-firmware
     |   +-- bootcode.bin
     |   +-- config.txt
-    |   +-- fixup_cd.dat
     |   +-- fixup.dat
-    |   +-- start_cd.elf
     |   `-- start.elf
     `-- zImage
 
Signature · 1 line
1.9.1
#4 lore raw

PATCH v2 4/5 boards/raspberrypi: update readme with Device Tree instructions

In reply to Yann E. MORIN
---
 board/raspberrypi/readme.txt | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)
board/raspberrypi/readme.txt +27 -4
index a6d3dd4..725ad9d 100644
@@ -23,6 +23,10 @@ work on this defconfig:
 
   $ make raspberrypi_defconfig
 
+Alternatively, if you want to test support for the Device Tree:
+
+  $ make raspberrypi_dt_defconfig
+
 If you want to use a persistent rootfs, skip to "Build the rootfs", below.
 
 For a volatile rootfs, you have to slightly adjust the configuration:
@@ -51,16 +55,22 @@ Result of the build
 After building, you should obtain this tree:
 
     output/images/
-    +-- rootfs.tar
-    +-- rpi-firmware
+    +-- rootfs.tar                              [0]
+    +-- rpi-firmware/
+    |   +-- bcm2708-rpi-b.dtb                   [1]
+    |   +-- bcm2708-rpi-b-plus.dtb              [1]
     |   +-- bootcode.bin
     |   +-- config.txt
     |   +-- fixup.dat
     |   `-- start.elf
     `-- zImage
 
-Note for Volatile: rootfs.tar will only be there if you kept
-"tar the root filesystem" option selected in "Filesystem images".
+[0] Note for Volatile: rootfs.tar will only be there if you kept
+    "tar the root filesystem" option selected in "Filesystem images".
+
+[1] The DTBs (Device Tree Blobs) will only be present if you setup
+    Buildroot to install the DTBs from the rpi-firmware package, and
+    will only be used if your kernel has support for the Device Tree.
 
 Prepare you SDCard
 ==================
@@ -89,17 +99,30 @@ Install the binaries to the SDCard
 At the root of the boot partition, the RaspberryPi must find the following
 files:
 
+    * bcm2708-rpi-b.dtb         [2]
+    * bcm2708-rpi-b-plus.dtb    [2]
     * bootcode.bin
     * config.txt
     * fixup.dat
     * start.elf
     * zImage
 
+[2] Only needed if your kernel has support for the Device Tree.
+
 For example:
 
  $ cp output/images/rpi-firmware/* /mnt/mountpointboot
+
+If your kernel does *not* have support for the Device Tree, then install
+it with:
+
  $ cp output/images/zImage /mnt/mountpointboot
 
+If your kernel *does* have support for the Device Tree, then install it
+with:
+
+  $ ./output/host/usr/bin/mkknlimg output/images/zImage /mnt/mountpointboot/zImage
+
 Note: The kernel image file name is defined in config.txt like this:
 kernel=zImage
 
Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 5/5 configs: add a DT-enabled Raspberry Pi defconfig

In reply to Yann E. MORIN

This is an example of a Device-Tree-enabled Raspberry Pi defconfig.

We have to use a 3.18-based kernel for that, but there are a few limitations:

- we can not use the minimalist RPi defconfig bundled with the kernel, namely bcmrpi_quick_defconfig, because it is not DT-enabled, and sets CONFIG_ARM_PATCH_PHYS_VIRT to 'n', which prompts a value for CONFIG_PHYS_OFFSET, as it as no default for the bcm familly;

- we have to use the 'default' but bloated bcmrpi_defconfig, which makes for a very fat kernel with lots of modules, and takes ages to build;

- most importantly, the rpi-3.18.y branch is constantly rebased, so there is no guarantee that the sha1 I use today will still be usable in the long term. Using the name of hte branch is not better either.

To compensate for an already overly-long build time for such a minimalist system (18min 20s, as compared to 6min 30s when using bcmrpi_quick), I decided to use an external toolchain rather than build our own.

---
 configs/raspberrypi_dt_defconfig | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 configs/raspberrypi_dt_defconfig
configs/raspberrypi_dt_defconfig new file +12 -0
new file mode 100644
index 0000000..188ece9
@@ -0,0 +1,12 @@
+BR2_arm=y
+BR2_arm1176jzf_s=y
+BR2_TOOLCHAIN_EXTERNAL=y
+BR2_TARGET_GENERIC_GETTY_PORT="tty1"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="git://github.com/raspberrypi/linux.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="b9c9f8fc69aaba236169798c18dc1590fccf7acd"
+BR2_LINUX_KERNEL_DEFCONFIG="bcmrpi"
+BR2_LINUX_KERNEL_ZIMAGE=y
+BR2_PACKAGE_RPI_FIRMWARE=y
+BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTBS=y
Signature · 1 line
1.9.1
#6 lore raw

PATCH v2 5/5 configs: add a DT-enabled Raspberry Pi defconfig

Dear Yann E. MORIN,

Quoted 5 lines · Yann E. MORIN

- we can not use the minimalist RPi defconfig bundled with the kernel, namely bcmrpi_quick_defconfig, because it is not DT-enabled, and sets CONFIG_ARM_PATCH_PHYS_VIRT to 'n', which prompts a value for CONFIG_PHYS_OFFSET, as it as no default for the bcm familly;

Quoted 7 lines

- we have to use the 'default' but bloated bcmrpi_defconfig, which makes for a very fat kernel with lots of modules, and takes ages to build;

- most importantly, the rpi-3.18.y branch is constantly rebased, so there is no guarantee that the sha1 I use today will still be usable in the long term. Using the name of hte branch is not better either.

Well, you could alternatively decide to have a custom kernel defconfig in board/raspberrypi/, which would be the same as bcmrpi_quick, with just the modifications you need for DT. Sure it means it will have to be updated from time to time, but hopefully at some point in the future the official bcmrpi_quick defconfig will have DT support enabled.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#7 lore raw

PATCH v2 5/5 configs: add a DT-enabled Raspberry Pi defconfig

Hello,

Quoted 13 lines · Thomas Petazzoni
Quoted 5 lines

- we can not use the minimalist RPi defconfig bundled with the kernel, namely bcmrpi_quick_defconfig, because it is not DT-enabled, and sets CONFIG_ARM_PATCH_PHYS_VIRT to 'n', which prompts a value for CONFIG_PHYS_OFFSET, as it as no default for the bcm familly;

Quoted 7 lines

- we have to use the 'default' but bloated bcmrpi_defconfig, which makes for a very fat kernel with lots of modules, and takes ages to build;

- most importantly, the rpi-3.18.y branch is constantly rebased, so there is no guarantee that the sha1 I use today will still be usable in the long term. Using the name of hte branch is not better either.

Quoted 5 lines

Well, you could alternatively decide to have a custom kernel defconfig in board/raspberrypi/, which would be the same as bcmrpi_quick, with just the modifications you need for DT. Sure it means it will have to be updated from time to time, but hopefully at some point in the future the official bcmrpi_quick defconfig will have DT support enabled.

Another motivation would be to switch back to an internal toolchain. Using an external toolchain here is quite inefficient: for an ARMv6 such as the RPi, we will fallback to the CodeSourcery toolchain, which will generate ARMv5 soft-float code. Not nice for a VFP-using ARMv6.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#8 lore raw

v2 cover RPi: enable building a device-tree-enabled kernel (branch yem/rpi-dt)

In reply to Yann E. MORIN

Dear Yann E. MORIN,

Quoted 4 lines · Yann E. MORIN

Yann E. MORIN (5):
package/rpi-firmware: add DT-aware marking script package/rpi-firmware: install DTB blobs boards/raspberrypi: don't document non-existent files

Those ones applied. I just did a minor change on PATCH 2/5, to explain why we need to change the version when installing DTBs is enabled.

Quoted 2 lines

boards/raspberrypi: update readme with Device Tree instructions
configs: add a DT-enabled Raspberry Pi defconfig

For those ones, I'm waiting for your input on using a custom defconfig instead of a default one that is too big.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#9 lore raw

v2 cover RPi: enable building a device-tree-enabled kernel (branch yem/rpi-dt)

Thomas, All,

On 2015-01-10 12:23 +0100, Thomas Petazzoni spake thusly:

Quoted 9 lines · Yann E. MORIN
Quoted 5 lines

Yann E. MORIN (5):
package/rpi-firmware: add DT-aware marking script package/rpi-firmware: install DTB blobs boards/raspberrypi: don't document non-existent files

Those ones applied. I just did a minor change on PATCH 2/5, to explain why we need to change the version when installing DTBs is enabled.

Thanks! :-)

Quoted 5 lines
Quoted 2 lines

boards/raspberrypi: update readme with Device Tree instructions
configs: add a DT-enabled Raspberry Pi defconfig

For those ones, I'm waiting for your input on using a custom defconfig instead of a default one that is too big.

In fact, that's the way I originally went for; I do have such a minimalist defconfig, which is just bcmrpi_quick with DT enabled.

But then I thought that it would be easier to maintain usign the bundled defconfig, even though it is much bigger.

But if you prefer, I can just restore my minimalist defconfig before I respin.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'