diff options
Diffstat (limited to 'recipes-bsp')
18 files changed, 566 insertions, 194 deletions
diff --git a/recipes-bsp/armstubs/armstubs.bb b/recipes-bsp/armstubs/armstubs.bb index d8f3fe7..7e389df 100644 --- a/recipes-bsp/armstubs/armstubs.bb +++ b/recipes-bsp/armstubs/armstubs.bb @@ -34,3 +34,5 @@ addtask deploy before do_build after do_install do_deploy[dirs] += "${DEPLOYDIR}/${PN}" PACKAGE_ARCH = "${MACHINE_ARCH}" + +TOOLCHAIN = "gcc" diff --git a/recipes-bsp/bootfiles/bootfiles.bb b/recipes-bsp/bootfiles/bootfiles.bb deleted file mode 100644 index 80e226d..0000000 --- a/recipes-bsp/bootfiles/bootfiles.bb +++ /dev/null @@ -1,43 +0,0 @@ -DESCRIPTION = "Closed source binary files to help boot all raspberry pi devices." -LICENSE = "Broadcom-RPi" - -LIC_FILES_CHKSUM = "file://LICENCE.broadcom;md5=c403841ff2837657b2ed8e5bb474ac8d" - -inherit deploy nopackages - -include recipes-bsp/common/raspberrypi-firmware.inc - -INHIBIT_DEFAULT_DEPS = "1" - -DEPENDS = "rpi-config" - -COMPATIBLE_MACHINE = "^rpi$" - -S = "${RPIFW_S}/boot" - -PR = "r3" - -do_deploy() { - install -d ${DEPLOYDIR}/${PN} - - for i in ${S}/*.elf ; do - cp $i ${DEPLOYDIR}/${PN} - done - for i in ${S}/*.dat ; do - cp $i ${DEPLOYDIR}/${PN} - done - for i in ${S}/*.bin ; do - cp $i ${DEPLOYDIR}/${PN} - done - - # Add stamp in deploy directory - touch ${DEPLOYDIR}/${PN}/${PN}-${PV}.stamp -} - -do_deploy[depends] += "rpi-config:do_deploy" - -addtask deploy before do_build after do_install -do_deploy[dirs] += "${DEPLOYDIR}/${PN}" - -PACKAGE_ARCH = "${MACHINE_ARCH}" - diff --git a/recipes-bsp/bootfiles/rpi-bootfiles.bb b/recipes-bsp/bootfiles/rpi-bootfiles.bb new file mode 100644 index 0000000..b04f24b --- /dev/null +++ b/recipes-bsp/bootfiles/rpi-bootfiles.bb @@ -0,0 +1,52 @@ +DESCRIPTION = "Closed source binary files to help boot all raspberry pi devices." +LICENSE = "Broadcom-RPi" + +LIC_FILES_CHKSUM = "file://LICENCE.broadcom;md5=c403841ff2837657b2ed8e5bb474ac8d" + +inherit deploy nopackages + +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" + +DEPENDS = "rpi-config rpi-cmdline" + +COMPATIBLE_MACHINE = "^rpi$" + +S = "${RPIFW_S}/boot" + +PR = "r3" + +do_deploy() { + install -d ${DEPLOYDIR}/${BOOTFILES_DIR_NAME} + + for i in ${S}/*.elf ; do + cp $i ${DEPLOYDIR}/${BOOTFILES_DIR_NAME} + done + for i in ${S}/*.dat ; do + cp $i ${DEPLOYDIR}/${BOOTFILES_DIR_NAME} + done + for i in ${S}/*.bin ; do + cp $i ${DEPLOYDIR}/${BOOTFILES_DIR_NAME} + done + + # Add stamp in deploy directory + touch ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/${PN}-${PV}.stamp +} + +do_deploy[depends] += "rpi-config:do_deploy rpi-cmdline: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-cmdline.bb b/recipes-bsp/bootfiles/rpi-cmdline.bb new file mode 100644 index 0000000..461934b --- /dev/null +++ b/recipes-bsp/bootfiles/rpi-cmdline.bb @@ -0,0 +1,78 @@ +SUMMARY = "cmdline.txt file used to boot the kernel on a Raspberry Pi device" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +COMPATIBLE_MACHINE = "^rpi$" +INHIBIT_DEFAULT_DEPS = "1" +inherit deploy nopackages + +CMDLINE_DWC_OTG ?= "dwc_otg.lpm_enable=0" + +CMDLINE_ROOT_FSTYPE ?= "rootfstype=ext4" +CMDLINE_ROOT_PARTITION ?= "/dev/mmcblk0p2" + +CMDLINE_ROOTFS ?= "root=${CMDLINE_ROOT_PARTITION} ${CMDLINE_ROOT_FSTYPE} rootwait" + +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)}" + +# Add the kernel debugger over console kernel command line option if enabled +CMDLINE_KGDB ?= '${@oe.utils.conditional("ENABLE_KGDB", "1", "kgdboc=serial0,115200", "", d)}' + +# Disable rpi logo on boot +CMDLINE_LOGO ?= '${@oe.utils.conditional("DISABLE_RPI_BOOT_LOGO", "1", "logo.nologo", "", d)}' + +# You can define CMDLINE_DEBUG as "debug" in your local.conf or distro.conf +# 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} \ + ${CMDLINE_CMA} \ + ${CMDLINE_KGDB} \ + ${CMDLINE_LOGO} \ + ${CMDLINE_PITFT} \ + ${CMDLINE_DEBUG} \ + ${CMDLINE_RNDIS} \ + ${CMDLINE_IFNAMES} \ + " + +do_compile() { + echo "${@' '.join(d.getVar('CMDLINE').split())}" > "${WORKDIR}/cmdline.txt" +} + +do_deploy() { + install -d "${DEPLOYDIR}/${BOOTFILES_DIR_NAME}" + install -m 0644 "${WORKDIR}/cmdline.txt" "${DEPLOYDIR}/${BOOTFILES_DIR_NAME}" +} + +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 9489951..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,209 +30,316 @@ 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 do_deploy() { install -d ${DEPLOYDIR}/${BOOTFILES_DIR_NAME} + CONFIG=${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - cp ${S}/config.txt ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/ + cp ${S}/config.txt $CONFIG if [ -n "${KEY_DECODE_MPG2}" ]; then - sed -i '/#decode_MPG2=/ c\decode_MPG2=${KEY_DECODE_MPG2}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#decode_MPG2=/ c\decode_MPG2=${KEY_DECODE_MPG2}' $CONFIG fi if [ -n "${KEY_DECODE_WVC1}" ]; then - sed -i '/#decode_WVC1=/ c\decode_WVC1=${KEY_DECODE_WVC1}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#decode_WVC1=/ c\decode_WVC1=${KEY_DECODE_WVC1}' $CONFIG fi if [ -n "${DISABLE_OVERSCAN}" ]; then - sed -i '/#disable_overscan=/ c\disable_overscan=${DISABLE_OVERSCAN}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#disable_overscan=/ c\disable_overscan=${DISABLE_OVERSCAN}' $CONFIG fi if [ "${DISABLE_SPLASH}" = "1" ]; then - sed -i '/#disable_splash=/ c\disable_splash=${DISABLE_SPLASH}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#disable_splash=/ c\disable_splash=${DISABLE_SPLASH}' $CONFIG fi # Set overclocking options if [ -n "${ARM_FREQ}" ]; then - sed -i '/#arm_freq=/ c\arm_freq=${ARM_FREQ}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#arm_freq=/ c\arm_freq=${ARM_FREQ}' $CONFIG fi if [ -n "${GPU_FREQ}" ]; then - sed -i '/#gpu_freq=/ c\gpu_freq=${GPU_FREQ}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#gpu_freq=/ c\gpu_freq=${GPU_FREQ}' $CONFIG fi if [ -n "${CORE_FREQ}" ]; then - sed -i '/#core_freq=/ c\core_freq=${CORE_FREQ}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#core_freq=/ c\core_freq=${CORE_FREQ}' $CONFIG fi if [ -n "${SDRAM_FREQ}" ]; then - sed -i '/#sdram_freq=/ c\sdram_freq=${SDRAM_FREQ}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#sdram_freq=/ c\sdram_freq=${SDRAM_FREQ}' $CONFIG fi if [ -n "${OVER_VOLTAGE}" ]; then - sed -i '/#over_voltage=/ c\over_voltage=${OVER_VOLTAGE}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#over_voltage=/ c\over_voltage=${OVER_VOLTAGE}' $CONFIG fi # GPU memory if [ -n "${GPU_MEM}" ]; then - sed -i '/#gpu_mem=/ c\gpu_mem=${GPU_MEM}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#gpu_mem=/ c\gpu_mem=${GPU_MEM}' $CONFIG fi if [ -n "${GPU_MEM_256}" ]; then - sed -i '/#gpu_mem_256=/ c\gpu_mem_256=${GPU_MEM_256}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#gpu_mem_256=/ c\gpu_mem_256=${GPU_MEM_256}' $CONFIG fi if [ -n "${GPU_MEM_512}" ]; then - sed -i '/#gpu_mem_512=/ c\gpu_mem_512=${GPU_MEM_512}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#gpu_mem_512=/ c\gpu_mem_512=${GPU_MEM_512}' $CONFIG fi if [ -n "${GPU_MEM_1024}" ]; then - sed -i '/#gpu_mem_1024=/ c\gpu_mem_1024=${GPU_MEM_1024}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#gpu_mem_1024=/ c\gpu_mem_1024=${GPU_MEM_1024}' $CONFIG fi # Set boot delay if [ -n "${BOOT_DELAY}" ]; then - sed -i '/#boot_delay=/ c\boot_delay=${BOOT_DELAY}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#boot_delay=/ c\boot_delay=${BOOT_DELAY}' $CONFIG fi if [ -n "${BOOT_DELAY_MS}" ]; then - sed -i '/#boot_delay_ms=/ c\boot_delay_ms=${BOOT_DELAY_MS}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#boot_delay_ms=/ c\boot_delay_ms=${BOOT_DELAY_MS}' $CONFIG fi # Set HDMI and composite video options if [ -n "${HDMI_FORCE_HOTPLUG}" ]; then - sed -i '/#hdmi_force_hotplug=/ c\hdmi_force_hotplug=${HDMI_FORCE_HOTPLUG}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#hdmi_force_hotplug=/ c\hdmi_force_hotplug=${HDMI_FORCE_HOTPLUG}' $CONFIG fi if [ -n "${HDMI_DRIVE}" ]; then - sed -i '/#hdmi_drive=/ c\hdmi_drive=${HDMI_DRIVE}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#hdmi_drive=/ c\hdmi_drive=${HDMI_DRIVE}' $CONFIG fi if [ -n "${HDMI_GROUP}" ]; then - sed -i '/#hdmi_group=/ c\hdmi_group=${HDMI_GROUP}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#hdmi_group=/ c\hdmi_group=${HDMI_GROUP}' $CONFIG fi if [ -n "${HDMI_MODE}" ]; then - sed -i '/#hdmi_mode=/ c\hdmi_mode=${HDMI_MODE}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + 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}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#config_hdmi_boost=/ c\config_hdmi_boost=${CONFIG_HDMI_BOOST}' $CONFIG fi if [ -n "${SDTV_MODE}" ]; then - sed -i '/#sdtv_mode=/ c\sdtv_mode=${SDTV_MODE}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#sdtv_mode=/ c\sdtv_mode=${SDTV_MODE}' $CONFIG fi if [ -n "${SDTV_ASPECT}" ]; then - sed -i '/#sdtv_aspect=/ c\sdtv_aspect=${SDTV_ASPECT}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#sdtv_aspect=/ c\sdtv_aspect=${SDTV_ASPECT}' $CONFIG fi if [ -n "${DISPLAY_ROTATE}" ]; then - sed -i '/#display_rotate=/ c\display_rotate=${DISPLAY_ROTATE}' ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + sed -i '/#display_rotate=/ c\display_rotate=${DISPLAY_ROTATE}' $CONFIG fi # Video camera support if [ "${VIDEO_CAMERA}" = "1" ]; then - echo "# Enable video camera" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "start_x=1" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + # 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 # Offline compositing support if [ "${DISPMANX_OFFLINE}" = "1" ]; then - echo "# Enable offline compositing" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dispmanx_offline=1" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Enable offline compositing" >>$CONFIG + echo "dispmanx_offline=1" >>$CONFIG fi # SPI bus support if [ "${ENABLE_SPI_BUS}" = "1" ] || [ "${PITFT}" = "1" ]; then - echo "# Enable SPI bus" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtparam=spi=on" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Enable SPI bus" >>$CONFIG + echo "dtparam=spi=on" >>$CONFIG fi # I2C support if [ "${ENABLE_I2C}" = "1" ] || [ "${PITFT}" = "1" ]; then - echo "# Enable I2C" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtparam=i2c1=on" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtparam=i2c_arm=on" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Enable I2C" >>$CONFIG + echo "dtparam=i2c1=on" >>$CONFIG + echo "dtparam=i2c_arm=on" >>$CONFIG fi # PiTFT22 display support if [ "${PITFT22}" = "1" ]; then - echo "# Enable PITFT22 display" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtoverlay=pitft22,rotate=270,speed=32000000,txbuflen=32768" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Enable PITFT22 display" >>$CONFIG + echo "dtoverlay=pitft22,rotate=270,speed=32000000,txbuflen=32768" >>$CONFIG fi if [ "${PITFT28r}" = "1" ]; then - echo "# Enable PITFT28r display" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtoverlay=pitft28-resistive,rotate=90,speed=32000000,txbuflen=32768" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Enable PITFT28r display" >>$CONFIG + echo "dtoverlay=pitft28-resistive,rotate=90,speed=32000000,txbuflen=32768" >>$CONFIG fi if [ "${PITFT28c}" = "1" ]; then - echo "# Enable PITFT28c display" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtoverlay=pitft28-capacitive,rotate=90,speed=32000000,txbuflen=32768" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtoverlay=pitft28-capacitive,touch-swapxy,touch-invx" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Enable PITFT28c display" >>$CONFIG + echo "dtoverlay=pitft28-capacitive,rotate=90,speed=32000000,txbuflen=32768" >>$CONFIG + echo "dtoverlay=pitft28-capacitive,touch-swapxy,touch-invx" >>$CONFIG fi if [ "${PITFT35r}" = "1" ]; then - echo "# Enable PITFT35r display" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtoverlay=pitft35-resistive,rotate=90,speed=42000000,fps=20" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Enable PITFT35r display" >>$CONFIG + echo "dtoverlay=pitft35-resistive,rotate=90,speed=42000000,fps=20" >>$CONFIG fi # UART support - if [ "${ENABLE_UART}" = "1" ]; then - echo "# Enable UART" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "enable_uart=1" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + if [ "${ENABLE_UART}" = "1" ] || [ "${ENABLE_UART}" = "0" ]; then + echo "# Enable UART" >>$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 if [ "${ENABLE_IR}" = "1" ]; then - echo "# Enable infrared" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtoverlay=gpio-ir,gpio_pin=${GPIO_IR}" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtoverlay=gpio-ir-tx,gpio_pin=${GPIO_IR_TX}" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Enable infrared" >>$CONFIG + echo "dtoverlay=gpio-ir,gpio_pin=${GPIO_IR}" >>$CONFIG + echo "dtoverlay=gpio-ir-tx,gpio_pin=${GPIO_IR_TX}" >>$CONFIG fi # VC4 Graphics support if [ "${VC4GRAPHICS}" = "1" ]; then - echo "# Enable VC4 Graphics" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtoverlay=${VC4DTBO}" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Enable VC4 Graphics" >> $CONFIG + echo "dtoverlay=${VC4DTBO}" >> $CONFIG + fi + + # Choose Camera Sensor to be used, default imx219 sensor + if [ "${RASPBERRYPI_CAMERA_V2}" = "1" ]; then + 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" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "max_usb_current=1" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "hdmi_group=2" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "hdmi_mode=87" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "hdmi_cvt 1024 600 60 6 0 0 0" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "hdmi_drive=1" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Waveshare \"C\" 1024x600 7\" Rev2.1 IPS capacitive touch screen" >> $CONFIG + echo "max_usb_current=1" >> $CONFIG + echo "hdmi_group=2" >> $CONFIG + echo "hdmi_mode=87" >> $CONFIG + echo "hdmi_cvt 1024 600 60 6 0 0 0" >> $CONFIG + echo "hdmi_drive=1" >> $CONFIG fi # DWC2 USB peripheral support - if [ "${ENABLE_DWC2_PERIPHERAL}" = "1" ]; then - echo "# Enable USB peripheral mode" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtoverlay=dwc2,dr_mode=peripheral" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + if ([ "${ENABLE_DWC2_PERIPHERAL}" = "1" ] && [ "${ENABLE_DWC2_OTG}" != "1" ]); then + echo "# Enable USB peripheral mode" >> $CONFIG + echo "dtoverlay=dwc2,dr_mode=peripheral" >> $CONFIG + fi + + # DWC2 USB host mode support + if [ "${ENABLE_DWC2_HOST}" = "1" ]; then + 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 - echo "# Enable AT86RF23X" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtoverlay=at86rf233,speed=3000000" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Enable AT86RF23X" >>$CONFIG + echo "dtoverlay=at86rf233,speed=3000000" >>$CONFIG fi # ENABLE DUAL CAN if [ "${ENABLE_DUAL_CAN}" = "1" ]; then - echo "# Enable DUAL CAN" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=25" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtoverlay=mcp2515-can1,oscillator=${CAN_OSCILLATOR},interrupt=24" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Enable DUAL CAN" >>$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" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtoverlay=mcp2515-can0,oscillator=${CAN_OSCILLATOR},interrupt=25" >>${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Enable CAN" >>$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 - printf "${RPI_EXTRA_CONFIG}\n" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + printf "${RPI_EXTRA_CONFIG}\n" >> $CONFIG # Handle setup with armstub file if [ "${@bb.utils.contains("MACHINE_FEATURES", "armstub", "1", "0", d)}" = "1" ]; then - echo "\n# ARM stub configuration" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "armstub=${ARMSTUB}" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "\n# ARM stub configuration" >> $CONFIG + echo "armstub=${ARMSTUB}" >> $CONFIG case "${ARMSTUB}" in *-gic.bin) - echo "enable_gic=1" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "enable_gic=1" >> $CONFIG ;; 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() { - echo "# have a properly sized image" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "disable_overscan=1" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt +do_deploy:append:raspberrypi3-64() { + echo "# have a properly sized image" >> $CONFIG + echo "disable_overscan=1" >> $CONFIG - echo "# Enable audio (loads snd_bcm2835)" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt - echo "dtparam=audio=on" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "# Enable audio (loads snd_bcm2835)" >> $CONFIG + 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 diff --git a/recipes-bsp/common/raspberrypi-firmware.inc b/recipes-bsp/common/raspberrypi-firmware.inc index 32cc480..311da21 100644 --- a/recipes-bsp/common/raspberrypi-firmware.inc +++ b/recipes-bsp/common/raspberrypi-firmware.inc @@ -1,9 +1,9 @@ -RPIFW_DATE ?= "20201002" -SRCREV ?= "11e3c314bc2b64f7d862bac00ff3d9f42f3c5a50" -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] = "b8c9f5a3e987f418f11526cbf59f6a6c8103e8f5e94bccffb9ef3fd7ae834f98" +SRC_URI[sha256sum] = "1d9eb83111826b708f461101766fd2000d45f1c171ad573936d000f623ca8098" PV = "${RPIFW_DATE}" diff --git a/recipes-bsp/common/raspberrypi-tools.inc b/recipes-bsp/common/raspberrypi-tools.inc index 93f9d7a..c88e7e4 100644 --- a/recipes-bsp/common/raspberrypi-tools.inc +++ b/recipes-bsp/common/raspberrypi-tools.inc @@ -1,9 +1,11 @@ -RPITOOLS_DATE ?= "20200803" -SRCREV ?= "0c39cb5b5ac9851312a38c54f5aea770d976de7a" -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] = "ef56a891eef387d2278e6f9d20b462021faace14aceeb2048b5e5973069c25c0" 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 4cb8978..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,14 +9,17 @@ 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" - mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr + -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 } -inherit deploy nopackages +inherit kernel-arch deploy nopackages do_deploy() { install -d ${DEPLOYDIR} 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 } |