[Pkg-raspi-maintainers] Bug#858428: raspi3-firmware: avail package on armhf architecture

Vagrant Cascadian vagrant at debian.org
Tue May 2 23:24:09 UTC 2017


On 2017-05-02, Vagrant Cascadian wrote:
> Obviously, etc/kernel/postinst.d/raspi3-firmware will need some
> adjustments, as it's currently hard-coded for raspberry pi 3.

Wow, it's hard-coded in all sorts of ways... the commandline options,
the boot options, etc.

Patch below to at least to hard-code support raspberry pi2 on armhf,
which doesn't handle running armhf on raspberry pi 3 (a plausible
configuration). Maybe it should support /etc/default/raspi3-firmware and
only set defaults for dtb if unspecified.


diff --git a/debian/kernel/postinst.d/raspi3-firmware b/debian/kernel/postinst.d/raspi3-firmware
index ca4d158..bfd16c9 100755
--- a/debian/kernel/postinst.d/raspi3-firmware
+++ b/debian/kernel/postinst.d/raspi3-firmware
@@ -10,6 +10,18 @@ exec </dev/null >&2
 
 eval set -- "$DEB_MAINT_PARAMS"
 
+
+# Detect appropriate .dtb
+arch=$(dpkg --print-architecture)
+case ${arch} in
+	armhf)
+		dtb=bcm2836-rpi-2-b.dtb
+		;;
+	arm64)
+		dtb=bcm2837-rpi-3-b.dtb
+		;;
+esac
+
 # Only run on configure to avoid unnecessary work.
 if [ -z "$1" ] || [ "$1" != "configure" ]; then
   exit 0
@@ -34,7 +46,7 @@ if [ -z "$latest_initrd" ]; then
   exit 0
 fi
 
-latest_dtb="/usr/lib/linux-image-${latest_kernel#/boot/vmlinuz-}/broadcom/bcm2837-rpi-3-b.dtb"
+latest_dtb="/usr/lib/linux-image-${latest_kernel#/boot/vmlinuz-}/broadcom/${dtb}"
 
 if [ ! -e "$latest_dtb" ]; then
   echo "raspi3-firmware: device tree file ${latest_dtb} does not exist, cannot populate /boot/firmware"
@@ -49,10 +61,15 @@ latest_kernel_basename=$(basename "$latest_kernel")
 latest_initrd_basename=$(basename "$latest_initrd")
 latest_dtb_basename=$(basename "$latest_dtb")
 
-cat >/boot/firmware/config.txt <<EOF
+if [ "arm64" = "$arch" ]; then
+	cat >/boot/firmware/config.txt <<EOF
 # Switch the CPU from ARMv7 into ARMv8 (aarch64) mode
 arm_control=0x200
 
+EOF
+fi
+
+cat >/boot/firmware/config.txt <<EOF
 enable_uart=1
 
 device_tree=${latest_dtb_basename}



live well,
  vagrant

p.s. FWIW, I also tested that u-boot works with the firmware from
raspi3-firmware.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-raspi-maintainers/attachments/20170502/7d8f6bea/attachment.sig>


More information about the Pkg-raspi-maintainers mailing list