efi_loader: Improvements to .dtb handling
cover efi_loader: Improvements to .dtb handling
Hi,
This series modifies the distro boot scripts to better cope with real-world .dtb scenarios. In particular openSUSE images have the EFI GRUB2 and optional .dtb files on separate partitions (fat vs. ext4) and installed to /boot/dtb-foo symlink, which may be /dtb or /boot/dtb for U-Boot. The goal is to obsolete less sophisticated openSUSE patches and to improve the testing experience.
Further, while testing on the DragonBoard 410c, I ran into U-Boot vs. Linux naming inconsistencies once again and suggest a workaround: ${soc_vendor}.
For easier review a cleanup patch is prepended.
Regards,
Andreas
Andreas F?rber (6):
efi_loader: Cosmetic distro script cleanups
efi_loader: Respect $boot_prefixes for EFI .dtb search
efi_loader: Search .dtb on non-EFI partitions
efi_loader: Improve .dtb search for arm64
dragonboard410c: Set soc_vendor
efi_loader: Display which .dtb we found
include/config_distro_bootcmd.h | 59 ++++++++++++++++++++++++++++++--------- include/configs/dragonboard410c.h | 1 + 2 files changed, 47 insertions(+), 13 deletions(-)
Signature · 1 line
2.6.6
PATCH 1/6 efi_loader: Cosmetic distro script cleanups
Fix a macro line break whose alignment slipped in commit fba5f93. Be consistent in having trailing spaces after semicolon. While at it, drop a duplicate white line.
--- include/config_distro_bootcmd.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
include/config_distro_bootcmd.h +5 -6
@@ -113,15 +113,14 @@#define BOOTENV_EFI_SET_FDTFILE_FALLBACK #endif -#define BOOTENV_SHARED_EFI \ "boot_efi_binary=" \ "load ${devtype} ${devnum}:${distro_bootpart} " \ "${kernel_addr_r} efi/boot/"BOOTEFI_NAME"; " \ "if fdt addr ${fdt_addr_r}; then " \ - "bootefi ${kernel_addr_r} ${fdt_addr_r};" \ - "else " \ - "bootefi ${kernel_addr_r} ${fdtcontroladdr};" \ + "bootefi ${kernel_addr_r} ${fdt_addr_r}; " \ + "else " \ + "bootefi ${kernel_addr_r} ${fdtcontroladdr}; " \ "fi\0" \ \ "load_efi_dtb=" \
@@ -137,8 +136,8 @@"${devnum}:${distro_bootpart} " \"${prefix}${efi_fdtfile}; then " \"run load_efi_dtb; " \ -"fi;" \ -"done;" \ +"fi; " \ +"done; " \"if test -e ${devtype} ${devnum}:${distro_bootpart} " \"efi/boot/" BOOTEFI_NAME "; then " \"echo Found EFI removable media binary " \
Signature · 1 line
2.6.6
PATCH 2/6 efi_loader: Respect $boot_prefixes for EFI .dtb search
In reply to Andreas FärberJust like boot configs or scripts, .dtb files may be in /boot. Search $efi_dtb_prefixes for all $boot_prefixes.
--- include/config_distro_bootcmd.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
include/config_distro_bootcmd.h +15 -9
@@ -125,19 +125,25 @@ \"load_efi_dtb=" \"load ${devtype} ${devnum}:${distro_bootpart} " \ -"${fdt_addr_r} ${prefix}${efi_fdtfile}\0" \ +"${fdt_addr_r} " \ +"${prefix}${dtb_prefix}${efi_fdtfile}\0" \ \ -"efi_dtb_prefixes=/ /dtb/ /dtb/current/\0" \ +"efi_dtb_prefixes=\"\" dtb/ dtb/current/\0" \ +"scan_dev_for_efi_fdt=" \ +"for prefix in ${boot_prefixes}; do " \ +"for dtb_prefix in ${efi_dtb_prefixes}; do " \ +"if test -e ${devtype} " \ +"${devnum}:${distro_bootpart} " \ +"${prefix}${dtb_prefix}" \ +"${efi_fdtfile}; then " \ +"run load_efi_dtb; " \ +"fi; " \ +"done; " \ +"done\0" \"scan_dev_for_efi=" \"setenv efi_fdtfile ${fdtfile}; " \BOOTENV_EFI_SET_FDTFILE_FALLBACK \ -"for prefix in ${efi_dtb_prefixes}; do " \ -"if test -e ${devtype} " \ -"${devnum}:${distro_bootpart} " \ -"${prefix}${efi_fdtfile}; then " \ -"run load_efi_dtb; " \ -"fi; " \ -"done; " \ +"run scan_dev_for_efi_fdt; " \"if test -e ${devtype} ${devnum}:${distro_bootpart} " \"efi/boot/" BOOTEFI_NAME "; then " \"echo Found EFI removable media binary " \
Signature · 1 line
2.6.6
PATCH 3/6 efi_loader: Search .dtb on non-EFI partitions
In reply to Andreas FärberA UEFI setup will typically have an EFI FAT partition, but device trees are more likely to be located on, e.g., Linux volumes. By convention the EFI partition will usually be placed first, so that we would find the EFI removable media binary and enter it without device tree from disk.
Therefore after finding an EFI removable media binary, probe other partitions on the same device for .dtb files.
In the default case the behavior will be unchanged in that only the first partition is searched.
In the case that there are two partitions marked bootable and the first being EFI, we will first check the first partition, then the second partition for the .dtb.
Duplicate loading will only result from non-first EFI partition order.
--- include/config_distro_bootcmd.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
include/config_distro_bootcmd.h +12 -4
@@ -124,8 +124,7 @@"fi\0" \ \"load_efi_dtb=" \ -"load ${devtype} ${devnum}:${distro_bootpart} " \ -"${fdt_addr_r} " \ +"load ${devtype} ${devnum}:${efi_bootpart} ${fdt_addr_r} " \"${prefix}${dtb_prefix}${efi_fdtfile}\0" \ \"efi_dtb_prefixes=\"\" dtb/ dtb/current/\0" \
@@ -133,7 +132,7 @@"for prefix in ${boot_prefixes}; do " \"for dtb_prefix in ${efi_dtb_prefixes}; do " \"if test -e ${devtype} " \ -"${devnum}:${distro_bootpart} " \ +"${devnum}:${efi_bootpart} " \"${prefix}${dtb_prefix}" \"${efi_fdtfile}; then " \"run load_efi_dtb; " \
@@ -143,13 +142,22 @@"scan_dev_for_efi=" \"setenv efi_fdtfile ${fdtfile}; " \BOOTENV_EFI_SET_FDTFILE_FALLBACK \ -"run scan_dev_for_efi_fdt; " \"if test -e ${devtype} ${devnum}:${distro_bootpart} " \"efi/boot/" BOOTEFI_NAME "; then " \"echo Found EFI removable media binary " \"efi/boot/" BOOTEFI_NAME "; " \ +"for efi_bootpart in ${devplist}; do " \ +"echo Scanning for device tree " \ +"on ${devtype} ${devnum}" \ +":${efi_bootpart}...; " \ +"run scan_dev_for_efi_fdt; " \ +"done; " \"run boot_efi_binary; " \"echo EFI LOAD FAILED: continuing...; " \ +"else " \ +"setenv efi_bootpart ${distro_bootpart}; " \ +"run scan_dev_for_efi_fdt; " \ +"setenv efi_bootpart; " \"fi; " \"setenv efi_fdtfile\0" #define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;"
Signature · 1 line
2.6.6
PATCH 3/6 efi_loader: Search .dtb on non-EFI partitions
Quoted 47 lines · Andreas F?rber
A UEFI setup will typically have an EFI FAT partition, but device trees are more likely to be located on, e.g., Linux volumes. By convention the EFI partition will usually be placed first, so that we would find the EFI removable media binary and enter it without device tree from disk.
Therefore after finding an EFI removable media binary, probe other partitions on the same device for .dtb files.
In the default case the behavior will be unchanged in that only the first partition is searched.
In the case that there are two partitions marked bootable and the first being EFI, we will first check the first partition, then the second partition for the .dtb.
Duplicate loading will only result from non-first EFI partition order.Cc Alexander Graf <[email protected]>Signed-off-by Andreas F?rber <[email protected]>--- include/config_distro_bootcmd.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)include/config_distro_bootcmd.h +2
-3@@ -124,8 +124,7 @@"fi\0" \ \"load_efi_dtb=" \ -"load ${devtype} ${devnum}:${distro_bootpart} " \ -"${fdt_addr_r} " \ +"load ${devtype} ${devnum}:${efi_bootpart} ${fdt_addr_r} " \"${prefix}${dtb_prefix}${efi_fdtfile}\0" \ \"efi_dtb_prefixes=\"\" dtb/ dtb/current/\0" \@@ -133,7 +132,7 @@"for prefix in ${boot_prefixes}; do " \"for dtb_prefix in ${efi_dtb_prefixes}; do " \"if test -e ${devtype} " \ -"${devnum}:${distro_bootpart} " \ +"${devnum}:${efi_bootpart} " \"${prefix}${dtb_prefix}" \"${efi_fdtfile}; then " \"run load_efi_dtb; " \@@ -143,13 +142,22 @@"scan_dev_for_efi=" \"setenv efi_fdtfile ${fdtfile}; " \
include/config_distro_bootcmd.h line 152
Quoted 10 lines
include/config_distro_bootcmd.h +4
-1BOOTENV_EFI_SET_FDTFILE_FALLBACK \ -"run scan_dev_for_efi_fdt; " \"if test -e ${devtype} ${devnum}:${distro_bootpart} " \"efi/boot/" BOOTEFI_NAME "; then " \"echo Found EFI removable media binary " \"efi/boot/" BOOTEFI_NAME "; " \ +"for efi_bootpart in ${devplist}; do " \ +"echo Scanning for device tree " \ +"on ${devtype} ${devnum}" \ +":${efi_bootpart}...; " \
Printing can be quite slow on certain devices (think LCDs with uncached vram access), but have a *lot* of partitions (think Android partition scheme). I don't think we should print out every partition we're searching in, only the ones we find something at.
Maybe something like
Found EFI removable media binary in efi/boot/bootaa64.efi. Searching for dtb on mmc 0 ...
Found dtb on mmc 0:1 boot/dtb/foobar.dtb
would be a sensible amount of debug output :).
Also given that we're now running 3 cascaded for loops, it might be about time to think about how to break out of the loops in case we actually found something, so that the "normal" case is faster.
Alex
Quoted 12 lines
include/config_distro_bootcmd.h +6
-0+"run scan_dev_for_efi_fdt; " \ +"done; " \"run boot_efi_binary; " \"echo EFI LOAD FAILED: continuing...; " \ +"else " \ +"setenv efi_bootpart ${distro_bootpart}; " \ +"run scan_dev_for_efi_fdt; " \ +"setenv efi_bootpart; " \"fi; " \"setenv efi_fdtfile\0" #define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;"
PATCH 3/6 efi_loader: Search .dtb on non-EFI partitions
Am 12.07.2016 um 09:25 schrieb Alexander Graf:
Quoted 66 lines · Andreas F?rber
Quoted 47 lines
A UEFI setup will typically have an EFI FAT partition, but device trees are more likely to be located on, e.g., Linux volumes. By convention the EFI partition will usually be placed first, so that we would find the EFI removable media binary and enter it without device tree from disk.
Therefore after finding an EFI removable media binary, probe other partitions on the same device for .dtb files.
In the default case the behavior will be unchanged in that only the first partition is searched.
In the case that there are two partitions marked bootable and the first being EFI, we will first check the first partition, then the second partition for the .dtb.
Duplicate loading will only result from non-first EFI partition order.Cc Alexander Graf <[email protected]>Signed-off-by Andreas F?rber <[email protected]>--- include/config_distro_bootcmd.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)include/config_distro_bootcmd.h +2
-3@@ -124,8 +124,7 @@"fi\0" \ \"load_efi_dtb=" \ -"load ${devtype} ${devnum}:${distro_bootpart} " \ -"${fdt_addr_r} " \ +"load ${devtype} ${devnum}:${efi_bootpart} ${fdt_addr_r} " \"${prefix}${dtb_prefix}${efi_fdtfile}\0" \ \"efi_dtb_prefixes=\"\" dtb/ dtb/current/\0" \@@ -133,7 +132,7 @@"for prefix in ${boot_prefixes}; do " \"for dtb_prefix in ${efi_dtb_prefixes}; do " \"if test -e ${devtype} " \ -"${devnum}:${distro_bootpart} " \ +"${devnum}:${efi_bootpart} " \"${prefix}${dtb_prefix}" \"${efi_fdtfile}; then " \"run load_efi_dtb; " \@@ -143,13 +142,22 @@"scan_dev_for_efi=" \"setenv efi_fdtfile ${fdtfile}; " \include/config_distro_bootcmd.h line 152
Quoted 10 lines
include/config_distro_bootcmd.h +4
-1BOOTENV_EFI_SET_FDTFILE_FALLBACK \ -"run scan_dev_for_efi_fdt; " \"if test -e ${devtype} ${devnum}:${distro_bootpart} " \"efi/boot/" BOOTEFI_NAME "; then " \"echo Found EFI removable media binary " \"efi/boot/" BOOTEFI_NAME "; " \ +"for efi_bootpart in ${devplist}; do " \ +"echo Scanning for device tree " \ +"on ${devtype} ${devnum}" \ +":${efi_bootpart}...; " \Printing can be quite slow on certain devices (think LCDs with uncached vram access), but have a *lot* of partitions (think Android partition scheme). I don't think we should print out every partition we're searching in, only the ones we find something at.
Quoted 7 lines
Maybe something like
Found EFI removable media binary in efi/boot/bootaa64.efi. Searching for dtb on mmc 0 ...
Found dtb on mmc 0:1 boot/dtb/foobar.dtbwould be a sensible amount of debug output :).
No, please read again! I am not printing every partition we're searching, only in the new inner loop, which will likely be exactly twice, once for FAT, once for ext.
For the "else" below we already get that output from the regular distro framework.
In particular "mmc 0" is not enough and absolutely not helping. I need to see that we're searching the right partition if we don't find a .dtb, i.e. mmc 0:2.
Quoted 3 lines
Also given that we're now running 3 cascaded for loops, it might be about time to think about how to break out of the loops in case we actually found something, so that the "normal" case is faster.
True point, I noticed that as well. :)
Note that I thought about adding the vendor to $efi_dtb_prefixes but couldn't think of a way other than looping at runtime.
Regards,
Andreas
Quoted 16 lines
Alex
Quoted 12 lines
include/config_distro_bootcmd.h +6
-0+"run scan_dev_for_efi_fdt; " \ +"done; " \"run boot_efi_binary; " \"echo EFI LOAD FAILED: continuing...; " \ +"else " \ +"setenv efi_bootpart ${distro_bootpart}; " \ +"run scan_dev_for_efi_fdt; " \ +"setenv efi_bootpart; " \"fi; " \"setenv efi_fdtfile\0" #define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;"
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)
PATCH 4/6 efi_loader: Improve .dtb search for arm64
In reply to Andreas FärberOn arm64 Linux device trees are organized by SoC vendor. Therefore we need to search the vendor subdirectory as well.
Since the SoC vendor may be different from ${vendor}, introduce a new ${soc_vendor}. If this is not set, the behavior remains unchanged.
--- include/config_distro_bootcmd.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
include/config_distro_bootcmd.h +17 -1
@@ -113,6 +113,15 @@#define BOOTENV_EFI_SET_FDTFILE_FALLBACK #endif +#if defined(CONFIG_ARM64 ) +#define BOOTENV_EFI_SET_FDTFILE_VENDOR \ + "if test -n \"${soc_vendor}\"; then " \ + "setenv efi_dtb_vendor_prefix ${soc_vendor}/; " \ + "fi; " +#else +#define BOOTENV_EFI_SET_FDTFILE_VENDOR +#endif +#define BOOTENV_SHARED_EFI \ "boot_efi_binary=" \ "load ${devtype} ${devnum}:${distro_bootpart} " \
@@ -125,18 +134,25 @@ \"load_efi_dtb=" \"load ${devtype} ${devnum}:${efi_bootpart} ${fdt_addr_r} " \ -"${prefix}${dtb_prefix}${efi_fdtfile}\0" \ +"${prefix}${dtb_prefix}${dtb_vendor_prefix}" \ +"${efi_fdtfile}\0" \ \"efi_dtb_prefixes=\"\" dtb/ dtb/current/\0" \"scan_dev_for_efi_fdt=" \"for prefix in ${boot_prefixes}; do " \"for dtb_prefix in ${efi_dtb_prefixes}; do " \ +BOOTENV_EFI_SET_FDTFILE_VENDOR \ +"for dtb_vendor_prefix in \"\" " \ +"${efi_dtb_vendor_prefix}; do " \"if test -e ${devtype} " \"${devnum}:${efi_bootpart} " \"${prefix}${dtb_prefix}" \ +"${dtb_vendor_prefix}" \"${efi_fdtfile}; then " \"run load_efi_dtb; " \"fi; " \ +"done; " \ +"setenv efi_dtb_vendor_prefix; " \"done; " \"done\0" \"scan_dev_for_efi=" \
Signature · 1 line
2.6.6
PATCH 4/6 efi_loader: Improve .dtb search for arm64
Quoted 8 lines · Andreas F?rber
On arm64 Linux device trees are organized by SoC vendor. Therefore we need to search the vendor subdirectory as well.
Since the SoC vendor may be different from ${vendor}, introduce a new ${soc_vendor}. If this is not set, the behavior remains unchanged.
Cc Alexander Graf <[email protected]>Signed-off-by Andreas F?rber <[email protected]>
Stephen had pretty strong opinions on the naming, mostly because "pxe boot" uses the same naming scheme. So we should either change it there as well to stay consistent or just make the implicit ruling always work :).
I guess the best case would be to fix up the path names of boards so that $vendor is always $soc_vendor. Do you have an example where that wouldn't work?
Alex
Quoted 52 lines
--- include/config_distro_bootcmd.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)include/config_distro_bootcmd.h +17
-1@@ -113,6 +113,15 @@#define BOOTENV_EFI_SET_FDTFILE_FALLBACK #endif +#if defined(CONFIG_ARM64 ) +#define BOOTENV_EFI_SET_FDTFILE_VENDOR \ + "if test -n \"${soc_vendor}\"; then " \ + "setenv efi_dtb_vendor_prefix ${soc_vendor}/; " \ + "fi; " +#else +#define BOOTENV_EFI_SET_FDTFILE_VENDOR +#endif +#define BOOTENV_SHARED_EFI \ "boot_efi_binary=" \ "load ${devtype} ${devnum}:${distro_bootpart} " \@@ -125,18 +134,25 @@ \"load_efi_dtb=" \"load ${devtype} ${devnum}:${efi_bootpart} ${fdt_addr_r} " \ -"${prefix}${dtb_prefix}${efi_fdtfile}\0" \ +"${prefix}${dtb_prefix}${dtb_vendor_prefix}" \ +"${efi_fdtfile}\0" \ \"efi_dtb_prefixes=\"\" dtb/ dtb/current/\0" \"scan_dev_for_efi_fdt=" \"for prefix in ${boot_prefixes}; do " \"for dtb_prefix in ${efi_dtb_prefixes}; do " \ +BOOTENV_EFI_SET_FDTFILE_VENDOR \ +"for dtb_vendor_prefix in \"\" " \ +"${efi_dtb_vendor_prefix}; do " \"if test -e ${devtype} " \"${devnum}:${efi_bootpart} " \"${prefix}${dtb_prefix}" \ +"${dtb_vendor_prefix}" \"${efi_fdtfile}; then " \"run load_efi_dtb; " \"fi; " \ +"done; " \ +"setenv efi_dtb_vendor_prefix; " \"done; " \"done\0" \"scan_dev_for_efi=" \
PATCH 4/6 efi_loader: Improve .dtb search for arm64
Am 12.07.2016 um 09:29 schrieb Alexander Graf:
Quoted 10 lines · Andreas F?rber
Quoted 8 lines
On arm64 Linux device trees are organized by SoC vendor. Therefore we need to search the vendor subdirectory as well.
Since the SoC vendor may be different from ${vendor}, introduce a new ${soc_vendor}. If this is not set, the behavior remains unchanged.
Cc Alexander Graf <[email protected]>Signed-off-by Andreas F?rber <[email protected]>
Quoted 7 lines
Stephen had pretty strong opinions on the naming, mostly because "pxe boot" uses the same naming scheme. So we should either change it there as well to stay consistent or just make the implicit ruling always work :).
I guess the best case would be to fix up the path names of boards so that $vendor is always $soc_vendor. Do you have an example where that wouldn't work?
AFAIU for U-Boot $vendor is often the board vendor and matches the board/ subdirectory, so there may be plenty vendors. I didn't see any code setting this value, so I assume this comes from .config options.
My $soc_vendor is the SoC vendor instead and only for the environment.
And because there were opinions on how to form the 32-bit efi_fdtfile, both Tom and Stephen were CC'ed on the cover letter. :)
On the dragonboard410c:CONFIG_SYS_SOC="snapdragon"CONFIG_SYS_VENDOR="qualcomm" CONFIG_SYS_BOARD="dragonboard410c" CONFIG_SYS_CONFIG_NAME="dragonboard410c"
soc=snapdragon
vendor=qualcomm
board=dragonboard410c
board_name=dragonboard410c
=> Therefore my previous patch setting fdtfile to apq8016-sbc.dtb, because it is absolutely different. This patch allows searching qcom/ for our dtb-qcom aarch64 openSUSE package.
On the odroid-c2:CONFIG_SYS_SOC="meson"CONFIG_SYS_VENDOR="amlogic"CONFIG_SYS_BOARD="odroid-c2" CONFIG_SYS_CONFIG_NAME="odroid-c2"
board=odroid-c2
board_name=odroid-c2
soc=meson
vendor=amlogic
=> Here $vendor would match Linux' dts subdirectory, but $soc and $board are wrong, I need fdtfile=meson-gxbb-odroidc2.dtb.
But maybe I'm just not understanding what all those configs are good for and how deeply they're tied to board/ subdirectories and mach-foo? If we can clean them up to match Linux then all the better. If that were intended, I wonder why no one flagged that during review.
Anyway, maybe add an else clause to this patch and reuse $vendor if $soc_vendor is unavailable?
Regards,
Andreas
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)
PATCH 4/6 efi_loader: Improve .dtb search for arm64
Am 12.07.2016 um 14:38 schrieb Andreas F?rber:
Quoted 41 lines
Am 12.07.2016 um 09:29 schrieb Alexander Graf:
Quoted 10 lines · Andreas F?rber
Quoted 8 lines
On arm64 Linux device trees are organized by SoC vendor. Therefore we need to search the vendor subdirectory as well.
Since the SoC vendor may be different from ${vendor}, introduce a new ${soc_vendor}. If this is not set, the behavior remains unchanged.
Cc Alexander Graf <[email protected]>Signed-off-by Andreas F?rber <[email protected]>Quoted 7 lines
Stephen had pretty strong opinions on the naming, mostly because "pxe boot" uses the same naming scheme. So we should either change it there as well to stay consistent or just make the implicit ruling always work :).
I guess the best case would be to fix up the path names of boards so that $vendor is always $soc_vendor. Do you have an example where that wouldn't work?
AFAIU for U-Boot $vendor is often the board vendor and matches the board/ subdirectory, so there may be plenty vendors. I didn't see any code setting this value, so I assume this comes from .config options.
My $soc_vendor is the SoC vendor instead and only for the environment.
And because there were opinions on how to form the 32-bit
efi_fdtfile, both Tom and Stephen were CC'ed on the cover letter. :)On the dragonboard410c:
CONFIG_SYS_SOC="snapdragon"CONFIG_SYS_VENDOR="qualcomm"CONFIG_SYS_BOARD="dragonboard410c"CONFIG_SYS_CONFIG_NAME="dragonboard410c"
soc=snapdragon
vendor=qualcomm
board=dragonboard410c
board_name=dragonboard410c
=> Therefore my previous patch setting fdtfile to apq8016-sbc.dtb, because it is absolutely different. This patch allows searching qcom/ for our dtb-qcom aarch64 openSUSE package.
Quoted 11 lines
On the odroid-c2:
CONFIG_SYS_SOC="meson"CONFIG_SYS_VENDOR="amlogic"CONFIG_SYS_BOARD="odroid-c2"CONFIG_SYS_CONFIG_NAME="odroid-c2"
board=odroid-c2
board_name=odroid-c2
soc=meson
vendor=amlogic
=> Here $vendor would match Linux' dts subdirectory, but $soc and $board are wrong, I need fdtfile=meson-gxbb-odroidc2.dtb.
Adding a 32-bit example:
On the firefly-rk3288:CONFIG_SYS_SOC="rockchip"CONFIG_SYS_VENDOR="firefly" CONFIG_SYS_BOARD="firefly-rk3288" CONFIG_SYS_CONFIG_NAME="firefly-rk3288"
board=firefly-rk3288
board_name=firefly-rk3288
soc=rockchip
vendor=firefly
=> $vendor is not the SoC vendor, it's the board vendor. My point. => $soc is not rk3288, as needed for the ${soc}-${board}${boardrev}.dtb formula. We either need to fix $soc or define $fdtfile.
Further, I have an early board that needs rk3288-firefly-beta.dtb instead of rk3288-firefly.dtb. No hits for git grep firefly-beta, so there doesn't seem to be any auto-detection...
Note that ~2016.07 seemed to be completely busted on this board, see the multiple discussions about disabling EFI_LOADER and other random options as workaround. Not even bootz succeeded for me any more.
Having a default way to load some uboot.env or uEnv.txt file might help the user set $fdtfile and similar options while still using the default boot mechanism.
Quoted 11 lines
But maybe I'm just not understanding what all those configs are good for and how deeply they're tied to board/ subdirectories and mach-foo? If we can clean them up to match Linux then all the better. If that were intended, I wonder why no one flagged that during review.
Anyway, maybe add an else clause to this patch and reuse $vendor if $soc_vendor is unavailable?
Regards,
Andreas
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)
PATCH 4/6 efi_loader: Improve .dtb search for arm64
In reply to Alexander GrafQuoted 12 lines · Alexander Graf
Quoted 8 lines · Andreas F?rber
On arm64 Linux device trees are organized by SoC vendor. Therefore we need to search the vendor subdirectory as well.
Since the SoC vendor may be different from ${vendor}, introduce a new ${soc_vendor}. If this is not set, the behavior remains unchanged.
Cc Alexander Graf <[email protected]>Signed-off-by Andreas F?rber <[email protected]>
Quoted 7 lines
Stephen had pretty strong opinions on the naming, mostly because "pxe boot" uses the same naming scheme. So we should either change it there as well to stay consistent or just make the implicit ruling always work :).
I guess the best case would be to fix up the path names of boards so that $vendor is always $soc_vendor. Do you have an example where that wouldn't work?
All I'll say is that if the "auto calculation" algorithm of ${soc}-${board}.dtb doesn't work, U-Boot should set ${fdtfile} with the correct full name. Introducing other more complex "auto calculation" is just going to lead to more complexity and yet still not solve 100% of the cases, which will be confusing.
I'm unlikely to review any other aspects of the series, since I'm still quite disappointed that distros wouldn't engage in the discussions boot methods and agree on one solution, and that config_distro*.h is being abused as a dumping ground for tons of different boot methods; the whole point of it was to unify on *one* method that distros could rely upon, which is the opposite of where it's now going:-(
PATCH 4/6 efi_loader: Improve .dtb search for arm64
In reply to Andreas FärberQuoted 17 lines · Andreas F?rber
On arm64 Linux device trees are organized by SoC vendor. Therefore we need to search the vendor subdirectory as well.
Since the SoC vendor may be different from ${vendor}, introduce a new ${soc_vendor}. If this is not set, the behavior remains unchanged.
Cc Alexander Graf <[email protected]>Signed-off-by Andreas F?rber <[email protected]>--- include/config_distro_bootcmd.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)include/config_distro_bootcmd.h +0
-0
include/config_distro_bootcmd.h line 121
Quoted 9 lines
include/config_distro_bootcmd.h +6
-0@@ -113,6 +113,15 @@#define BOOTENV_EFI_SET_FDTFILE_FALLBACK #endif +#if defined(CONFIG_ARM64 ) +#define BOOTENV_EFI_SET_FDTFILE_VENDOR \ + "if test -n \"${soc_vendor}\"; then " \ + "setenv efi_dtb_vendor_prefix ${soc_vendor}/; " \ + "fi; " +#else
OK. Looking at the current Linux kernel, it's a given that for arm64 a DTB will be in a subdirectory, always. Perhaps we should fix this in Kconfig and have... CONFIG_FDTFILE_VENDOR_DIRECTORY and set this correctly per vendor (and yes, eventually there will be some "fun" as NXP boards will sometimes be in freescale/ and sometimes nxp/ so maybe try and futureproof ourselves so that we loop over this variable) ?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160712/082777c4/attachment.sig>
PATCH 4/6 efi_loader: Improve .dtb search for arm64
Am 12.07.2016 um 16:50 schrieb Tom Rini:
Quoted 22 lines · Andreas F?rber
Quoted 21 lines
On arm64 Linux device trees are organized by SoC vendor. Therefore we need to search the vendor subdirectory as well.
Since the SoC vendor may be different from ${vendor}, introduce a new ${soc_vendor}. If this is not set, the behavior remains unchanged.
Cc Alexander Graf <[email protected]>Signed-off-by Andreas F?rber <[email protected]>--- include/config_distro_bootcmd.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)include/config_distro_bootcmd.h +0
-0@@ -113,6 +113,15 @@#define BOOTENV_EFI_SET_FDTFILE_FALLBACK #endif
Quoted 13 lines
include/config_distro_bootcmd.h line 121
Quoted 6 lines
include/config_distro_bootcmd.h +6
-0+#if defined(CONFIG_ARM64 ) +#define BOOTENV_EFI_SET_FDTFILE_VENDOR \ + "if test -n \"${soc_vendor}\"; then " \ + "setenv efi_dtb_vendor_prefix ${soc_vendor}/; " \ + "fi; " +#else OK. Looking at the current Linux kernel, it's a given that for arm64 a DTB will be in a subdirectory, always. Perhaps we should fix this in
Kconfigand have...CONFIG_FDTFILE_VENDOR_DIRECTORYand set this correctly per vendor (and yes, eventually there will be some "fun" as NXP boards will sometimes be in freescale/ and sometimes nxp/ so maybe try and futureproof ourselves so that we loop over this variable) ?
Yes, it's a given that in the kernel the .dts is always in a vendor subdirectory - as listed in an earlier thread also for mips etc.
And yes, it's also true that due to our scripted openSUSE packaging we therefore install .dtb to /boot/dtb-foo/vendor/ - but that's not guaranteed for other distros and users, is it? Therefore I include "" in the loop further down.
Anyway, adding a config option sounds good. Will you look into that yourself or should I do that as part of this series?
I had considered the ambiguous vendor case and am iterating over $efi_dtb_vendor_prefix in a list of vendors already below, only the addition of the trailing slash above is limiting us to one currently. Do you have a concrete suggestion of how to make that more flexible?
Cheers,
Andreas
Signature · 11 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160712/f168de3c/attachment.sig>
PATCH 4/6 efi_loader: Improve .dtb search for arm64
Quoted 37 lines · Andreas F?rber
Am 12.07.2016 um 16:50 schrieb Tom Rini:
Quoted 22 lines · Andreas F?rber
Quoted 21 lines
On arm64 Linux device trees are organized by SoC vendor. Therefore we need to search the vendor subdirectory as well.
Since the SoC vendor may be different from ${vendor}, introduce a new ${soc_vendor}. If this is not set, the behavior remains unchanged.
Cc Alexander Graf <[email protected]>Signed-off-by Andreas F?rber <[email protected]>--- include/config_distro_bootcmd.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)include/config_distro_bootcmd.h +0
-0@@ -113,6 +113,15 @@#define BOOTENV_EFI_SET_FDTFILE_FALLBACK #endif Quoted 13 lines
include/config_distro_bootcmd.h line 121
Quoted 6 lines
include/config_distro_bootcmd.h +6
-0+#if defined(CONFIG_ARM64 ) +#define BOOTENV_EFI_SET_FDTFILE_VENDOR \ + "if test -n \"${soc_vendor}\"; then " \ + "setenv efi_dtb_vendor_prefix ${soc_vendor}/; " \ + "fi; " +#else OK. Looking at the current Linux kernel, it's a given that for arm64 a DTB will be in a subdirectory, always. Perhaps we should fix this in
Kconfigand have...CONFIG_FDTFILE_VENDOR_DIRECTORYand set this correctly per vendor (and yes, eventually there will be some "fun" as NXP boards will sometimes be in freescale/ and sometimes nxp/ so maybe try and futureproof ourselves so that we loop over this variable) ?
Quoted 2 lines
Yes, it's a given that in the kernel the .dts is always in a vendor subdirectory - as listed in an earlier thread also for mips etc.
Right, OK. And it will be extra fun later on when arm and powerpc (probably) switch over.
Quoted 4 lines
And yes, it's also true that due to our scripted openSUSE packaging we therefore install .dtb to
/boot/dtb-foo/vendor/- but that's not guaranteed for other distros and users, is it? Therefore I include "" in the loop further down.
It feels unlikely that other distributions would unroll the directories that exist already upstream.
Quoted 2 lines
Anyway, adding a config option sounds good. Will you look into that yourself or should I do that as part of this series?
Please re-work the series around this idea.
Quoted 4 lines
I had considered the ambiguous vendor case and am iterating over $efi_dtb_vendor_prefix in a list of vendors already below, only the addition of the trailing slash above is limiting us to one currently. Do you have a concrete suggestion of how to make that more flexible?
The more I think about it, the less worried I am about it, actually. Lets just assume that we will have the right vendor set and if it turns out that a 'git mv' is done for say freescale later on down the line, we'll worry about it then. Unless someone knows about how it might go and wants to speak up now? York?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160712/a2dccad0/attachment.sig>
PATCH 5/6 dragonboard410c: Set soc_vendor
In reply to Andreas Färber--- include/configs/dragonboard410c.h | 1 + 1 file changed, 1 insertion(+)
include/configs/dragonboard410c.h +1 -0
@@ -124,6 +124,7 @@ REFLASH(dragonboard/u-boot.img, 8)\"linux_image=Image\0" \"kernel_addr_r=0x81000000\0" \"fdtfile=apq8016-sbc.dtb\0" \ +"soc_vendor=qcom\0" \"fdt_addr_r=0x83000000\0" \"ramdisk_addr_r=0x84000000\0" \BOOTENV
Signature · 1 line
2.6.6
PATCH 6/6 efi_loader: Display which .dtb we found
In reply to Andreas FärberWe do so for the EFI binary already and it aids debugging.
--- include/config_distro_bootcmd.h | 4 ++++ 1 file changed, 4 insertions(+)
include/config_distro_bootcmd.h +4 -0
@@ -149,6 +149,10 @@"${prefix}${dtb_prefix}" \"${dtb_vendor_prefix}" \"${efi_fdtfile}; then " \ +"echo Found ${prefix}" \ +"${dtb_prefix}" \ +"${dtb_vendor_prefix}" \ +"${efi_fdtfile}; " \"run load_efi_dtb; " \"fi; " \"done; " \
Signature · 1 line
2.6.6
PATCH 6/6 efi_loader: Display which .dtb we found
Quoted 13 lines · Andreas F?rber
We do so for the EFI binary already and it aids debugging.
Cc Alexander Graf <[email protected]>Signed-off-by Andreas F?rber <[email protected]>--- include/config_distro_bootcmd.h | 4 ++++ 1 file changed, 4 insertions(+)include/config_distro_bootcmd.h +0
-0
include/config_distro_bootcmd.h line 152
Quoted 4 lines
include/config_distro_bootcmd.h +1
-0@@ -149,6 +149,10 @@"${prefix}${dtb_prefix}" \"${dtb_vendor_prefix}" \"${efi_fdtfile}; then " \ +"echo Found ${prefix}" \
As mentioned in the other reply, I think this message is very useful, but should contain the target device name as well, so that we don't need to print out a message for every single partition we scan :).
Alex
PATCH 6/6 efi_loader: Display which .dtb we found
Am 12.07.2016 um 09:30 schrieb Alexander Graf:
Quoted 9 lines · Andreas F?rber
Quoted 8 lines
We do so for the EFI binary already and it aids debugging.
Cc Alexander Graf <[email protected]>Signed-off-by Andreas F?rber <[email protected]>--- include/config_distro_bootcmd.h | 4 ++++ 1 file changed, 4 insertions(+)
Quoted 13 lines
include/config_distro_bootcmd.h line 152
Quoted 9 lines
include/config_distro_bootcmd.h +1
-0@@ -149,6 +149,10 @@"${prefix}${dtb_prefix}" \"${dtb_vendor_prefix}" \"${efi_fdtfile}; then " \ +"echo Found ${prefix}" \As mentioned in the other reply, I think this message is very useful, but should contain the target device name as well, so that we don't need to print out a message for every single partition we scan :).
I originally had it that way, but remember that issues like with patches 4 and 5 will not lead to any Found message at all. Therefore I still prefer decoupling the two.
Btw where does the "reading efi/boot/bootaa64.efi" message come from? That one could be dropped as duplicate instead! :)
Regards,
Andreas
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)
PATCH 6/6 efi_loader: Display which .dtb we found
Quoted 24 lines · Andreas F?rber
Am 12.07.2016 um 09:30 schrieb Alexander Graf:
Quoted 9 lines · Andreas F?rber
Quoted 8 lines
We do so for the EFI binary already and it aids debugging.
Cc Alexander Graf <[email protected]>Signed-off-by Andreas F?rber <[email protected]>--- include/config_distro_bootcmd.h | 4 ++++ 1 file changed, 4 insertions(+)Quoted 13 lines
include/config_distro_bootcmd.h line 152
Quoted 9 lines
include/config_distro_bootcmd.h +1
-0@@ -149,6 +149,10 @@"${prefix}${dtb_prefix}" \"${dtb_vendor_prefix}" \"${efi_fdtfile}; then " \ +"echo Found ${prefix}" \As mentioned in the other reply, I think this message is very useful, but should contain the target device name as well, so that we don't need to print out a message for every single partition we scan :).
Quoted 3 lines
I originally had it that way, but remember that issues like with patches 4 and 5 will not lead to any Found message at all. Therefore I still prefer decoupling the two.
We do detect the case where we don't have a working fdt loaded already, so we could probably print out the search paths there if we don't find a working fdt?
Quoted 2 lines
Btw where does the "reading efi/boot/bootaa64.efi" message come from? That one could be dropped as duplicate instead! :)
Phew. The "load" command maybe?
Alex
PATCH 6/6 efi_loader: Display which .dtb we found
Am 12.07.2016 um 16:25 schrieb Alexander Graf:
Quoted 25 lines · Andreas F?rber
Quoted 24 lines
Am 12.07.2016 um 09:30 schrieb Alexander Graf:
Quoted 22 lines · Andreas F?rber
Quoted 13 lines
We do so for the EFI binary already and it aids debugging.
Cc Alexander Graf <[email protected]>Signed-off-by Andreas F?rber <[email protected]>--- include/config_distro_bootcmd.h | 4 ++++ 1 file changed, 4 insertions(+)include/config_distro_bootcmd.h +0
-0include/config_distro_bootcmd.h line 152
Quoted 4 lines
include/config_distro_bootcmd.h +1
-0@@ -149,6 +149,10 @@"${prefix}${dtb_prefix}" \"${dtb_vendor_prefix}" \"${efi_fdtfile}; then " \ +"echo Found ${prefix}" \As mentioned in the other reply, I think this message is very useful, but should contain the target device name as well, so that we don't need to print out a message for every single partition we scan :).
Quoted 7 lines
Quoted 3 lines
I originally had it that way, but remember that issues like with patches 4 and 5 will not lead to any Found message at all. Therefore I still prefer decoupling the two.
We do detect the case where we don't have a working fdt loaded already, so we could probably print out the search paths there if we don't find a working fdt?
Feel free to make a follow-up patch...
Quoted 4 lines
Quoted 2 lines
Btw where does the "reading efi/boot/bootaa64.efi" message come from? That one could be dropped as duplicate instead! :)
Phew. The "load" command maybe?
Then why isn't it printing the same for the .dtb files? :) Maybe it's some FAT debug thing?
Andreas
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg)