From c321684a03764468877aee6b92b49835a6550990 Mon Sep 17 00:00:00 2001 From: Kristian Amlie Date: Tue, 28 Jan 2020 15:33:39 +0100 Subject: [PATCH] Make sure that DTB files are included on boot partition. This is important so that the bootloader (U-Boot) can use the DTB files when chainloading GRUB via UEFI. The logic for doing this is already present in `distro_bootcmd`, but because we were not placing the DTB files in the correct folder, this part was skipped. Changelog: Fix certain kernels hanging on boot. In particular, recent versions of Debian for Beaglebone was affected, but several other boards using UEFI may also have been affected. Signed-off-by: Kristian Amlie --- mender-convert-modify | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mender-convert-modify b/mender-convert-modify index 16d4a6c..e6cd741 100755 --- a/mender-convert-modify +++ b/mender-convert-modify @@ -164,6 +164,18 @@ EOF run_and_log_cmd "sudo mkdir -p work/boot/EFI/BOOT" run_and_log_cmd "sudo cp work/${efi_name} -P work/boot/EFI/BOOT/${efi_target_name}" + + # Copy dtb directory to the boot partition for use by the bootloader. + if [ -d work/rootfs/boot/dtbs ]; then + # Look for the first directory that has dtb files. First check the base + # folder, then any subfolders in versioned order. + for candidate in work/rootfs/boot/dtbs $(find work/rootfs/boot/dtbs/ -maxdepth 1 -type d | sort -V -r); do + if [ $(find $candidate -maxdepth 1 -name '*.dtb' | wc -l) -gt 0 ]; then + run_and_log_cmd "cp -r $candidate work/boot/dtb" + break + fi + done + fi fi run_and_log_cmd "sudo mkdir -p work/rootfs/data/mender"