aboutsummaryrefslogtreecommitdiffstats
path: root/meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr
diff options
context:
space:
mode:
authorLeonid Lazarev <leonid.lazarev@mera.com>2020-05-15 11:51:48 +0300
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2020-05-26 17:12:19 +0000
commit4028c726be78adc1f1df3708dbe99f9eb2303790 (patch)
treea612c618ec8689bd785e816582116c4cf81cc681 /meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr
parent30063de420b4f6c993dd3f2021ab84f622d69320 (diff)
Raspberry 4: XEN support
Added the support for DOM0 in raspberry pi4. The feature agl-virt-xen should be enabled to activate this code. 1512 MB of memory is used for DOM0 machine. There are limitations: - brcmfmac module disabled (bluethooth and Wifi) due to the crash - total_memory is set to the 3Gb, as it impacts the USB ports on rasbperry pi4 on Linux kernel 4.19 v2 (jsmoeller): make changes in virtualization-layer conditional to raspberrypi4 Bug-AGL: SPEC-3259 Change-Id: I873fbf1f5498e31ae5f468407502f16e1873f7fc Signed-off-by: Leonid Lazarev <leonid.lazarev@mera.com> Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org> Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/24522 Tested-by: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-build: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-boot-test: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
Diffstat (limited to 'meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr')
-rw-r--r--meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot_xen.cmd45
-rw-r--r--meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend18
2 files changed, 63 insertions, 0 deletions
diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot_xen.cmd b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot_xen.cmd
new file mode 100644
index 000000000..24cfb1658
--- /dev/null
+++ b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot_xen.cmd
@@ -0,0 +1,45 @@
+#
+# SPDX-License-Identifier: MIT
+#
+# Copyright (c) 2020, MERA
+#
+# Author: Leonid Lazarev
+#
+# Xen Boot Script
+#
+# https://www.raspberrypi.org/documentation/configuration/device-tree.md
+# We do not set fdt_addr, because device tree initially is loaded by raspberry pi firmware loader and the particular
+# modification are performed. The prepared DTS is propagated to u-boot and this prepared device tree has to be reused.
+
+setenv kernel_addr_r 0x00480000 # 16M
+setenv xen_addr_r 0x00200000 # 2M
+
+# Load xen to ${xen_addr_r}.
+fatload mmc 0:1 ${xen_addr_r} /xen-@@MACHINE@@
+
+#configure dom0
+fdt addr ${fdt_addr}
+
+#read prepared bootargs, rapsberry pi prepared initial list of the parameters for loading
+fdt get value bootargs /chosen bootargs
+fdt resize 8192
+
+# add device type for raspberry
+fdt set pcie0 device_type "pci"
+
+fdt chosen
+fdt set /chosen \#address-cells <1>
+fdt set /chosen \#size-cells <1>
+
+# Load Linux Image to ${kernel_addr_r}
+fatload mmc 0:1 ${kernel_addr_r} /@@KERNEL_IMAGETYPE@@
+
+# we load dom0 with 1512 MB of memory
+fdt mknod /chosen dom0
+fdt set /chosen xen,xen-bootargs "console=dtuart dtuart=/soc/serial@7e215040 sync_console dom0_mem=1512M bootscrub=0"
+fdt set /chosen xen,dom0-bootargs "${bootargs}"
+
+fdt set /chosen/dom0 compatible "xen,linux-zimage", "xen,multiboot-module"
+fdt set /chosen/dom0 reg <${kernel_addr_r} 0x${filesize} >
+
+@@KERNEL_BOOTCMD@@ ${xen_addr_r} - ${fdt_addr}
diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend
new file mode 100644
index 000000000..2437d9a84
--- /dev/null
+++ b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend
@@ -0,0 +1,18 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI_append =" \
+ ${@bb.utils.contains('AGL_XEN_WANTED','1',' file://boot_xen.cmd','',d)} \
+"
+
+do_compile_append() {
+
+ # if xen feature is activated we overwirte the boot script with xen specific one
+ if [ "${AGL_XEN_WANTED}" = "1" ]; then
+ sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \
+ -e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \
+ -e 's/@@MACHINE@@/${MACHINE}/' \
+ "${WORKDIR}/boot_xen.cmd" > "${WORKDIR}/boot.cmd"
+
+ mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr
+ fi
+} \ No newline at end of file