Skip to contentSkip to conversation

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

PATCH New Yann E. MORIN 2 participants 4 messages Jan 10, 2015 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

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

Hello All!

This series completes support for a Device-Tree-enabled Raspberry Pi:
- introduce a new defconfig file,
- update the board documentation.

Changes v2 -> v3:
- bundle our own Linux defconfig (Thomas)
- build our own toolchain (Thomas)
- drop patches already applied (Thomas)

Regards,
Yann E. MORIN.

The following changes since commit 0ae1ab3ed51ff2368767b4d8b163a5da7011a8b4:

openntpd: bump to version 5.7p1 (2015-01-10 13:17:38 +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 8a8fae5cc4323365edbf7c8e7ceb98e76ac547ef:

boards/raspberrypi: update readme with Device Tree instructions (2015-01-10 13:48:31 +0100)

----------------------------------------------------------------
Yann E. MORIN (2):
configs: add a DT-enabled Raspberry Pi defconfig boards/raspberrypi: update readme with Device Tree instructions

 board/raspberrypi/linux-3.18-rpi-dt.defconfig | 204 ++++++++++++++++++++++++++
 board/raspberrypi/readme.txt                  |  31 +++-
 configs/raspberrypi_dt_defconfig              |  12 ++
 3 files changed, 243 insertions(+), 4 deletions(-)
 create mode 100644 board/raspberrypi/linux-3.18-rpi-dt.defconfig
 create mode 100644 configs/raspberrypi_dt_defconfig
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 v3 1/2 configs: add a DT-enabled Raspberry Pi defconfig

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;

- 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.

So, we bundle our own DT-enabled linux defconfig that is based on bcmrpi_quick_defconfig, with just CONFIG_ARM_PATCH_PHYS_VIRT set and the Device TRee enabled.

---
 board/raspberrypi/linux-3.18-rpi-dt.defconfig | 204 ++++++++++++++++++++++++++
 configs/raspberrypi_dt_defconfig              |  12 ++
 2 files changed, 216 insertions(+)
 create mode 100644 board/raspberrypi/linux-3.18-rpi-dt.defconfig
 create mode 100644 configs/raspberrypi_dt_defconfig
board/raspberrypi/linux-3.18-rpi-dt.defconfig new file +204 -0
new file mode 100644
index 0000000..69c0fa3
@@ -0,0 +1,204 @@
+# CONFIG_LOCALVERSION_AUTO is not set
+CONFIG_KERNEL_XZ=y
+# CONFIG_SWAP is not set
+CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_FHANDLE=y
+CONFIG_NO_HZ_IDLE=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_IKCONFIG=m
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=21
+# CONFIG_UTS_NS is not set
+# CONFIG_IPC_NS is not set
+# CONFIG_PID_NS is not set
+# CONFIG_NET_NS is not set
+CONFIG_RELAY=y
+# CONFIG_COMPAT_BRK is not set
+CONFIG_JUMP_LABEL=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+CONFIG_ARCH_BCM2708=y
+CONFIG_BCM2708_DT=y
+CONFIG_PREEMPT=y
+CONFIG_AEABI=y
+CONFIG_KSM=y
+CONFIG_UACCESS_WITH_MEMCPY=y
+# CONFIG_ATAGS is not set
+CONFIG_KEXEC=y
+CONFIG_AUTO_ZRELADDR=y
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_STAT=m
+CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=m
+CONFIG_CPU_FREQ_GOV_USERSPACE=m
+CONFIG_CPU_FREQ_GOV_ONDEMAND=m
+CONFIG_VFP=y
+CONFIG_BINFMT_MISC=m
+# CONFIG_SUSPEND is not set
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_PACKET_DIAG=m
+CONFIG_UNIX=y
+CONFIG_UNIX_DIAG=m
+CONFIG_INET=y
+CONFIG_SYN_COOKIES=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+CONFIG_INET_DIAG=m
+CONFIG_INET_UDP_DIAG=m
+# CONFIG_IPV6 is not set
+CONFIG_NETLINK_DIAG=y
+CONFIG_BPF_JIT=y
+# CONFIG_WIRELESS is not set
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+# CONFIG_FIRMWARE_IN_KERNEL is not set
+CONFIG_CONNECTOR=y
+CONFIG_BLK_DEV_LOOP=m
+CONFIG_BLK_DEV_RAM=m
+CONFIG_SCSI=m
+# CONFIG_SCSI_PROC_FS is not set
+CONFIG_BLK_DEV_SD=m
+# CONFIG_SCSI_LOWLEVEL is not set
+CONFIG_NETDEVICES=y
+CONFIG_DUMMY=m
+# CONFIG_ETHERNET is not set
+CONFIG_USB_USBNET=m
+# CONFIG_USB_NET_AX8817X is not set
+# CONFIG_USB_NET_AX88179_178A is not set
+# CONFIG_USB_NET_CDCETHER is not set
+# CONFIG_USB_NET_CDC_NCM is not set
+CONFIG_USB_NET_SMSC95XX=m
+# CONFIG_USB_NET_NET1080 is not set
+# CONFIG_USB_NET_CDC_SUBSET is not set
+# CONFIG_USB_NET_ZAURUS is not set
+# CONFIG_WLAN is not set
+CONFIG_INPUT_SPARSEKMAP=m
+CONFIG_INPUT_EVDEV=m
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
+CONFIG_HW_RANDOM_BCM2708=m
+CONFIG_I2C=m
+CONFIG_I2C_CHARDEV=m
+CONFIG_I2C_BCM2835=m
+CONFIG_I2C_BCM2708=m
+CONFIG_SPI=y
+CONFIG_SPI_BCM2835=m
+CONFIG_SPI_BCM2708=m
+CONFIG_SPI_BITBANG=m
+CONFIG_GPIO_SYSFS=y
+CONFIG_GPIO_GENERIC_PLATFORM=y
+# CONFIG_HWMON is not set
+CONFIG_THERMAL=y
+CONFIG_THERMAL_BCM2835=y
+CONFIG_WATCHDOG=y
+CONFIG_SOFT_WATCHDOG=m
+CONFIG_BCM2708_WDT=m
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=m
+CONFIG_REGULATOR_USERSPACE_CONSUMER=m
+CONFIG_FB=y
+CONFIG_FIRMWARE_EDID=y
+CONFIG_FB_MODE_HELPERS=y
+CONFIG_FB_BCM2708=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+# CONFIG_LOGO_LINUX_VGA16 is not set
+CONFIG_SOUND=m
+CONFIG_SND=m
+CONFIG_SND_SEQUENCER=m
+CONFIG_SND_SEQ_DUMMY=m
+CONFIG_SND_MIXER_OSS=m
+CONFIG_SND_PCM_OSS=m
+CONFIG_SND_SEQUENCER_OSS=y
+CONFIG_SND_HRTIMER=m
+# CONFIG_SND_SUPPORT_OLD_API is not set
+CONFIG_SND_DUMMY=m
+CONFIG_SND_BCM2835=m
+# CONFIG_SND_SPI is not set
+CONFIG_SND_USB_AUDIO=m
+CONFIG_HIDRAW=y
+CONFIG_UHID=y
+CONFIG_HID_PID=y
+CONFIG_USB_HIDDEV=y
+CONFIG_USB=y
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+CONFIG_USB_DYNAMIC_MINORS=y
+CONFIG_USB_DWCOTG=y
+CONFIG_USB_STORAGE=m
+CONFIG_USB_STORAGE_REALTEK=m
+CONFIG_USB_STORAGE_DATAFAB=m
+CONFIG_USB_STORAGE_FREECOM=m
+CONFIG_USB_STORAGE_ISD200=m
+CONFIG_USB_STORAGE_USBAT=m
+CONFIG_USB_STORAGE_SDDR09=m
+CONFIG_USB_STORAGE_SDDR55=m
+CONFIG_USB_STORAGE_JUMPSHOT=m
+CONFIG_USB_STORAGE_ALAUDA=m
+CONFIG_USB_STORAGE_ONETOUCH=m
+CONFIG_USB_STORAGE_KARMA=m
+CONFIG_USB_STORAGE_CYPRESS_ATACB=m
+CONFIG_USB_STORAGE_ENE_UB6250=m
+CONFIG_MMC=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_PLTFM=y
+CONFIG_MMC_BCM2835=y
+CONFIG_MMC_BCM2835_DMA=y
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_GPIO=m
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_TIMER=m
+CONFIG_LEDS_TRIGGER_ONESHOT=m
+CONFIG_LEDS_TRIGGER_HEARTBEAT=m
+CONFIG_LEDS_TRIGGER_BACKLIGHT=m
+CONFIG_LEDS_TRIGGER_CPU=y
+CONFIG_LEDS_TRIGGER_GPIO=m
+CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
+CONFIG_LEDS_TRIGGER_TRANSIENT=m
+CONFIG_LEDS_TRIGGER_CAMERA=m
+# CONFIG_IOMMU_SUPPORT is not set
+CONFIG_EXT2_FS=m
+CONFIG_EXT3_FS=m
+# CONFIG_EXT3_FS_XATTR is not set
+CONFIG_EXT4_FS=y
+CONFIG_FANOTIFY=y
+CONFIG_MSDOS_FS=m
+CONFIG_VFAT_FS=m
+CONFIG_FAT_DEFAULT_CODEPAGE=850
+CONFIG_FAT_DEFAULT_IOCHARSET="utf8"
+CONFIG_TMPFS=y
+CONFIG_TMPFS_POSIX_ACL=y
+CONFIG_CONFIGFS_FS=m
+# CONFIG_MISC_FILESYSTEMS is not set
+# CONFIG_NETWORK_FILESYSTEMS is not set
+CONFIG_NLS_DEFAULT="utf8"
+CONFIG_NLS_CODEPAGE_437=m
+CONFIG_NLS_CODEPAGE_850=m
+CONFIG_NLS_ASCII=m
+CONFIG_NLS_ISO8859_1=m
+CONFIG_NLS_ISO8859_15=m
+CONFIG_NLS_UTF8=m
+CONFIG_PRINTK_TIME=y
+CONFIG_STRIP_ASM_SYMS=y
+CONFIG_PANIC_ON_OOPS=y
+# CONFIG_RCU_CPU_STALL_VERBOSE is not set
+CONFIG_STRICT_DEVMEM=y
+CONFIG_DEBUG_USER=y
+CONFIG_CRYPTO_MANAGER=m
+# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
+CONFIG_CRYPTO_NULL=m
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+# CONFIG_CRYPTO_HW is not set
configs/raspberrypi_dt_defconfig new file +12 -0
new file mode 100644
index 0000000..956b215
@@ -0,0 +1,12 @@
+BR2_arm=y
+BR2_arm1176jzf_s=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_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/raspberrypi/linux-3.18-rpi-dt.defconfig"
+BR2_LINUX_KERNEL_ZIMAGE=y
+BR2_PACKAGE_RPI_FIRMWARE=y
+BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTBS=y
Signature · 1 line
1.9.1
#2 lore raw

PATCH v3 2/2 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
#3 lore raw

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

In reply to Yann E. MORIN

Dear Yann E. MORIN,

Quoted 3 lines · Yann E. MORIN

Yann E. MORIN (2):
configs: add a DT-enabled Raspberry Pi defconfig boards/raspberrypi: update readme with Device Tree instructions

Thanks, both applied.

Ultimately, it'd be great to have one single configuration, but we'll see when that becomes possible.

Thanks,

Thomas

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