Bug 1733817

Summary: shim fails on aarch64 when booting from a U-Boot firmware
Product: [Fedora] Fedora Reporter: Peter Robinson <pbrobinson>
Component: uboot-toolsAssignee: Peter Robinson <pbrobinson>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 34CC: dan, dennis, fmartine, jan, jean, mjg59, nrevo, ole.d, pbrobinson, peng.fan, phomes, pwhalen, stefan.sorensen, vincent.stehle
Target Milestone: ---Keywords: Tracking
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: uboot-tools-2021.04-3.fc34 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-07 01:02:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 245418, 1269538    

Description Peter Robinson 2019-07-28 22:30:47 UTC
For us to support EBBR on Fedora we need to be able to boot the standard UEFI boot process with EFI/BOOT/BOOTAA64.EFI but when do that, as opposed to hardcoding the grub path we get the following failure when shim tries to boot.

shim-aa64-15-8.aarch64


U-Boot> boot
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found EFI removable media binary efi/boot/bootaa64.efi
Found DTB mmc 0:2 /dtb/broadcom/bcm2837-rpi-3-b.dtb
14118 bytes read in 5 ms (2.7 MiB/s)
Scanning disk mmc...
Card did not respond to voltage select!
Scanning disk mmcnr...
Disk mmcnr not ready
Found 4 disks
FDT memrsv map 0: Failed to add to map
BootOrder not defined
EFI boot manager: Cannot load any image
858216 bytes read in 39 ms (21 MiB/s)
FDT memrsv map 0: Failed to add to map
System BootOrder not found.  Initializing defaults.
Could not read \EFI\: Invalid Parameter
Error: could not find boot options: Invalid Parameter
start_image() returned Invalid Parameter
## Application terminated, r = 2
FDT memrsv map 0: Failed to add to map
BootOrder not defined
EFI boot manager: Cannot load any image
858216 bytes read in 39 ms (21 MiB/s)
FDT memrsv map 0: Failed to add to map
System BootOrder not found.  Initializing defaults.
Could not read \EFI\: Invalid Parameter
Error: could not find boot options: Invalid Parameter
start_image() returned Invalid Parameter
## Application terminated, r = 2
EFI LOAD FAILED: continuing...
Card did not respond to voltage select!

Device 0: unknown device
Waiting for Ethernet connection... unable to connect.

Comment 1 Ben Cotton 2019-08-13 17:00:45 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 2 Ben Cotton 2019-08-13 18:53:07 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to 31.

Comment 3 Peter Robinson 2021-04-21 11:05:14 UTC
So this was in theory fixed with the following U-Boot commit:

https://source.denx.de/u-boot/u-boot/-/commit/1ef1cf1f93345cbeb5ff52cbf00c6ee6fee1a47b

efi_loader: loosen buffer parameter check in efi_file_read

When reading a directory, EFI_BUFFER_TOO_SMALL should be returned when
the supplied buffer is too small, so a use-case is to call
efi_file_read with *buffer_size=0 and buffer=NULL to obtain the needed
size before doing the actual read.

So move the buffer!=NULL check to after the buffer size has been checked.

This fix allows the Redhat shim fallback to run and e.g. Fedora 32 now
boots out of the box.

Comment 4 Peter Robinson 2021-04-26 22:46:40 UTC
To recreate this you can add CONFIG_CMD_NVEDIT_EFI to the U-Boot device config and then from U-Boot set either of the following UEFI variables from the hush shell to debug either shim or fallback:
setenv -e -bs -nv -rt -guid 605dab50-e046-4300-abb6-3dd810dd8b23 SHIM_VERBOSE 1
setenv -e -bs -nv -rt -guid 605dab50-e046-4300-abb6-3dd810dd8b23 FALLBACK_VERBOSE 1

Comment 5 Peng Fan 2021-04-28 08:35:48 UTC
U-Boot 2021.04 introduced a regression. U-Boot patch under reviewing: https://lists.denx.de/pipermail/u-boot/2021-April/448260.html

Comment 6 Fedora Update System 2021-04-29 08:08:05 UTC
FEDORA-2021-0c8d57297a has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-0c8d57297a

Comment 7 Fedora Update System 2021-04-29 17:11:06 UTC
FEDORA-2021-0c8d57297a has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-0c8d57297a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-0c8d57297a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Peter Robinson 2021-04-30 10:46:56 UTC
Upstream fix for reference http://patchwork.ozlabs.org/project/uboot/patch/20210428135401.22365-1-peng.fan@oss.nxp.com/

Comment 9 Fedora Update System 2021-05-07 01:02:22 UTC
FEDORA-2021-0c8d57297a has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.