From e8d4ac24a4171ffb20feee22299a0c52a3e00ff2 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 19 Mar 2024 19:12:21 -0700
Subject: [PATCH 1/3] linux-raspberrypi_6.6: Bump to 6.6.22

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 recipes-kernel/linux/linux-raspberrypi_6.6.bb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/recipes-kernel/linux/linux-raspberrypi_6.6.bb b/recipes-kernel/linux/linux-raspberrypi_6.6.bb
index 16493931..b4d9953e 100644
--- a/recipes-kernel/linux/linux-raspberrypi_6.6.bb
+++ b/recipes-kernel/linux/linux-raspberrypi_6.6.bb
@@ -1,9 +1,9 @@
-LINUX_VERSION ?= "6.6.21"
+LINUX_VERSION ?= "6.6.22"
 LINUX_RPI_BRANCH ?= "rpi-6.6.y"
 LINUX_RPI_KMETA_BRANCH ?= "yocto-6.6"
 
-SRCREV_machine = "80c57b7437fb6f55b879f921f3118a2deb0c15a8"
-SRCREV_meta = "5b185a8716c8c62dc1c7751e6d12f8b67f58274f"
+SRCREV_machine = "c04af98514c26014a4f29ec87b3ece95626059bd"
+SRCREV_meta = "6a24861d6504575a4a9f92366285332d47c7e111"
 
 KMETA = "kernel-meta"
 

From bb8d5f7e9b8ee993c0f21c1f702d9fc4606e728f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 20 Mar 2024 22:36:06 -0700
Subject: [PATCH 2/3] rpi-bootfiles: Resort to github APIs for tarballs

The firmware repo is huge ( 36G ) to clone is onerous
using shallow clone tarballs require them to be pre-populated
at some mirror which we don't have. Third option is to let
github provide the tarball, there is concern that tarballs
might change the compression etc and thus checksum would change
that is something github would communicate to users in advance [1]

Therefore this is the best solution for us right now.

Also upgrade to latest while here and drop PR settings

[1] https://docs.github.com/en/repositories/working-with-files/using-files/downloading-source-code-archives#stability-of-source-code-archives

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 recipes-bsp/bootfiles/rpi-bootfiles.bb | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/recipes-bsp/bootfiles/rpi-bootfiles.bb b/recipes-bsp/bootfiles/rpi-bootfiles.bb
index f1248eed..b04f24be 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"
 

From ec06e94f2a459e57eacf3f70e078b6442a433aa9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 20 Mar 2024 22:39:51 -0700
Subject: [PATCH 3/3] raspberrypi-firmware: Revert to debian archive

This file is now used to fetch binary blobs used by picamera and
vc library recipes, which are only compatible with 32bit userspace
Perhaps we need to sunset these recipe as some point and repace
with alternatives like picamera2 which is built on top of libcamera
and works on both 32bit and 64 bit

rpi-bootfiles is fetching from latest firmware.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 recipes-bsp/common/raspberrypi-firmware.inc | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/recipes-bsp/common/raspberrypi-firmware.inc b/recipes-bsp/common/raspberrypi-firmware.inc
index 9de0d017..311da21d 100644
--- a/recipes-bsp/common/raspberrypi-firmware.inc
+++ b/recipes-bsp/common/raspberrypi-firmware.inc
@@ -1,12 +1,9 @@
-RPIFW_DATE ?= "20240312"
-SRCREV = "5689dd184872b809af91d6636a832b1484d90fef"
-RPIFW_SRC_URI ?= "git://github.com/raspberrypi/firmware;protocol=https;branch=master"
-RPIFW_S ?= "${WORKDIR}/git"
+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] = "1d9eb83111826b708f461101766fd2000d45f1c171ad573936d000f623ca8098"
 
 PV = "${RPIFW_DATE}"
-
-# Firmware repo is huge due to its content nature being binary blobs
-# use shallow clone to reduce amount of git metadata being pulled down
-BB_GIT_SHALLOW = "1"