diff options
Diffstat (limited to 'recipes-bsp')
16 files changed, 396 insertions, 91 deletions
diff --git a/recipes-bsp/bootfiles/rpi-bootfiles.bb b/recipes-bsp/bootfiles/rpi-bootfiles.bb index f1248ee..b04f24b 100644 --- a/recipes-bsp/bootfiles/rpi-bootfiles.bb +++ b/recipes-bsp/bootfiles/rpi-bootfiles.bb @@ -5,7 +5,16 @@ LIC_FILES_CHKSUM = "file://LICENCE.broadcom;md5=c403841ff2837657b2ed8e5bb474ac8d inherit deploy nopackages -include recipes-bsp/common/raspberrypi-firmware.inc +RPIFW_DATE ?= "20240319" +SRCREV = "9f24f4bc2bdd07ffd158cfbb4bce88a2efc4c1f5" +SHORTREV = "${@d.getVar("SRCREV", False).__str__()[:7]}" +RPIFW_SRC_URI ?= "https://api.github.com/repos/raspberrypi/firmware/tarball/9f24f4bc2bdd07ffd158cfbb4bce88a2efc4c1f5;downloadfilename=raspberrypi-firmware-${SHORTREV}.tar.gz" +RPIFW_S ?= "${WORKDIR}/raspberrypi-firmware-${SHORTREV}" + +SRC_URI = "${RPIFW_SRC_URI}" +SRC_URI[sha256sum] = "4b436f8946b139c6a1202375ef55d4848e3bcd8c1a9cb47000e06d7ecec828f7" + +PV = "${RPIFW_DATE}" INHIBIT_DEFAULT_DEPS = "1" diff --git a/recipes-bsp/bootfiles/rpi-cmdline.bb b/recipes-bsp/bootfiles/rpi-cmdline.bb index 40a9949..461934b 100644 --- a/recipes-bsp/bootfiles/rpi-cmdline.bb +++ b/recipes-bsp/bootfiles/rpi-cmdline.bb @@ -7,11 +7,13 @@ INHIBIT_DEFAULT_DEPS = "1" inherit deploy nopackages CMDLINE_DWC_OTG ?= "dwc_otg.lpm_enable=0" -CMDLINE_ROOTFS ?= "root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" -CMDLINE_SERIAL ?= "${@oe.utils.conditional("ENABLE_UART", "1", "console=serial0,115200", "", d)}" +CMDLINE_ROOT_FSTYPE ?= "rootfstype=ext4" +CMDLINE_ROOT_PARTITION ?= "/dev/mmcblk0p2" + +CMDLINE_ROOTFS ?= "root=${CMDLINE_ROOT_PARTITION} ${CMDLINE_ROOT_FSTYPE} rootwait" -CMDLINE_CMA ?= "${@oe.utils.conditional("RASPBERRYPI_CAMERA_V2", "1", "cma=64M", "", d)}" +CMDLINE_SERIAL ?= "${@oe.utils.conditional("ENABLE_UART", "1", "console=serial0,115200", "", d)}" CMDLINE_PITFT ?= "${@bb.utils.contains("MACHINE_FEATURES", "pitft", "fbcon=map:10 fbcon=font:VGA8x8", "", d)}" @@ -25,7 +27,30 @@ CMDLINE_LOGO ?= '${@oe.utils.conditional("DISABLE_RPI_BOOT_LOGO", "1", "logo.nol # to enable kernel debugging. CMDLINE_DEBUG ?= "" +# Add a request to isolate processors from the Linux scheduler. ISOLATED_CPUS +# may have the form of a comma separated list of processor numbers "0,1,3", a +# range "0-2", a combination of the two "0-1,3", or a single processor you may +# not specify ALL processors simultaneously +def setup_isolcpus(d): + string = "" + if d.getVar('ISOLATED_CPUS'): + string = 'isolcpus=' + d.getVar('ISOLATED_CPUS') + return string + +CMDLINE_ISOL_CPUS ?= "${@setup_isolcpus(d)}" + +# Add RNDIS capabilities (must be after rootwait) +# example: +# CMDLINE_RNDIS = "modules-load=dwc2,g_ether g_ether.host_addr=<some MAC +# address> g_ether.dev_addr=<some MAC address>" +# if the MAC addresses are omitted, random values will be used +CMDLINE_RNDIS ?= "" + +# That allows to keep the traditional network interface names +CMDLINE_IFNAMES ?= "net.ifnames=0" + CMDLINE = " \ + ${CMDLINE_ISOL_CPUS} \ ${CMDLINE_DWC_OTG} \ ${CMDLINE_SERIAL} \ ${CMDLINE_ROOTFS} \ @@ -34,10 +59,12 @@ CMDLINE = " \ ${CMDLINE_LOGO} \ ${CMDLINE_PITFT} \ ${CMDLINE_DEBUG} \ + ${CMDLINE_RNDIS} \ + ${CMDLINE_IFNAMES} \ " do_compile() { - echo "${@' '.join('${CMDLINE}'.split())}" > "${WORKDIR}/cmdline.txt" + echo "${@' '.join(d.getVar('CMDLINE').split())}" > "${WORKDIR}/cmdline.txt" } do_deploy() { @@ -47,3 +74,5 @@ do_deploy() { addtask deploy before do_build after do_install do_deploy[dirs] += "${DEPLOYDIR}/${BOOTFILES_DIR_NAME}" + +PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/recipes-bsp/bootfiles/rpi-config/0001-config.txt-reintroduce-start_x.patch b/recipes-bsp/bootfiles/rpi-config/0001-config.txt-reintroduce-start_x.patch new file mode 100644 index 0000000..c6c51c9 --- /dev/null +++ b/recipes-bsp/bootfiles/rpi-config/0001-config.txt-reintroduce-start_x.patch @@ -0,0 +1,55 @@ +From ce27f7e22b2cd7453a425e08780a338a71301961 Mon Sep 17 00:00:00 2001 +From: Leon Anavi <leon.anavi@konsulko.com> +Date: Mon, 20 Nov 2023 15:19:15 +0200 +Subject: [PATCH] config.txt: reintroduce start_x + +Reintroduce configuration "start_x". Based on the experience with +Yocto/OpenEmbedded layer meta-raspberrypi, it has been observed +that Raspberry Pi 4B 4GB may fail to enable the camera if +"start_x=1" is at the end of the file. Therefore, "start_x=1" +is expected in config.txt template and it has been set to replace +the original occurrence, which is at the middle of the file. +Also update revision and date stamp. + +GitHub pull request: https://github.com/Evilpaul/RPi-config/pull/8 + +Upstream-Status: Submitted + +Signed-off-by: Leon Anavi <leon.anavi@konsulko.com> +--- + config.txt | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/config.txt b/config.txt +index 1cf7b29..e28ed02 100644 +--- a/config.txt ++++ b/config.txt +@@ -1,7 +1,7 @@ + ################################################################################ + ## Raspberry Pi Configuration Settings + ## +-## Revision 17, 2021/08/15 ++## Revision 18, 2023/11/20 + ## + ## Details taken from the eLinux wiki and official Raspberry Pi documentation. + ## For up-to-date information please refer to links below. +@@ -760,6 +760,16 @@ + ## Camera Settings + ################################################################################ + ++## start_x ++## Set to "1" to enable the camera module. ++## ++## Enabling the camera requires gpu_mem option to be specified with a value ++## of at least 128. ++## ++## Default 0 ++## ++#start_x=0 ++ + ## disable_camera_led + ## Turn off the red camera led when recording video or taking a still + ## picture. +-- +2.39.2 + diff --git a/recipes-bsp/bootfiles/rpi-config_git.bb b/recipes-bsp/bootfiles/rpi-config_git.bb index de43c4b..b91668f 100644 --- a/recipes-bsp/bootfiles/rpi-config_git.bb +++ b/recipes-bsp/bootfiles/rpi-config_git.bb @@ -7,8 +7,9 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda COMPATIBLE_MACHINE = "^rpi$" -SRCREV = "648ffc470824c43eb0d16c485f4c24816b32cd6f" -SRC_URI = "git://github.com/Evilpaul/RPi-config.git;protocol=git;branch=master \ +SRCREV = "6ac2d832c6c3b208e2669f50ec1abf2c20cb7ff4" +SRC_URI = "git://github.com/Evilpaul/RPi-config.git;protocol=https;branch=master \ + file://0001-config.txt-reintroduce-start_x.patch \ " S = "${WORKDIR}/git" @@ -29,6 +30,14 @@ GPIO_IR ?= "18" GPIO_IR_TX ?= "17" CAN_OSCILLATOR ?= "16000000" +CAN0_INTERRUPT_PIN ?= "25" +CAN1_INTERRUPT_PIN ?= "24" + +ENABLE_UART ??= "" + +WM8960="${@bb.utils.contains("MACHINE_FEATURES", "wm8960", "1", "0", d)}" + +GPIO_SHUTDOWN_PIN ??= "" inherit deploy nopackages @@ -103,6 +112,9 @@ do_deploy() { if [ -n "${HDMI_MODE}" ]; then sed -i '/#hdmi_mode=/ c\hdmi_mode=${HDMI_MODE}' $CONFIG fi + if [ -n "${HDMI_CVT}" ]; then + echo 'hdmi_cvt=${HDMI_CVT}' >> $CONFIG + fi if [ -n "${CONFIG_HDMI_BOOST}" ]; then sed -i '/#config_hdmi_boost=/ c\config_hdmi_boost=${CONFIG_HDMI_BOOST}' $CONFIG fi @@ -118,10 +130,15 @@ do_deploy() { # Video camera support if [ "${VIDEO_CAMERA}" = "1" ]; then - # TODO: It has been observed that Raspberry Pi 4B 4GB may fail to enable the camera if "start_x=1" is at the end - # of the file. The underlying cause is unknown, but it can be related with a file size limitation affecting - # this variable. Therefore, "start_x=1" has been set to replace the original occurrence in config.txt, - # which is at the middle of the file. + # It has been observed that Raspberry Pi 4B 4GB may fail to enable the + # camera if "start_x=1" is at the end of the file. Therefore, + # "start_x=1" has been set to replace the original occurrence in + # config.txt, which is at the middle of the file. + # The exact underlying cause is unknown. There are similar issues + # reported in the raspberrypi/firware repo and the conclusion reached + # was that there could be a file size limitation affecting certain + # variables. It was commented that this limitation could be 4k but + # not proved. sed -i '/#start_x=/ c\start_x=1' $CONFIG fi @@ -164,9 +181,25 @@ do_deploy() { fi # UART support - if [ "${ENABLE_UART}" = "1" ]; then + if [ "${ENABLE_UART}" = "1" ] || [ "${ENABLE_UART}" = "0" ]; then echo "# Enable UART" >>$CONFIG - echo "enable_uart=1" >>$CONFIG + echo "enable_uart=${ENABLE_UART}" >>$CONFIG + elif [ -n "${ENABLE_UART}" ]; then + bbfatal "Invalid value for ENABLE_UART [${ENABLE_UART}]. The value for ENABLE_UART can be 0 or 1." + fi + + # U-Boot requires "enable_uart=1" for various boards to operate correctly + # cf https://source.denx.de/u-boot/u-boot/-/blob/v2023.04/arch/arm/mach-bcm283x/Kconfig?ref_type=tags#L65 + if [ "${RPI_USE_U_BOOT}" = "1" ] && [ "${ENABLE_UART}" != "1" ]; then + case "${UBOOT_MACHINE}" in + rpi_0_w_defconfig|rpi_3_32b_config|rpi_4_32b_config|rpi_arm64_config) + if [ "${ENABLE_UART}" = "0" ]; then + bbfatal "Invalid configuration: RPI_USE_U_BOOT requires to enable the UART in config.txt for ${MACHINE}" + fi + echo "# U-Boot requires UART" >>$CONFIG + echo "enable_uart=1" >>$CONFIG + ;; + esac fi # Infrared support @@ -184,10 +217,22 @@ do_deploy() { # Choose Camera Sensor to be used, default imx219 sensor if [ "${RASPBERRYPI_CAMERA_V2}" = "1" ]; then - echo "# Enable Sony RaspberryPi Camera" >> $CONFIG + echo "# Enable Sony RaspberryPi Camera(imx219)" >> $CONFIG echo "dtoverlay=imx219" >> $CONFIG fi + # Choose Camera Sensor to be used, default imx477 sensor + #if [ "${RASPBERRYPI_HD_CAMERA}" = "1" ]; then + # echo "# Enable Sony RaspberryPi Camera(imx477)" >> $CONFIG + # echo "dtoverlay=imx477" >> $CONFIG + #fi + + # Choose Camera Sensor to be used, default imx708 sensor + if [ "${RASPBERRYPI_CAMERA_V3}" = "1" ]; then + echo "# Enable Sony RaspberryPi Camera(imx708)" >> $CONFIG + echo "dtoverlay=imx708" >> $CONFIG + fi + # Waveshare "C" 1024x600 7" Rev2.1 IPS capacitive touch (http://www.waveshare.com/7inch-HDMI-LCD-C.htm) if [ "${WAVESHARE_1024X600_C_2_1}" = "1" ]; then echo "# Waveshare \"C\" 1024x600 7\" Rev2.1 IPS capacitive touch screen" >> $CONFIG @@ -199,7 +244,7 @@ do_deploy() { fi # DWC2 USB peripheral support - if [ "${ENABLE_DWC2_PERIPHERAL}" = "1" ]; then + if ([ "${ENABLE_DWC2_PERIPHERAL}" = "1" ] && [ "${ENABLE_DWC2_OTG}" != "1" ]); then echo "# Enable USB peripheral mode" >> $CONFIG echo "dtoverlay=dwc2,dr_mode=peripheral" >> $CONFIG fi @@ -209,6 +254,12 @@ do_deploy() { echo "# Enable USB host mode" >> $CONFIG echo "dtoverlay=dwc2,dr_mode=host" >> $CONFIG fi + + # DWC2 USB OTG support + if ([ "${ENABLE_DWC2_OTG}" = "1" ] && [ "${ENABLE_DWC2_PERIPHERAL}" != "1" ]); then + echo "# Enable USB OTG mode" >> $CONFIG + echo "dtoverlay=dwc2,dr_mode=otg" >> $CONFIG + fi # AT86RF23X support if [ "${ENABLE_AT86RF}" = "1" ]; then @@ -219,12 +270,28 @@ do_deploy() { # ENABLE DUAL CAN if [ "${ENABLE_DUAL_CAN}" = "1" ]; then echo "# Enable DUAL CAN" >>$CONFIG - echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=25" >>$CONFIG - echo "dtoverlay=mcp2515-can1,oscillator=${CAN_OSCILLATOR},interrupt=24" >>$CONFIG + echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=${CAN0_INTERRUPT_PIN}" >>$CONFIG + echo "dtoverlay=mcp2515-can1,oscillator=${CAN_OSCILLATOR},interrupt=${CAN1_INTERRUPT_PIN}" >>$CONFIG # ENABLE CAN elif [ "${ENABLE_CAN}" = "1" ]; then echo "# Enable CAN" >>$CONFIG - echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=25" >>$CONFIG + echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=${CAN0_INTERRUPT_PIN}" >>$CONFIG + fi + + + if [ "${ENABLE_GPIO_SHUTDOWN}" = "1" ]; then + if ([ "${ENABLE_I2C}" = "1" ] || [ "${PITFT}" = "1" ]) && [ -z "${GPIO_SHUTDOWN_PIN}" ]; then + # By default GPIO shutdown uses the same pin as the (master) I2C SCL. + # If I2C is configured and an alternative pin is not configured for + # gpio-shutdown, there is a configuration conflict. + bbfatal "I2C and gpio-shutdown are both enabled and using the same pins!" + fi + echo "# Enable gpio-shutdown" >> $CONFIG + if [ -z "${GPIO_SHUTDOWN_PIN}" ]; then + echo "dtoverlay=gpio-shutdown" >> $CONFIG + else + echo "dtoverlay=gpio-shutdown,gpio_pin=${GPIO_SHUTDOWN_PIN}" >> $CONFIG + fi fi # Append extra config if the user has provided any @@ -240,9 +307,28 @@ do_deploy() { ;; esac fi + + # WM8960 support + if [ "${WM8960}" = "1" ]; then + echo "# Enable WM8960" >> $CONFIG + echo "dtoverlay=wm8960-soundcard" >> $CONFIG + fi + + # W1-GPIO - One-Wire Interface + if [ "${ENABLE_W1}" = "1" ]; then + echo "# Enable One-Wire Interface" >> $CONFIG + echo "dtoverlay=w1-gpio" >> $CONFIG + fi + + # Reduce config.txt file size to avoid corruption and + # to boot successfully Raspberry Pi 5. The issue has + # been reported to related projects: + # https://github.com/raspberrypi/firmware/issues/1848 + # https://github.com/Evilpaul/RPi-config/issues/9 + sed -i '/^##/d' $CONFIG } -do_deploy_append_raspberrypi3-64() { +do_deploy:append:raspberrypi3-64() { echo "# have a properly sized image" >> $CONFIG echo "disable_overscan=1" >> $CONFIG @@ -250,6 +336,12 @@ do_deploy_append_raspberrypi3-64() { echo "dtparam=audio=on" >> $CONFIG } +do_deploy:append() { + if grep -q -E '^.{80}.$' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt; then + bbwarn "config.txt contains lines longer than 80 characters, this is not supported" + fi +} + addtask deploy before do_build after do_install do_deploy[dirs] += "${DEPLOYDIR}/${BOOTFILES_DIR_NAME}" diff --git a/recipes-bsp/common/raspberrypi-firmware.inc b/recipes-bsp/common/raspberrypi-firmware.inc index 591c615..311da21 100644 --- a/recipes-bsp/common/raspberrypi-firmware.inc +++ b/recipes-bsp/common/raspberrypi-firmware.inc @@ -1,9 +1,9 @@ -RPIFW_DATE ?= "20210205" -SRCREV ?= "7d91570f20378afc9414107dccdad70705a8a342" -RPIFW_SRC_URI ?= "https://github.com/raspberrypi/firmware/archive/${SRCREV}.tar.gz;downloadfilename=raspberrypi-firmware-${SRCREV}.tar.gz" -RPIFW_S ?= "${WORKDIR}/firmware-${SRCREV}" +RPIFW_DATE ?= "20230509~buster" + +RPIFW_SRC_URI ?= "https://archive.raspberrypi.com/debian/pool/main/r/raspberrypi-firmware/raspberrypi-firmware_1.${RPIFW_DATE}.orig.tar.xz" +RPIFW_S ?= "${WORKDIR}/raspberrypi-firmware-1.${RPIFW_DATE}" SRC_URI = "${RPIFW_SRC_URI}" -SRC_URI[sha256sum] = "2cc9bf2cbcab8283db2eb53ed2a49372b70fe76538994c32f6d261e2da3e9ff4" +SRC_URI[sha256sum] = "1d9eb83111826b708f461101766fd2000d45f1c171ad573936d000f623ca8098" PV = "${RPIFW_DATE}" diff --git a/recipes-bsp/common/raspberrypi-tools.inc b/recipes-bsp/common/raspberrypi-tools.inc index 7879c0a..c88e7e4 100644 --- a/recipes-bsp/common/raspberrypi-tools.inc +++ b/recipes-bsp/common/raspberrypi-tools.inc @@ -1,9 +1,11 @@ -RPITOOLS_DATE ?= "20201008" -SRCREV ?= "fc0e73c13865450e95edd046200e42a6e52d8256" -RPITOOLS_SRC_URI ?= "https://github.com/raspberrypi/tools/archive/${SRCREV}.tar.gz;downloadfilename=raspberrypi-tools-${SRCREV}.tar.gz" -RPITOOLS_S ?= "${WORKDIR}/tools-${SRCREV}" +RPITOOLS_DATE ?= "20220711" +SRCREV ?= "439b6198a9b340de5998dd14a26a0d9d38a6bcac" +RPITOOLS_SRC_URI ?= "git://github.com/raspberrypi/tools;protocol=https;branch=master" +RPITOOLS_S ?= "${WORKDIR}/git" SRC_URI = "${RPITOOLS_SRC_URI}" -SRC_URI[sha256sum] = "05217b942150830225e8ee04a8f16b8ecc2ffbbe5dd815541b15333f783e805e" PV = "${RPITOOLS_DATE}" + +BB_GIT_SHALLOW = "1" + diff --git a/recipes-bsp/formfactor/formfactor_%.bbappend b/recipes-bsp/formfactor/formfactor_%.bbappend index 72d991c..4fc41d0 100644 --- a/recipes-bsp/formfactor/formfactor_%.bbappend +++ b/recipes-bsp/formfactor/formfactor_%.bbappend @@ -1 +1 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" diff --git a/recipes-bsp/gpio-shutdown/files/bind_gpio_shutdown.tab b/recipes-bsp/gpio-shutdown/files/bind_gpio_shutdown.tab new file mode 100644 index 0000000..00cc485 --- /dev/null +++ b/recipes-bsp/gpio-shutdown/files/bind_gpio_shutdown.tab @@ -0,0 +1,2 @@ +# Action on special keypress (Key Power) +kb::kbrequest:/sbin/shutdown -t1 -a -h -P now diff --git a/recipes-bsp/gpio-shutdown/files/gpio-shutdown-keymap.sh b/recipes-bsp/gpio-shutdown/files/gpio-shutdown-keymap.sh new file mode 100644 index 0000000..bae50da --- /dev/null +++ b/recipes-bsp/gpio-shutdown/files/gpio-shutdown-keymap.sh @@ -0,0 +1,13 @@ +#!/bin/sh +## +# Bind the gpio-shutdown keycode as Keyboard signal and load it to the +# keymap during startup. +## +case "$1" in + start) + # Inject the gpio keycode to keymap + echo "keycode 116 = KeyboardSignal" | loadkeys + ;; + *) + ;; +esac diff --git a/recipes-bsp/gpio-shutdown/gpio-shutdown.bb b/recipes-bsp/gpio-shutdown/gpio-shutdown.bb new file mode 100644 index 0000000..77d9856 --- /dev/null +++ b/recipes-bsp/gpio-shutdown/gpio-shutdown.bb @@ -0,0 +1,31 @@ +SUMMARY = "GPIO shutdown bindings for SysV init" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" + +SRC_URI = "file://bind_gpio_shutdown.tab \ + file://gpio-shutdown-keymap.sh \ +" + +inherit update-rc.d + +INITSCRIPT_NAME = "gpio-shutdown-keymap.sh" +# Run only once during startup +INITSCRIPT_PARAMS = "start 99 S ." + +do_install() { + # The files are only needed if using SysV init. + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}${sysconfdir} \ + ${D}${sysconfdir}/inittab.d \ + ${D}${sysconfdir}/init.d + + install -m 0755 ${UNPACKDIR}/gpio-shutdown-keymap.sh ${D}${sysconfdir}/init.d/ + install -m 0755 ${UNPACKDIR}/bind_gpio_shutdown.tab ${D}${sysconfdir}/inittab.d/ + elif ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + # Systemd init does not require any configuration. + # Note: cannot have an empty branch, hence the redundant dir install. + install -d ${D}${sysconfdir} + else + bbwarn "Not using sysvinit or systemd. The gpio-shutdown may require additional configuration." + fi +} diff --git a/recipes-bsp/rpi-eeprom/rpi-eeprom_git.bb b/recipes-bsp/rpi-eeprom/rpi-eeprom_git.bb new file mode 100644 index 0000000..2e10253 --- /dev/null +++ b/recipes-bsp/rpi-eeprom/rpi-eeprom_git.bb @@ -0,0 +1,69 @@ +SUMMARY = "Installation scripts and binaries for the Raspberry Pi 4 EEPROM" +DESCRIPTION = "This repository contains the rpi4 bootloader and scripts \ +for updating it in the spi eeprom" +LICENSE = "BSD-3-Clause & Broadcom-RPi" +LIC_FILES_CHKSUM = "file://LICENSE;md5=f546ed4f47e9d4c1fe954ecc9d3ef4f3" + +SRC_URI = " \ + git://github.com/raspberrypi/rpi-eeprom.git;protocol=https;branch=master \ +" + +SRCREV = "36e58db5c2a2656e553441f4f48f32227809105d" +PV = "v.2024.02.16-2712" + +S = "${WORKDIR}/git" + +RDEPENDS:${PN} += " \ + coreutils \ + python3 \ + python3-pycryptodomex \ + openssl \ + xxd \ + pciutils \ +" + +inherit python3native + +do_install() { + install -d ${D}${bindir} + + # install executables + install -m 0755 ${S}/tools/vl805 ${D}${bindir} + install -m 0755 ${S}/rpi-eeprom-update ${D}${bindir} + install -m 0755 ${S}/rpi-eeprom-config ${D}${bindir} + install -m 0755 ${S}/rpi-eeprom-digest ${D}${bindir} + + # copy firmware files + install -d ${D}${base_libdir}/firmware/raspberrypi/bootloader-2711/default + install -d ${D}${base_libdir}/firmware/raspberrypi/bootloader-2711/latest + install -d ${D}${base_libdir}/firmware/raspberrypi/bootloader-2712/default + install -d ${D}${base_libdir}/firmware/raspberrypi/bootloader-2712/latest + + install -m 644 ${S}/firmware-2711/default/* ${D}${base_libdir}/firmware/raspberrypi/bootloader-2711/default + install -m 644 ${S}/firmware-2711/latest/* ${D}${base_libdir}/firmware/raspberrypi/bootloader-2711/latest + install -m 644 ${S}/firmware-2712/default/* ${D}${base_libdir}/firmware/raspberrypi/bootloader-2712/default + install -m 644 ${S}/firmware-2712/latest/* ${D}${base_libdir}/firmware/raspberrypi/bootloader-2712/latest + + ln -s default ${D}${base_libdir}/firmware/raspberrypi/bootloader-2711/critical + ln -s latest ${D}${base_libdir}/firmware/raspberrypi/bootloader-2711/stable + ln -s latest ${D}${base_libdir}/firmware/raspberrypi/bootloader-2711/beta + ln -s default ${D}${base_libdir}/firmware/raspberrypi/bootloader-2712/critical + ln -s latest ${D}${base_libdir}/firmware/raspberrypi/bootloader-2712/stable + ln -s latest ${D}${base_libdir}/firmware/raspberrypi/bootloader-2712/beta + + # copy default config + install -d ${D}${sysconfdir}/default + install -D ${S}/rpi-eeprom-update-default ${D}${sysconfdir}/default/rpi-eeprom-update +} + +FILES:${PN} += "${base_libdir}/firmware/raspberrypi/bootloader-*" + +INHIBIT_PACKAGE_STRIP = "1" +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" + +# vl805 tool sources are not available (yet), as it comes as a precompiled +# binary only. It has ARM architecture whereas target machine is Aarch64. We +# need to disable arch check for it otherwise it cannot packed. +QAPATHTEST[arch] = "" + +COMPATIBLE_MACHINE = "raspberrypi4|raspberrypi4-64|raspberrypi5" diff --git a/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in b/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in index 627d181..58fd86a 100644 --- a/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in +++ b/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in @@ -1,4 +1,4 @@ fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs -fatload mmc 0:1 ${kernel_addr_r} @@KERNEL_IMAGETYPE@@ -if test ! -e mmc 0:1 uboot.env; then saveenv; fi; +fatload @@BOOT_MEDIA@@ 0:1 ${kernel_addr_r} @@KERNEL_IMAGETYPE@@ +if test ! -e @@BOOT_MEDIA@@ 0:1 uboot.env; then saveenv; fi; @@KERNEL_BOOTCMD@@ ${kernel_addr_r} - ${fdt_addr} diff --git a/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb b/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb index 9108f71..bbd8736 100644 --- a/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb +++ b/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb @@ -9,10 +9,13 @@ INHIBIT_DEFAULT_DEPS = "1" SRC_URI = "file://boot.cmd.in" +BOOT_MEDIA ?= "mmc" + do_compile() { sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \ -e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \ - "${WORKDIR}/boot.cmd.in" > "${WORKDIR}/boot.cmd" + -e 's/@@BOOT_MEDIA@@/${BOOT_MEDIA}/' \ + "${UNPACKDIR}/boot.cmd.in" > "${WORKDIR}/boot.cmd" mkimage -A ${UBOOT_ARCH} -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr } diff --git a/recipes-bsp/u-boot/files/0001-dm-core-Move-ofdata_to_platdata-call-earlier.patch b/recipes-bsp/u-boot/files/0001-dm-core-Move-ofdata_to_platdata-call-earlier.patch deleted file mode 100644 index 996ad10..0000000 --- a/recipes-bsp/u-boot/files/0001-dm-core-Move-ofdata_to_platdata-call-earlier.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 336d86ebd146905cf4384912f4f27699b6e37c72 Mon Sep 17 00:00:00 2001 -From: Simon Glass <sjg@chromium.org> -Date: Sun, 29 Dec 2019 21:19:17 -0700 -Subject: [PATCH] dm: core: Move ofdata_to_platdata() call earlier - -This method is supposed to extract platform data from the device tree. It -should be done before the device itself is probed. Move it earlier in the -device_probe() function. - -Upstream-Status: Backport - -Signed-off-by: Simon Glass <sjg@chromium.org> ---- - drivers/core/device.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/drivers/core/device.c b/drivers/core/device.c -index 4e03708..291ff4c 100644 ---- a/drivers/core/device.c -+++ b/drivers/core/device.c -@@ -375,6 +375,13 @@ int device_probe(struct udevice *dev) - return 0; - } - -+ if (drv->ofdata_to_platdata && -+ (CONFIG_IS_ENABLED(OF_PLATDATA) || dev_has_of_node(dev))) { -+ ret = drv->ofdata_to_platdata(dev); -+ if (ret) -+ goto fail; -+ } -+ - seq = uclass_resolve_seq(dev); - if (seq < 0) { - ret = seq; -@@ -411,13 +418,6 @@ int device_probe(struct udevice *dev) - goto fail; - } - -- if (drv->ofdata_to_platdata && -- (CONFIG_IS_ENABLED(OF_PLATDATA) || dev_has_of_node(dev))) { -- ret = drv->ofdata_to_platdata(dev); -- if (ret) -- goto fail; -- } -- - /* Only handle devices that have a valid ofnode */ - if (dev_of_valid(dev)) { - /* --- -2.7.4 - diff --git a/recipes-bsp/u-boot/files/0001-rpi-always-set-fdt_addr-with-firmware-provided-FDT-address.patch b/recipes-bsp/u-boot/files/0001-rpi-always-set-fdt_addr-with-firmware-provided-FDT-address.patch new file mode 100644 index 0000000..9ea8f85 --- /dev/null +++ b/recipes-bsp/u-boot/files/0001-rpi-always-set-fdt_addr-with-firmware-provided-FDT-address.patch @@ -0,0 +1,52 @@ +From: Mauro Salvini <m.salvini@koansoftware.com> +To: u-boot@lists.denx.de +Subject: [PATCH] rpi: always set fdt_addr with firmware-provided FDT address +Date: Wed, 12 May 2021 14:39:45 +0200 [thread overview] +Message-ID: <20210512123945.25649-1-m.salvini@koansoftware.com> (raw) + +Raspberry firmware prepares the FDT blob in memory at an address +that depends on both the memory size and the blob size [1]. +After commit ade243a211d6 ("rpi: passthrough of the firmware provided FDT +blob") this FDT is passed to kernel through fdt_addr environment variable, +handled in set_fdt_addr() function in board file. + +When u-boot environment is persistently saved, if a change happens +in loaded FDT (e.g. for a new overlay applied), firmware produces a FDT +address different from the saved one, but u-boot still use the saved +one because set_fdt_addr() function does not overwrite the fdt_addr +variable. So, for example, if there is a script that uses fdt commands for +e.g. manipulate the bootargs, boot hangs with error + +libfdt fdt_check_header(): FDT_ERR_BADMAGIC + +Removing the fdt_addr variable in saved environment allows to boot. + +With this patch set_fdt_addr() function always overwrite fdt_addr value. + +[1] https://www.raspberrypi.org/forums//viewtopic.php?f=107&t=134018 + +Signed-off-by: Mauro Salvini <m.salvini@koansoftware.com> +Cc: C?dric Schieli <cschieli@gmail.com> +Cc: Matthias Brugger <mbrugger@suse.com> +--- +Upstream-Status: Pending + + board/raspberrypi/rpi/rpi.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c +index df52a4689f..611013471e 100644 +--- a/board/raspberrypi/rpi/rpi.c ++++ b/board/raspberrypi/rpi/rpi.c +@@ -318,9 +318,6 @@ static void set_fdtfile(void) + */ + static void set_fdt_addr(void) + { +- if (env_get("fdt_addr")) +- return; +- + if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC) + return; + +-- +2.17.1
\ No newline at end of file diff --git a/recipes-bsp/u-boot/u-boot_%.bbappend b/recipes-bsp/u-boot/u-boot_%.bbappend index cdfe5bb..8c707b5 100644 --- a/recipes-bsp/u-boot/u-boot_%.bbappend +++ b/recipes-bsp/u-boot/u-boot_%.bbappend @@ -1,15 +1,14 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" -SRC_URI_append_rpi = " \ +SRC_URI:append:rpi = " \ file://fw_env.config \ " -# special fix for raspberrypi-cm3 -SRC_URI_append_raspberrypi-cm3 = " file://0001-dm-core-Move-ofdata_to_platdata-call-earlier.patch" +SRC_URI:append:rpi = " file://0001-rpi-always-set-fdt_addr-with-firmware-provided-FDT-address.patch" -DEPENDS_append_rpi = " u-boot-default-script" +DEPENDS:append:rpi = " u-boot-default-script" -do_install_append_rpi () { +do_install:append:rpi () { install -d ${D}${sysconfdir} - install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config + install -m 0644 ${UNPACKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config } |