aboutsummaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen3/recipes-bsp
diff options
context:
space:
mode:
authorDuy Dang <duy.dang.yw@renesas.com>2019-07-02 17:50:22 +0700
committerKhang Nguyen <khang.nguyen.xw@renesas.com>2019-07-11 07:53:35 +0700
commit0bfbca5f8ed25b044992ae9dee03b9198cab4ce1 (patch)
treec1001081457f518ef44957ddca0bf6aa7b82e294 /meta-rcar-gen3/recipes-bsp
parent4f0ba4d9bc8e63380ffce5513586b66d25c61334 (diff)
rcar-gen3: Add RAUC packages
This adds RAUC and the related packages: - Add sample keys and certificate. - Add support for Renesas boards. - Add rauc packagegroup. - Add rauc_enable_fw_set to enable writing to eMMC boot1 partition. - Backport u-boot-fw-utils v2108.09. - Add U-boot sample script for boot slot selection. To build RAUC packages with the current image, add IMAGE_INSTALL_append = " rauc-packagegroup" to local.conf. Change-Id: I0967280ba0571577a95ddb5c1a528411fb9ecbf6 Signed-off-by: Khang Nguyen <khang.nguyen.xw@renesas.com> Signed-off-by: Duy Dang <duy.dang.yw@renesas.com>
Diffstat (limited to 'meta-rcar-gen3/recipes-bsp')
-rw-r--r--meta-rcar-gen3/recipes-bsp/u-boot/u-boot-fw-utils_2018.09.bb50
-rw-r--r--meta-rcar-gen3/recipes-bsp/u-boot/u-boot-rauc-script.bb36
-rw-r--r--meta-rcar-gen3/recipes-bsp/u-boot/u-boot-rauc-script/rauc-ubootscript.txt50
3 files changed, 136 insertions, 0 deletions
diff --git a/meta-rcar-gen3/recipes-bsp/u-boot/u-boot-fw-utils_2018.09.bb b/meta-rcar-gen3/recipes-bsp/u-boot/u-boot-fw-utils_2018.09.bb
new file mode 100644
index 0000000..ebdad11
--- /dev/null
+++ b/meta-rcar-gen3/recipes-bsp/u-boot/u-boot-fw-utils_2018.09.bb
@@ -0,0 +1,50 @@
+require u-boot-common_${PV}.inc
+
+SUMMARY = "U-Boot bootloader fw_printenv/setenv utilities"
+
+UBOOT_URL = "git://github.com/renesas-rcar/u-boot.git"
+BRANCH = "v2018.09/rcar-3.9.3"
+
+SRC_URI = "${UBOOT_URL};branch=${BRANCH}"
+SRCREV = "2b858f59e82177c8aba621b26629d797db2b7cc7"
+PV = "2018.09"
+
+COMPATIBLE_MACHINE = "(salvator-x|ebisu|ulcb)"
+DEPENDS = "mtd-utils"
+
+INSANE_SKIP_${PN} = "already-stripped"
+EXTRA_OEMAKE_class-target = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" V=1'
+EXTRA_OEMAKE_class-cross = 'HOSTCC="${CC} ${CFLAGS} ${LDFLAGS}" V=1'
+
+inherit uboot-config
+
+do_compile () {
+ oe_runmake ${UBOOT_MACHINE}
+ oe_runmake envtools
+}
+
+ENVADDR_h3ulcb = "/dev/mmcblk0boot1 0x07e0000 0x20000 0x20000"
+ENVADDR_m3ulcb = "/dev/mmcblk0boot1 0x07e0000 0x20000 0x20000"
+ENVADDR_m3nulcb = "/dev/mmcblk0boot1 0x1fc0000 0x20000 0x20000"
+
+do_install () {
+ install -d ${D}${base_sbindir}
+ install -d ${D}${sysconfdir}
+ install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_printenv
+ install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
+ install -m 0644 ${S}/tools/env/fw_env.config ${D}${sysconfdir}/fw_env.config
+ # Set the env address in emmc
+ sed 's|^/|#/|' -i ${D}${sysconfdir}/fw_env.config
+ echo ${ENVADDR} >> ${D}${sysconfdir}/fw_env.config
+}
+
+do_install_class-cross () {
+ install -d ${D}${bindir_cross}
+ install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_printenv
+ install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_setenv
+}
+
+SYSROOT_DIRS_append_class-cross = " ${bindir_cross}"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+BBCLASSEXTEND = "cross" \ No newline at end of file
diff --git a/meta-rcar-gen3/recipes-bsp/u-boot/u-boot-rauc-script.bb b/meta-rcar-gen3/recipes-bsp/u-boot/u-boot-rauc-script.bb
new file mode 100644
index 0000000..9a831f5
--- /dev/null
+++ b/meta-rcar-gen3/recipes-bsp/u-boot/u-boot-rauc-script.bb
@@ -0,0 +1,36 @@
+DESCRIPTION = "RAUC Sample U-Boot Script"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM := "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+COMPATIBLE_MACHINE = "(salvator-x|ebisu|ulcb)"
+
+S = "${WORKDIR}"
+
+SRC_URI = " \
+ file://rauc-ubootscript.txt \
+"
+
+DEPENDS += "u-boot-mkimage-native"
+
+DEVICE_TREE_h3ulcb = "r8a7795-h3ulcb.dtb"
+DEVICE_TREE_m3ulcb = "r8a7796-m3ulcb.dtb"
+DEVICE_TREE_m3nulcb = "r8a77965-m3nulcb.dtb"
+do_configure() {
+ sed "s/@DEVICE_TREE@/${DEVICE_TREE}/g" -i ${S}/rauc-ubootscript.txt
+}
+
+do_compile(){
+ mkimage -A arm -T script -C none -d ${S}/rauc-ubootscript.txt ${S}/rauc-ubootscript
+}
+
+do_install(){
+ install -d ${D}${sysconfdir}/rauc/
+ install -m 644 ${S}/rauc-ubootscript ${D}${sysconfdir}/rauc/rauc-ubootscript
+}
+
+RDEPENDS_${PN} = "rauc"
+PACKAGES = "${PN}"
+
+FILES_${PN} = " \
+ ${sysconfdir}/rauc/rauc-ubootscript \
+"
diff --git a/meta-rcar-gen3/recipes-bsp/u-boot/u-boot-rauc-script/rauc-ubootscript.txt b/meta-rcar-gen3/recipes-bsp/u-boot/u-boot-rauc-script/rauc-ubootscript.txt
new file mode 100644
index 0000000..025063c
--- /dev/null
+++ b/meta-rcar-gen3/recipes-bsp/u-boot/u-boot-rauc-script/rauc-ubootscript.txt
@@ -0,0 +1,50 @@
+test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "A B"
+test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3
+test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3
+
+# These for selecting rootfs
+setenv argsA 'rw root=/dev/mmcblk0p1'
+setenv argsB 'rw root=/dev/mmcblk0p2'
+# These for selecting kernel
+setenv kernel_A_par 1:1
+setenv kernel_B_par 1:2
+setenv kernel_par
+
+setenv bootargs
+
+for SLOT in ${BOOT_ORDER}; do
+ if test "x${bootargs}" != "x"; then
+ echo "Bootargs is set to: "$bootargs
+ else
+ if test "x${SLOT}" = "xA"; then
+ if test "${BOOT_A_LEFT}" -gt 0; then
+ echo "Slot ${SLOT} found. ${BOOT_A_LEFT} times remaining"
+ setenv bootargs ${argsA}
+ setenv kernel_par ${kernel_A_par}
+ setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1
+ else
+ echo "Slot ${SLOT} failed. Rolling back"
+ fi
+ elif test "x${SLOT}" = "xB"; then
+ if test "${BOOT_B_LEFT}" -gt 0; then
+ echo "Slot ${SLOT} found. ${BOOT_B_LEFT} times remaining"
+ setenv bootargs ${argsB}
+ setenv kernel_par ${kernel_B_par}
+ setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1
+ else
+ echo "Slot ${SLOT} failed. Rolling back"
+ fi
+ fi
+ fi
+done
+
+if test -n "${bootargs}"; then
+ setenv bootcmd 'ext4load mmc '$kernel_par' 0x48080000 /etc/rauc/rauc-ubootscript; source 0x48080000; ext4load mmc '$kernel_par' 0x48080000 /boot/Image; ext4load mmc '$kernel_par' 0x48000000 /boot/@DEVICE_TREE@; booti 0x48080000 - 0x48000000'
+ saveenv
+else
+ echo "No valid slot found, resetting tries to 3"
+ setenv BOOT_A_LEFT 3
+ setenv BOOT_B_LEFT 3
+ saveenv
+ reset
+fi