summaryrefslogtreecommitdiffstats
path: root/external/meta-updater-raspberrypi/recipes-bsp
diff options
context:
space:
mode:
authorToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp>2020-03-30 09:24:26 +0900
committerToshikazuOhiwa <toshikazu_ohiwa@mail.toyota.co.jp>2020-03-30 09:24:26 +0900
commit5b80bfd7bffd4c20d80b7c70a7130529e9a755dd (patch)
treeb4bb18dcd1487dbf1ea8127e5671b7bb2eded033 /external/meta-updater-raspberrypi/recipes-bsp
parent706ad73eb02caf8532deaf5d38995bd258725cb8 (diff)
agl-basesystem
Diffstat (limited to 'external/meta-updater-raspberrypi/recipes-bsp')
-rw-r--r--external/meta-updater-raspberrypi/recipes-bsp/bootfiles/bcm2835-bootfiles.bbappend1
-rw-r--r--external/meta-updater-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend17
-rw-r--r--external/meta-updater-raspberrypi/recipes-bsp/u-boot-otascript/u-boot-otascript.bb28
-rw-r--r--external/meta-updater-raspberrypi/recipes-bsp/u-boot-otascript/u-boot-otascript/boot.scr3
-rw-r--r--external/meta-updater-raspberrypi/recipes-bsp/u-boot-otascript/u-boot-otascript/uEnv.txt21
-rw-r--r--external/meta-updater-raspberrypi/recipes-bsp/u-boot/files/0001-Enable-FIT-and-bootcount-on-RPi3.patch42
-rw-r--r--external/meta-updater-raspberrypi/recipes-bsp/u-boot/files/0001-Increase-rpi-BOOTM_LEN.patch24
-rw-r--r--external/meta-updater-raspberrypi/recipes-bsp/u-boot/files/0001-board-raspberrypi-add-serial-and-revision-to-the-dev.patch82
-rw-r--r--external/meta-updater-raspberrypi/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend9
-rw-r--r--external/meta-updater-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend7
10 files changed, 234 insertions, 0 deletions
diff --git a/external/meta-updater-raspberrypi/recipes-bsp/bootfiles/bcm2835-bootfiles.bbappend b/external/meta-updater-raspberrypi/recipes-bsp/bootfiles/bcm2835-bootfiles.bbappend
new file mode 100644
index 00000000..adb19c09
--- /dev/null
+++ b/external/meta-updater-raspberrypi/recipes-bsp/bootfiles/bcm2835-bootfiles.bbappend
@@ -0,0 +1 @@
+RDEPENDS_${PN}_append_sota += " u-boot-otascript"
diff --git a/external/meta-updater-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend b/external/meta-updater-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend
new file mode 100644
index 00000000..5073560f
--- /dev/null
+++ b/external/meta-updater-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend
@@ -0,0 +1,17 @@
+DISABLE_OVERSCAN = "1"
+
+do_deploy_append() {
+ if [ "${ENABLE_CMA}" = "1" ] && [ -n "${CMA_LWM}" ]; then
+ sed -i '/#cma_lwm/ c\cma_lwm=${CMA_LWM}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+ fi
+
+ if [ "${ENABLE_CMA}" = "1" ] && [ -n "${CMA_HWM}" ]; then
+ sed -i '/#cma_hwm/ c\cma_hwm=${CMA_HWM}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+ fi
+
+ echo "avoid_warnings=2" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+ echo "mask_gpu_interrupt0=0x400" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+ echo "dtparam=audio=on" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+}
+
+ENABLE_UART_raspberrypi3 = "1"
diff --git a/external/meta-updater-raspberrypi/recipes-bsp/u-boot-otascript/u-boot-otascript.bb b/external/meta-updater-raspberrypi/recipes-bsp/u-boot-otascript/u-boot-otascript.bb
new file mode 100644
index 00000000..4dceb27c
--- /dev/null
+++ b/external/meta-updater-raspberrypi/recipes-bsp/u-boot-otascript/u-boot-otascript.bb
@@ -0,0 +1,28 @@
+DESCRIPTION = "Boot script for launching OTA-enabled images on raspberrypi"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+DEPENDS = "u-boot-mkimage-native"
+
+PR = "r1"
+
+COMPATIBLE_MACHINE = "raspberrypi"
+
+SRC_URI = "file://boot.scr \
+ file://uEnv.txt"
+
+S = "${WORKDIR}"
+
+inherit deploy
+
+do_deploy() {
+ install -d ${DEPLOYDIR}/bcm2835-bootfiles
+
+ mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Ostree boot script" -d ${S}/boot.scr ${DEPLOYDIR}/bcm2835-bootfiles/boot.scr
+ install -m 0755 ${S}/uEnv.txt ${DEPLOYDIR}/bcm2835-bootfiles/uEnv.txt
+}
+
+addtask deploy before do_package after do_install
+do_deploy[dirs] += "${DEPLOYDIR}/bcm2835-bootfiles"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/external/meta-updater-raspberrypi/recipes-bsp/u-boot-otascript/u-boot-otascript/boot.scr b/external/meta-updater-raspberrypi/recipes-bsp/u-boot-otascript/u-boot-otascript/boot.scr
new file mode 100644
index 00000000..dc13f85b
--- /dev/null
+++ b/external/meta-updater-raspberrypi/recipes-bsp/u-boot-otascript/u-boot-otascript/boot.scr
@@ -0,0 +1,3 @@
+fatload mmc 0:1 $loadaddr /uEnv.txt
+env import -t $loadaddr $filesize
+run bootcmd
diff --git a/external/meta-updater-raspberrypi/recipes-bsp/u-boot-otascript/u-boot-otascript/uEnv.txt b/external/meta-updater-raspberrypi/recipes-bsp/u-boot-otascript/u-boot-otascript/uEnv.txt
new file mode 100644
index 00000000..436fe95f
--- /dev/null
+++ b/external/meta-updater-raspberrypi/recipes-bsp/u-boot-otascript/u-boot-otascript/uEnv.txt
@@ -0,0 +1,21 @@
+bootcmd_resetvars=setenv kernel_image; setenv bootargs; setenv kernel_image2; setenv bootargs2
+bootcmd_otenv=run bootcmd_resetvars; load mmc 0:2 $loadaddr /boot/loader/uEnv.txt; env import -t $loadaddr $filesize
+bootcmd_rollbackenv=setenv kernel_image ${kernel_image2}; setenv bootargs ${bootargs2}
+
+bootcmd_args=setenv bootargs "$bootargs $bootargs_fdt ostree_root=/dev/mmcblk0p2 root=/dev/ram0 rw rootwait rootdelay=2 ramdisk_size=8192 panic=1"
+
+bootcmd_getroot=setexpr ostree_root gsub "^.*ostree=([^ ]*).*$" "\\\\1" "${bootargs}";
+
+bootcmd_fitconf=run bootcmd_getroot; if test -e mmc 0:2 "${ostree_root}/usr/lib/fit_conf"; then load mmc 0:2 $loadaddr "${ostree_root}/usr/lib/fit_conf"; env import -t $loadaddr $filesize; fi
+
+bootcmd_load=load mmc 0:2 $ramdisk_addr_r "/boot"$kernel_image
+bootcmd_run=bootm "${ramdisk_addr_r}${fit_conf}"
+
+bootcmd_create_envfile=if test ! -e mmc 0:1 uboot.env; then saveenv; fi;
+
+bootlimit=3
+
+bootcmd=if test "${rollback}" = "1"; then run altbootcmd; else run bootcmd_create_envfile; run bootcmd_otenv; run bootcmd_args; run bootcmd_fitconf; run bootcmd_load; run bootcmd_run; if ! "${upgrade_available}" = "1"; then setenv upgrade_available 1; saveenv; fi; reset; fi
+
+bootcmd_set_rollback=if test ! "${rollback}" = "1"; then setenv rollback 1; setenv upgrade_available 0; saveenv; fi
+altbootcmd=run bootcmd_create_envfile; run bootcmd_otenv; run bootcmd_set_rollback; if test -n "${kernel_image2}"; then run bootcmd_rollbackenv; fi; run bootcmd_args; run bootcmd_fitconf; run bootcmd_load; run bootcmd_run; reset
diff --git a/external/meta-updater-raspberrypi/recipes-bsp/u-boot/files/0001-Enable-FIT-and-bootcount-on-RPi3.patch b/external/meta-updater-raspberrypi/recipes-bsp/u-boot/files/0001-Enable-FIT-and-bootcount-on-RPi3.patch
new file mode 100644
index 00000000..394f0ee6
--- /dev/null
+++ b/external/meta-updater-raspberrypi/recipes-bsp/u-boot/files/0001-Enable-FIT-and-bootcount-on-RPi3.patch
@@ -0,0 +1,42 @@
+From c849889cce23b41df45cfa4efd9fde8eb682195f Mon Sep 17 00:00:00 2001
+From: Laurent Bonnans <laurent.bonnans@here.com>
+Date: Wed, 5 Jun 2019 18:12:21 +0200
+Subject: [PATCH] Enable FIT and bootcount on RPi3
+
+---
+ configs/rpi_3_32b_defconfig | 6 ++++++
+ configs/rpi_3_defconfig | 6 ++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig
+index 9e142cae63..d5d32a202d 100644
+--- a/configs/rpi_3_32b_defconfig
++++ b/configs/rpi_3_32b_defconfig
+@@ -39,3 +39,9 @@ CONFIG_SYS_WHITE_ON_BLACK=y
+ CONFIG_CONSOLE_SCROLL_LINES=10
+ CONFIG_PHYS_TO_BUS=y
+ CONFIG_OF_LIBFDT_OVERLAY=y
++
++CONFIG_FIT=y
++CONFIG_FIT_VERBOSE=y
++
++CONFIG_BOOTCOUNT_LIMIT=y
++CONFIG_BOOTCOUNT_ENV=y
+diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig
+index f46e504497..80fb70119e 100644
+--- a/configs/rpi_3_defconfig
++++ b/configs/rpi_3_defconfig
+@@ -39,3 +39,9 @@ CONFIG_SYS_WHITE_ON_BLACK=y
+ CONFIG_CONSOLE_SCROLL_LINES=10
+ CONFIG_PHYS_TO_BUS=y
+ CONFIG_OF_LIBFDT_OVERLAY=y
++
++CONFIG_FIT=y
++CONFIG_FIT_VERBOSE=y
++
++CONFIG_BOOTCOUNT_LIMIT=y
++CONFIG_BOOTCOUNT_ENV=y
+--
+2.20.1
+
+
diff --git a/external/meta-updater-raspberrypi/recipes-bsp/u-boot/files/0001-Increase-rpi-BOOTM_LEN.patch b/external/meta-updater-raspberrypi/recipes-bsp/u-boot/files/0001-Increase-rpi-BOOTM_LEN.patch
new file mode 100644
index 00000000..1a6940e0
--- /dev/null
+++ b/external/meta-updater-raspberrypi/recipes-bsp/u-boot/files/0001-Increase-rpi-BOOTM_LEN.patch
@@ -0,0 +1,24 @@
+From a4a9b71ac4900fee8081c85c630d55e20b233a81 Mon Sep 17 00:00:00 2001
+From: Laurent Bonnans <laurent.bonnans@here.com>
+Date: Wed, 5 Jun 2019 19:22:01 +0200
+Subject: [PATCH] Increase rpi BOOTM_LEN
+
+---
+ include/configs/rpi.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/configs/rpi.h b/include/configs/rpi.h
+index a97550b732..4ce9b2f99e 100644
+--- a/include/configs/rpi.h
++++ b/include/configs/rpi.h
+@@ -56,6 +56,7 @@
+ #define CONFIG_SYS_MEMTEST_START 0x00100000
+ #define CONFIG_SYS_MEMTEST_END 0x00200000
+ #define CONFIG_LOADADDR 0x00200000
++#define CONFIG_SYS_BOOTM_LEN SZ_64M
+
+ /* Devices */
+ /* GPIO */
+--
+2.20.1
+
diff --git a/external/meta-updater-raspberrypi/recipes-bsp/u-boot/files/0001-board-raspberrypi-add-serial-and-revision-to-the-dev.patch b/external/meta-updater-raspberrypi/recipes-bsp/u-boot/files/0001-board-raspberrypi-add-serial-and-revision-to-the-dev.patch
new file mode 100644
index 00000000..44774c0e
--- /dev/null
+++ b/external/meta-updater-raspberrypi/recipes-bsp/u-boot/files/0001-board-raspberrypi-add-serial-and-revision-to-the-dev.patch
@@ -0,0 +1,82 @@
+From 86cc911aaa958fedf2ea9cb04b4af17f5357815d Mon Sep 17 00:00:00 2001
+From: Anton Gerasimov <anton.gerasimov@here.com>
+Date: Fri, 1 Feb 2019 14:39:48 +0100
+Subject: [PATCH] board: raspberrypi: add serial and revision to the device
+ tree
+
+Raspberry Pi bootloader adds this node to fdt, but if u-boot script
+doesn't reuse the tree provided by it, this information is lost.
+
+Revision and serial are displayed in /proc/cpuinfo after boot.
+
+Signed-off-by: Anton Gerasimov <anton.gerasimov@here.com>
+---
+ board/raspberrypi/rpi/rpi.c | 31 +++++++++++++++++++++++++++++--
+ 1 file changed, 29 insertions(+), 2 deletions(-)
+
+diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
+index 35f5939552..114178397e 100644
+--- a/board/raspberrypi/rpi/rpi.c
++++ b/board/raspberrypi/rpi/rpi.c
+@@ -241,6 +241,8 @@ static uint32_t rev_scheme;
+ static uint32_t rev_type;
+ static const struct rpi_model *model;
+
++uint64_t serial;
++
+ #ifdef CONFIG_ARM64
+ static struct mm_region bcm2837_mem_map[] = {
+ {
+@@ -384,8 +386,8 @@ static void set_serial_number(void)
+ return;
+ }
+
+- snprintf(serial_string, sizeof(serial_string), "%016" PRIx64,
+- msg->get_board_serial.body.resp.serial);
++ serial = msg->get_board_serial.body.resp.serial;
++ snprintf(serial_string, sizeof(serial_string), "%016" PRIx64, serial);
+ env_set("serial#", serial_string);
+ }
+
+@@ -478,6 +480,29 @@ void *board_fdt_blob_setup(void)
+ return (void *)fw_dtb_pointer;
+ }
+
++static int ft_add_revision_info(void *blob) {
++ int off;
++ int ret;
++
++ off = fdt_subnode_offset(blob, 0, "system");
++
++ if (off < 0) {
++ off = fdt_add_subnode(blob, 0, "system");
++ if (off < 0)
++ return -1;
++ }
++
++ ret = fdt_setprop_u64(blob, off, "linux,serial", serial);
++ if (ret < 0)
++ return -1;
++
++ ret = fdt_setprop_u32(blob, off, "linux,revision", revision);
++ if (ret < 0)
++ return -1;
++
++ return 0;
++}
++
+ int ft_board_setup(void *blob, bd_t *bd)
+ {
+ /*
+@@ -487,6 +512,8 @@ int ft_board_setup(void *blob, bd_t *bd)
+ */
+ lcd_dt_simplefb_add_node(blob);
+
++ ft_add_revision_info(blob);
++
+ #ifdef CONFIG_EFI_LOADER
+ /* Reserve the spin table */
+ efi_add_memory_map(0, 1, EFI_RESERVED_MEMORY_TYPE, 0);
+--
+2.17.1
+
diff --git a/external/meta-updater-raspberrypi/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend b/external/meta-updater-raspberrypi/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend
new file mode 100644
index 00000000..77649653
--- /dev/null
+++ b/external/meta-updater-raspberrypi/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend
@@ -0,0 +1,9 @@
+
+do_install_append () {
+
+ cat >${D}${sysconfdir}/fw_env.config <<EOF
+
+/mnt/bootpart/uboot.env 0x0000 0x4000
+
+EOF
+}
diff --git a/external/meta-updater-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend b/external/meta-updater-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend
new file mode 100644
index 00000000..32812600
--- /dev/null
+++ b/external/meta-updater-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend
@@ -0,0 +1,7 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI_append = " \
+ file://0001-Enable-FIT-and-bootcount-on-RPi3.patch \
+ file://0001-board-raspberrypi-add-serial-and-revision-to-the-dev.patch \
+ file://0001-Increase-rpi-BOOTM_LEN.patch \
+ "