<div dir="ltr">Uups - and here the patches as plain text:<div><br></div><div><div>From d7cb95f43ae83e3b5d6b8ada84bd850bed7529dc Mon Sep 17 00:00:00 2001</div><div>From: =?UTF-8?q?Matthias=20L=C3=BCscher?= <<a href="mailto:lueschem@gmail.com">lueschem@gmail.com</a>></div><div>Date: Sun, 14 Jan 2018 17:27:48 +0100</div><div>Subject: [PATCH 1/5] Do not check mount point if virtualization gets detected.</div><div><br></div><div>More and more tools use containers instead of chroots to build OS</div><div>images. This change makes sure that the package installation works</div><div>within a container.</div><div>---</div><div> debian/kernel/postinst.d/raspi3-firmware | 12 +++++++-----</div><div> debian/raspi3-firmware.postinst          | 12 +++++++-----</div><div> 2 files changed, 14 insertions(+), 10 deletions(-)</div><div><br></div><div>diff --git a/debian/kernel/postinst.d/raspi3-firmware b/debian/kernel/postinst.d/raspi3-firmware</div><div>index 349bfe9..0bd1e70 100755</div><div>--- a/debian/kernel/postinst.d/raspi3-firmware</div><div>+++ b/debian/kernel/postinst.d/raspi3-firmware</div><div>@@ -31,11 +31,13 @@ case "$1" in</div><div>     ;;</div><div> esac</div><div> </div><div>-if ! ischroot; then</div><div>-  if ! mountpoint -q /boot/firmware; then</div><div>-    echo "raspi3-firmware: missing /boot/firmware, did you forget to mount it?" >&2</div><div>-    exit 1</div><div>-  fi</div><div>+if ischroot ; then</div><div>+  true # chroot detected - skip mount point check</div><div>+elif test -e /usr/bin/systemd-detect-virt && systemd-detect-virt -q ; then</div><div>+  true # virtualization detected - skip mount point check</div><div>+elif ! mountpoint -q /boot/firmware; then</div><div>+  echo "raspi3-firmware: missing /boot/firmware, did you forget to mount it?" >&2</div><div>+  exit 1</div><div> fi</div><div> </div><div> # Ensure the target directory exists. See <a href="https://bugs.debian.org/887062">https://bugs.debian.org/887062</a></div><div>diff --git a/debian/raspi3-firmware.postinst b/debian/raspi3-firmware.postinst</div><div>index 5d4e195..224dc92 100644</div><div>--- a/debian/raspi3-firmware.postinst</div><div>+++ b/debian/raspi3-firmware.postinst</div><div>@@ -6,11 +6,13 @@ set -e</div><div> case "$1" in</div><div>   configure)</div><div> </div><div>-    if ! ischroot; then</div><div>-      if ! mountpoint -q /boot/firmware; then</div><div>-        echo "Error: missing /boot/firmware, did you forget to mount it?" >&2</div><div>-        exit 1</div><div>-      fi</div><div>+    if ischroot ; then</div><div>+      true # chroot detected - skip mount point check</div><div>+    elif test -e /usr/bin/systemd-detect-virt && systemd-detect-virt -q ; then</div><div>+      true # virtualization detected - skip mount point check</div><div>+    elif ! mountpoint -q /boot/firmware; then</div><div>+      echo "Error: missing /boot/firmware, did you forget to mount it?" >&2</div><div>+      exit 1</div><div>     fi</div><div> </div><div>     # Ensure the target directory exists. See <a href="https://bugs.debian.org/887062">https://bugs.debian.org/887062</a></div><div>-- </div><div>2.7.4</div><div><br></div><div>From 927a9a4c38064f16aeb0101d7df71d96fcc5e9c5 Mon Sep 17 00:00:00 2001</div><div>From: =?UTF-8?q?Matthias=20L=C3=BCscher?= <<a href="mailto:lueschem@gmail.com">lueschem@gmail.com</a>></div><div>Date: Mon, 15 Jan 2018 21:58:07 +0100</div><div>Subject: [PATCH 2/5] Copy and rename all possible device tree binaries.</div><div><br></div><div>This commit removes the hard coded device tree setting from</div><div>/boot/firmware/config.txt. As a result an armhf image will run</div><div>unmodified on the Raspberry Pi 2 and 3.</div><div>---</div><div> debian/kernel/postinst.d/raspi3-firmware | 37 ++++++++++++++------------------</div><div> 1 file changed, 16 insertions(+), 21 deletions(-)</div><div><br></div><div>diff --git a/debian/kernel/postinst.d/raspi3-firmware b/debian/kernel/postinst.d/raspi3-firmware</div><div>index 0bd1e70..b76a73e 100755</div><div>--- a/debian/kernel/postinst.d/raspi3-firmware</div><div>+++ b/debian/kernel/postinst.d/raspi3-firmware</div><div>@@ -10,18 +10,6 @@ exec </dev/null >&2</div><div> </div><div> eval set -- "$DEB_MAINT_PARAMS"</div><div> </div><div>-</div><div>-# Detect appropriate .dtb</div><div>-arch=$(dpkg --print-architecture)</div><div>-case ${arch} in</div><div>-  armhf)</div><div>-    dtb=bcm2836-rpi-2-b.dtb</div><div>-    ;;</div><div>-  arm64)</div><div>-    dtb=bcm2837-rpi-3-b.dtb</div><div>-    ;;</div><div>-esac</div><div>-</div><div> # Only run on configure and remove to avoid unnecessary work.</div><div> case "$1" in</div><div>   configure|remove)</div><div>@@ -55,20 +43,28 @@ if [ -z "$latest_initrd" ]; then</div><div>   exit 0</div><div> fi</div><div> </div><div>-latest_dtb="/usr/lib/linux-image-${latest_kernel#/boot/vmlinuz-}/broadcom/${dtb}"</div><div>+cp "$latest_kernel" /boot/firmware/</div><div>+cp "$latest_initrd" /boot/firmware/</div><div> </div><div>-if [ ! -e "$latest_dtb" ]; then</div><div>-  echo "raspi3-firmware: device tree file ${latest_dtb} does not exist, cannot populate /boot/firmware"</div><div>-  exit 0</div><div>+# copy and rename the available device tree binaries</div><div>+# the bootloader will pick the right device tree binary</div><div>+# if it is named according to the system on chip family name</div><div>+arch=$(dpkg --print-architecture)</div><div>+if [ "arm64" = "$arch" ]; then</div><div>+  dtb_path="/usr/lib/linux-image-${latest_kernel#/boot/vmlinuz-}/broadcom"</div><div>+else</div><div>+  # there is no vendor subdirectory for armhf</div><div>+  dtb_path="/usr/lib/linux-image-${latest_kernel#/boot/vmlinuz-}"</div><div> fi</div><div> </div><div>-cp "$latest_kernel" /boot/firmware/</div><div>-cp "$latest_initrd" /boot/firmware/</div><div>-cp "$latest_dtb" /boot/firmware/</div><div>+pi2b_dtb=${dtb_path}/bcm2836-rpi-2-b.dtb</div><div>+pi3b_dtb=${dtb_path}/bcm2837-rpi-3-b.dtb</div><div>+</div><div>+[ -e "${pi2b_dtb}" ] && cp "${pi2b_dtb}" /boot/firmware/bcm2709-rpi-2-b.dtb</div><div>+[ -e "${pi3b_dtb}" ] && cp "${pi3b_dtb}" /boot/firmware/bcm2710-rpi-3-b.dtb</div><div> </div><div> latest_kernel_basename=$(basename "$latest_kernel")</div><div> latest_initrd_basename=$(basename "$latest_initrd")</div><div>-latest_dtb_basename=$(basename "$latest_dtb")</div><div> </div><div> if [ "arm64" = "$arch" ]; then</div><div>   cat >/boot/firmware/config.txt <<EOF</div><div>@@ -85,7 +81,6 @@ fi</div><div> cat >>/boot/firmware/config.txt <<EOF</div><div> enable_uart=1</div><div> </div><div>-device_tree=${latest_dtb_basename}</div><div> kernel=${latest_kernel_basename}</div><div> # For details on the initramfs directive, see</div><div> # <a href="https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=10532">https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=10532</a></div><div>-- </div><div>2.7.4</div><div><br></div><div>From 0a9e958621cee55579477d1614e0e4858dbc5968 Mon Sep 17 00:00:00 2001</div><div>From: =?UTF-8?q?Matthias=20L=C3=BCscher?= <<a href="mailto:lueschem@gmail.com">lueschem@gmail.com</a>></div><div>Date: Mon, 15 Jan 2018 22:27:11 +0100</div><div>Subject: [PATCH 3/5] Added missing dosfstools dependency.</div><div><br></div><div>dosfstools contains fsck.vfat. If this binary is missing, the script</div><div>debian/initramfs-tools/hooks/raspi3-firmware-fsck will fail.</div><div>---</div><div> debian/control | 2 +-</div><div> 1 file changed, 1 insertion(+), 1 deletion(-)</div><div><br></div><div>diff --git a/debian/control b/debian/control</div><div>index a396b5e..97d7bbf 100644</div><div>--- a/debian/control</div><div>+++ b/debian/control</div><div>@@ -12,7 +12,7 @@ XS-Autobuild: yes</div><div> </div><div> Package: raspi3-firmware</div><div> Architecture: arm64 armhf</div><div>-Depends: ${shlibs:Depends}, ${misc:Depends}</div><div>+Depends: ${shlibs:Depends}, ${misc:Depends}, dosfstools</div><div> Breaks: linux-firmware-raspi3 (<< 1.20161123-2)</div><div> Replaces: linux-firmware-raspi3 (<< 1.20161123-2)</div><div> Description: Raspberry Pi 3 GPU firmware and bootloaders</div><div>-- </div><div>2.7.4</div><div><br></div><div>From a54efcd48a65ec3c7b3752381eda3dd72f1e9132 Mon Sep 17 00:00:00 2001</div><div>From: =?UTF-8?q?Matthias=20L=C3=BCscher?= <<a href="mailto:lueschem@gmail.com">lueschem@gmail.com</a>></div><div>Date: Thu, 18 Jan 2018 21:29:52 +0100</div><div>Subject: [PATCH 4/5] Increase cma memory to 64M to allow proper vc4 GPU</div><div> initialization.</div><div><br></div><div>On arm64 this has no impact since CONFIG_CMA_SIZE_MBYTES is anyway set</div><div>to 64. On armmp-lpae CONFIG_CMA_SIZE_MBYTES is set to 16. 16M are not</div><div>sufficient for the vc4 GPU driver initialization.</div><div>---</div><div> debian/kernel/postinst.d/raspi3-firmware | 2 +-</div><div> 1 file changed, 1 insertion(+), 1 deletion(-)</div><div><br></div><div>diff --git a/debian/kernel/postinst.d/raspi3-firmware b/debian/kernel/postinst.d/raspi3-firmware</div><div>index b76a73e..857283e 100755</div><div>--- a/debian/kernel/postinst.d/raspi3-firmware</div><div>+++ b/debian/kernel/postinst.d/raspi3-firmware</div><div>@@ -101,7 +101,7 @@ fi</div><div> # without parameters for drivers we do not have (e.g. dwc_otg.lpm_enable) or</div><div> # parameters we do not need (e.g. rootfstype=, as we are using an initrd).</div><div> cat >/boot/firmware/cmdline.txt <<EOF</div><div>-console=tty0 console=${serial} root=/dev/mmcblk0p2 rw elevator=deadline fsck.repair=yes net.ifnames=0 rootwait</div><div>+console=tty0 console=${serial} root=/dev/mmcblk0p2 rw elevator=deadline fsck.repair=yes net.ifnames=0 cma=64M rootwait</div><div> EOF</div><div> </div><div> cd /boot/firmware</div><div>-- </div><div>2.7.4</div><div><br></div><div>From 777815364f0fdacc6806eb43e10d8b6e6f7eca2c Mon Sep 17 00:00:00 2001</div><div>From: =?UTF-8?q?Matthias=20L=C3=BCscher?= <<a href="mailto:lueschem@gmail.com">lueschem@gmail.com</a>></div><div>Date: Thu, 18 Jan 2018 21:58:34 +0100</div><div>Subject: [PATCH 5/5] Adjusted package description.</div><div><br></div><div>---</div><div> debian/control | 4 ++--</div><div> 1 file changed, 2 insertions(+), 2 deletions(-)</div><div><br></div><div>diff --git a/debian/control b/debian/control</div><div>index 97d7bbf..dfdbae3 100644</div><div>--- a/debian/control</div><div>+++ b/debian/control</div><div>@@ -15,8 +15,8 @@ Architecture: arm64 armhf</div><div> Depends: ${shlibs:Depends}, ${misc:Depends}, dosfstools</div><div> Breaks: linux-firmware-raspi3 (<< 1.20161123-2)</div><div> Replaces: linux-firmware-raspi3 (<< 1.20161123-2)</div><div>-Description: Raspberry Pi 3 GPU firmware and bootloaders</div><div>+Description: Raspberry Pi 2 and 3 GPU firmware and bootloaders</div><div>  This package contains all the proprietary files necessary to boot a</div><div>- Raspberry Pi 3 board.</div><div>+ Raspberry Pi 2 or 3 board.</div><div>  .</div><div>  Raspberry Pi is a trademark of the Raspberry Pi Foundation.</div><div>-- </div><div>2.7.4</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-01-23 22:27 GMT+01:00 Matthias Luescher <span dir="ltr"><<a href="mailto:lueschem@gmail.com" target="_blank">lueschem@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Hi Michael</div><div class="gmail_extra"><br></div><div class="gmail_extra">Here are the revised patches.</div><div class="gmail_extra">Many thanks for taking a look at my modifications!</div><div class="gmail_extra"><br></div><div class="gmail_extra">Best regards<span class="HOEnZb"><font color="#888888"><br>Matthias</font></span></div><div class="gmail_extra"><br></div><div class="gmail_extra">P.S.: Here is the temporary GitHub repository containing the same modifications:</div><div class="gmail_extra"><a href="https://github.com/lueschem/raspi3-firmware/commits/raspi3_firmware_tweaks_v2" target="_blank">https://github.com/lueschem/<wbr>raspi3-firmware/commits/<wbr>raspi3_firmware_tweaks_v2</a><br></div><div class="gmail_extra"><br></div></div>
</blockquote></div><br></div>