Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
meta-mender-raspberrypi: initial support for Raspberry Pi boards
Note that by aligning bootfiles layout to mender requirements, and that is that .dtb and Linux kernel should be in ${mender_uboot_root} we no longer support .dtb fixup by boot firmware. To further explain a bit, raspberrypis`s have a boot firmware that loads an image (Linux/u-boot) and .dtb file. DTB file is expected to be in ${mender_uboot_root} by boot firmware. Boot firmware parses a configuration (see [1]) file at start-up and applies some .dtb "patches" and DTB overlays depending on configuration. Above is acceptable since default configuration works just fine in most cases. Also see [2], regarding how "DTB patching" happens. [1]. https://github.com/Evilpaul/RPi-config/blob/master/config.txt [2]. raspberrypi/linux#1732 Signed-off-by: Mirza Krak <mirza.krak@gmail.com>
- Loading branch information
Showing
with
141 additions
and 0 deletions.
- +40 −0 meta-mender-raspberrypi/README.md
- +13 −0 meta-mender-raspberrypi/conf/layer.conf
- +10 −0 meta-mender-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend
- +8 −0 meta-mender-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/raspberrypi/boot.cmd
- +8 −0 meta-mender-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/raspberrypi0/boot.cmd
- +8 −0 meta-mender-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/raspberrypi2/boot.cmd
- +8 −0 meta-mender-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/raspberrypi3/boot.cmd
- +1 −0 meta-mender-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend
- +38 −0 ...ender-raspberrypi/recipes-bsp/u-boot/patches/0001-CONFIGS-rpi-enable-mender.io-requirements.patch
- +1 −0 meta-mender-raspberrypi/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend
- +5 −0 meta-mender-raspberrypi/recipes-bsp/u-boot/u-boot-raspberrypi.inc
- +1 −0 meta-mender-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend
@@ -0,0 +1,40 @@ | ||
# meta-mender-raspberrypi | ||
|
||
This Yocto layers contains recipes which enables support of building Mender client for Raspberry Pi boards. | ||
|
||
**NOTE!**. To be able to support update of Linux kernel and DTB these are installed to `/boot` on rootfs. This breaks support of user configurations based on `config.txt` because the Raspberry Pi boot firmware requires that the DTB file is in the same partition as the boot firmware files (mmcblk0p1). Boot firmware normally patches the DTB file based on configurations in `config.txt`. | ||
|
||
Above should not pose any problems if you do not require any changes in `config.txt` and the default configuration certainly is enough to run Mender client. | ||
|
||
## Dependencies | ||
|
||
This layer depends on: | ||
|
||
URI: git://git.yoctoproject.org/meta-raspberrypi | ||
branch: master | ||
revision: HEAD | ||
|
||
in addition to `meta-mender` dependencies. | ||
|
||
## Build instructions | ||
|
||
- Read [the Mender documentation on Building a Mender Yocto image](https://docs.mender.io/Artifacts/Building-Mender-Yocto-image) for Mender specific configuration. | ||
- Set MACHINE to one of the following | ||
- raspberrypi | ||
- raspberrypi0 | ||
- raspberrypi2 | ||
- raspberrypi3 | ||
- Add following to your local.conf (including configuration required by meta-mender-core) | ||
|
||
KERNEL_IMAGETYPE = "uImage" | ||
|
||
MENDER_PARTITION_ALIGNMENT_MB = "4" | ||
MENDER_BOOT_PART_SIZE_MB = "40" | ||
|
||
IMAGE_DEPENDS_sdimg += " bcm2835-bootfiles" | ||
|
||
# raspberrypi files aligned with mender layout requirements | ||
IMAGE_BOOT_FILES_append = " boot.scr u-boot.bin;${SDIMG_KERNELIMAGE}" | ||
IMAGE_INSTALL_append = " kernel-image kernel-devicetree" | ||
|
||
- Run `bitbake <image name>` |
@@ -0,0 +1,13 @@ | ||
# Board specific layer configuration for meta-mender | ||
# Copyright 2016 Mirza Krak | ||
|
||
# We have a conf and classes directory, add to BBPATH | ||
BBPATH .= ":${LAYERDIR}" | ||
|
||
# We have recipes-* directories, add to BBFILES | ||
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ | ||
${LAYERDIR}/recipes-*/*/*.bbappend" | ||
|
||
BBFILE_COLLECTIONS += "mender-raspberrypi" | ||
BBFILE_PATTERN_mender-raspberrypi = "^${LAYERDIR}/" | ||
BBFILE_PRIORITY_mender-raspberrypi = "6" |
@@ -0,0 +1,10 @@ | ||
|
||
do_deploy_append() { | ||
# Recently the default clock rate for uart changed to 48 MHz. This is | ||
# setup by boot firmware. This update has not been aligned in u-boot nor in | ||
# Linux yet. | ||
# | ||
# Override the default with the previous default which is 3 MHz. This | ||
# workaround can be dropped once the configuration aligns upstream. | ||
sed -i '/#init_uart_clock/ c\init_uart_clock=3000000' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt | ||
} |
@@ -0,0 +1,8 @@ | ||
run mender_setup | ||
setenv fdtfile bcm2708-rpi-b.dtb | ||
setenv bootargs earlyprintk console=tty0 console=ttyAMA0 root=${mender_kernel_root} rootfstype=ext4 rootwait noinitrd | ||
mmc dev ${mender_uboot_dev} | ||
load ${mender_uboot_root} ${kernel_addr_r} /boot/uImage | ||
load ${mender_uboot_root} ${fdt_addr_r} /boot/${fdtfile} | ||
bootm ${kernel_addr_r} - ${fdt_addr_r} | ||
run mender_try_to_recover |
@@ -0,0 +1,8 @@ | ||
run mender_setup | ||
setenv fdtfile bcm2708-rpi-b.dtb | ||
setenv bootargs earlyprintk console=tty0 console=ttyAMA0 root=${mender_kernel_root} rootfstype=ext4 rootwait noinitrd | ||
mmc dev ${mender_uboot_dev} | ||
load ${mender_uboot_root} ${kernel_addr_r} /boot/uImage | ||
load ${mender_uboot_root} ${fdt_addr_r} /boot/${fdtfile} | ||
bootm ${kernel_addr_r} - ${fdt_addr_r} | ||
run mender_try_to_recover |
@@ -0,0 +1,8 @@ | ||
run mender_setup | ||
setenv fdtfile bcm2709-rpi-2-b.dtb | ||
setenv bootargs earlyprintk console=tty0 console=ttyAMA0 root=${mender_kernel_root} rootfstype=ext4 rootwait noinitrd | ||
mmc dev ${mender_uboot_dev} | ||
load ${mender_uboot_root} ${kernel_addr_r} /boot/uImage | ||
load ${mender_uboot_root} ${fdt_addr_r} /boot/${fdtfile} | ||
bootm ${kernel_addr_r} - ${fdt_addr_r} | ||
run mender_try_to_recover |
@@ -0,0 +1,8 @@ | ||
run mender_setup | ||
setenv fdtfile bcm2710-rpi-3-b.dtb | ||
setenv bootargs earlyprintk console=tty0 console=ttyAMA0 root=${mender_kernel_root} rootfstype=ext4 rootwait noinitrd | ||
mmc dev ${mender_uboot_dev} | ||
load ${mender_uboot_root} ${kernel_addr_r} /boot/uImage | ||
load ${mender_uboot_root} ${fdt_addr_r} /boot/${fdtfile} | ||
bootm ${kernel_addr_r} - ${fdt_addr_r} | ||
run mender_try_to_recover |
@@ -0,0 +1 @@ | ||
FILESEXTRAPATHS_prepend_rpi := "${THISDIR}/files:" |
@@ -0,0 +1,38 @@ | ||
From 3267334937464b9c84b812f20fb12cab8b8dd0d5 Mon Sep 17 00:00:00 2001 | ||
From: Mirza Krak <mirza.krak@gmail.com> | ||
Date: Sun, 30 Oct 2016 21:39:10 +0100 | ||
Subject: [PATCH 1/1] CONFIGS: rpi: enable mender.io requirements | ||
|
||
Which are CONFIG_BOOTCOUNT_ENV and CONFIG_BOOTCOUNT_LIMIT. | ||
|
||
Mender.io also requires that FAT_ENV_INTERFACE, FAT_ENV_DEVICE_AND_PART | ||
and FAT_ENV_FILE are not present in the configuration. | ||
--- | ||
include/configs/rpi-common.h | 5 ++--- | ||
1 file changed, 2 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/include/configs/rpi-common.h b/include/configs/rpi-common.h | ||
index 2c3b026..505a2fe 100644 | ||
--- a/include/configs/rpi-common.h | ||
+++ b/include/configs/rpi-common.h | ||
@@ -107,15 +107,14 @@ | ||
/* Environment */ | ||
#define CONFIG_ENV_SIZE SZ_16K | ||
#define CONFIG_ENV_IS_IN_FAT | ||
-#define FAT_ENV_INTERFACE "mmc" | ||
-#define FAT_ENV_DEVICE_AND_PART "0:1" | ||
-#define FAT_ENV_FILE "uboot.env" | ||
#define CONFIG_FAT_WRITE | ||
#define CONFIG_ENV_VARS_UBOOT_CONFIG | ||
#define CONFIG_SYS_LOAD_ADDR 0x1000000 | ||
#define CONFIG_CONSOLE_MUX | ||
#define CONFIG_SYS_CONSOLE_IS_IN_ENV | ||
#define CONFIG_PREBOOT "usb start" | ||
+#define CONFIG_BOOTCOUNT_ENV | ||
+#define CONFIG_BOOTCOUNT_LIMIT | ||
|
||
/* Shell */ | ||
#define CONFIG_SYS_MAXARGS 16 | ||
-- | ||
2.1.4 | ||
|
@@ -0,0 +1 @@ | ||
require u-boot-raspberrypi.inc |
@@ -0,0 +1,5 @@ | ||
FILESEXTRAPATHS_prepend_rpi := "${THISDIR}/patches:" | ||
|
||
BOOTENV_SIZE_rpi ?= "0x4000" | ||
|
||
SRC_URI_append_rpi = " file://0001-CONFIGS-rpi-enable-mender.io-requirements.patch" |
@@ -0,0 +1 @@ | ||
require u-boot-raspberrypi.inc |