Package: u-boot-menu Version: 4.0.4mobian1 Severity: wishlist Tags: patch Dear Maintainer,
some devices using u-boot as bootloader could benefit from loading dtbo on top of the standard dtb provided by the kernel. Such as extension board or minor hardware modification. U-boot has support for applying dtbo with the fdtoverlays command. The attached patch allow the use of the fdtoverlays command. It allow applying all *.dtbo files from a specific folder or specifying only some files to be loaded via the configuration variables. The initial submit was made as a merge request on salsa[1]. [1] https://salsa.debian.org/debian/u-boot-menu/-/merge_requests/4 Best regards Alexandre -- System Information: Debian Release: bookworm/sid APT prefers testing APT policy: (500, 'testing'), (400, 'unstable') Architecture: arm64 (aarch64) Kernel: Linux 5.17-arm64-mobian (SMP w/6 CPU threads; PREEMPT) Kernel taint flags: TAINT_WARN, TAINT_CRAP, TAINT_UNSIGNED_MODULE Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages u-boot-menu depends on: ii linux-base 4.9 Versions of packages u-boot-menu recommends: ii rsync 3.2.4-1+b1 Versions of packages u-boot-menu suggests: pn flash-kernel <none> -- Configuration Files: /etc/default/u-boot [Errno 2] No such file or directory: '/etc/default/u-boot' -- no debconf information
>From cc07c0fd63ae6fa89ad50624d26de06e32b3ffe0 Mon Sep 17 00:00:00 2001 From: Alexandre Viard <[email protected]> Date: Fri, 17 Jun 2022 15:29:01 +0200 Subject: [PATCH] add support for fdtoverlays command --- default | 2 ++ u-boot-update | 33 ++++++++++++++++++++++++++++++++- u-boot-update.8 | 10 ++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/default b/default index 4389a87..2e29c83 100644 --- a/default +++ b/default @@ -11,4 +11,6 @@ #U_BOOT_TIMEOUT="50" #U_BOOT_FDT="" #U_BOOT_FDT_DIR="/usr/lib/linux-image-" +#U_BOOT_FDT_OVERLAYS="" +#U_BOOT_FDT_OVERLAYS_DIR="/boot/dtbo/" diff --git a/u-boot-update b/u-boot-update index 1c8ffe5..96a9431 100755 --- a/u-boot-update +++ b/u-boot-update @@ -1,5 +1,4 @@ #!/bin/bash - ## Copyright (C) 2006-2012 Daniel Baumann <[email protected]> ## Copyright (C) 2016-2017 Riku Voipio <[email protected]> ## @@ -92,6 +91,8 @@ U_BOOT_TIMEOUT="${U_BOOT_TIMEOUT:-50}" U_BOOT_MENU_LABEL="${U_BOOT_MENU_LABEL:-${PRETTY_NAME:-Debian GNU/Linux kernel}}" U_BOOT_PARAMETERS="${U_BOOT_PARAMETERS:-ro quiet}" U_BOOT_FDT_DIR="${U_BOOT_FDT_DIR:-/usr/lib/linux-image-}" +U_BOOT_FDT_OVERLAYS="${U_BOOT_FDT_OVERLAYS:-}" +U_BOOT_FDT_OVERLAYS_DIR="${U_BOOT_FDT_OVERLAYS_DIR:-/boot/dtbo}" U_BOOT_INITRD="${U_BOOT_INITRD:-initrd.img}" # Find parameter for root from fstab @@ -192,6 +193,34 @@ do _FDT="" fi + if [ -d ${_BOOT_PATH}/${U_BOOT_FDT_OVERLAYS_DIR} ] + then + _DTBO_LIST="" + if [ ! -z "${U_BOOT_FDT_OVERLAYS}" ] + then + for _DTBO in ${U_BOOT_FDT_OVERLAYS} + do + if [ -f "${_BOOT_PATH}/${U_BOOT_FDT_OVERLAYS_DIR}/${_DTBO}" ] + then + _DTBO_LIST="${_DTBO_LIST} ${_BOOT_DIRECTORY}${U_BOOT_FDT_OVERLAYS_DIR}/${_DTBO}" + fi + done + else + for _DTBO_PATH in ${_BOOT_PATH}/${U_BOOT_FDT_OVERLAYS_DIR}/*.dtbo + do + if [ -f ${_DTBO_PATH} ] + then + _DTBO=$(basename ${_DTBO_PATH}) + _DTBO_LIST="${_DTBO_LIST} ${_BOOT_DIRECTORY}${U_BOOT_FDT_OVERLAYS_DIR}/${_DTBO}" + fi + done + fi + if [ ! -z "${_DTBO_LIST}" ] + then + _FDTOVERLAYS="fdtoverlays ${_DTBO_LIST}" + fi + fi + if echo ${U_BOOT_ALTERNATIVES} | grep -q default then @@ -203,6 +232,7 @@ label l${_NUMBER} linux ${_BOOT_DIRECTORY}/${_KERNEL} ${_INITRD} ${_FDT} + ${_FDTOVERLAYS} append ${U_BOOT_ROOT} ${U_BOOT_PARAMETERS}" fi @@ -218,6 +248,7 @@ label l${_NUMBER}r linux ${_BOOT_DIRECTORY}/${_KERNEL} ${_INITRD} ${_FDT} + ${_FDTOVERLAYS} append ${U_BOOT_ROOT} $(echo ${U_BOOT_PARAMETERS} | sed -e 's| quiet||') single " diff --git a/u-boot-update.8 b/u-boot-update.8 index 0aa2998..dfc3cd7 100644 --- a/u-boot-update.8 +++ b/u-boot-update.8 @@ -105,6 +105,16 @@ This variable specifies filename or trailing part of path for a single device tree binary. Default is 'device-tree.dtb'. +.IP "U_BOOT_FDT_OVERLAYS_DIR=""\fB/boot/dtbo\fR""" 4 +This variable specifies the unversioned stem of paths +where U\-BOOT should look for the flattened device tree overlays binaries. +Default is '/boot/dtbo/'. + +.IP "U_BOOT_FDT_OVERLAYS=""device-tree.dtbo""" 4 +This variable specifies filenames or trailing part of path +for device tree overlay binaries. +Default is not set. + .IP "U_BOOT_INITRD=""\fBinitrd.img\fR""" 4 This variable specifies the unversioned stem of initramfs filename. If versioned filename exists (e.g. 'initrd.img-5.10.0-8-armmp-lpae') -- 2.36.1

