Bug 1913238

Summary: Failed to load '/dtb/rockchip/rk3399-pinebook-pro.dtb' ** Unrecognized filesystem type ** while booting aarch64 Workstation image on Pinebook Pro (RockChip RK3399) from SD card with internal eMMC disabled
Product: [Fedora] Fedora Reporter: Dominik 'Rathann' Mierzejewski <dominik>
Component: arm-image-installerAssignee: Peter Robinson <pbrobinson>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 34CC: fmartine, mjg59, pbrobinson, pjones, pwhalen, wcohen
Target Milestone: ---   
Target Release: ---   
Hardware: aarch64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-24 15:00:04 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    
Attachments:
Description Flags
Serial console log of Fedora rawhide Workstation boot attempt from SD card
none
u-boot log with eMMC disabled and binaries flashed to correct SD card offset none

Description Dominik 'Rathann' Mierzejewski 2021-01-06 10:45:41 UTC
Created attachment 1744850 [details]
Serial console log of Fedora rawhide Workstation boot attempt from SD card

Description of problem:
I'm getting errors while trying to boot Aarch64 Fedora Workstation image (rawhide) on a Pinebook Pro (RockChip 3399).

Version-Release number of selected component (if applicable):
shim-aa64-15-8.aarch64

How reproducible:
Always.

Steps to Reproduce:
1. Download latest rawhide aarch64 Fedora Workstation image, e.g. 
https://download.fedoraproject.org/pub/fedora/linux/development/rawhide/Workstation/aarch64/images/Fedora-Workstation-Rawhide-20210103.n.0.aarch64.raw.xz
2. Write the image to an SD card:
   sudo arm-image-installer --image=./Fedora-Workstation-Rawhide-20210103.n.0.aarch64.raw.xz --target=pinebook-pro-rk3399 --media=/dev/sdg
3. Attach serial console and boot Pinebook Pro from the above SD card

Actual results:
...
do_boot_rockchip: Could not find boot part
Checking for mmc dev 1...
RKPARM: Invalid parameter part table
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1 for bootable partitions...
Scanning mmc 1:1 for extlinux or boot scripts...
Found EFI removable media binary efi/boot/bootaa64.efi
reading efi/boot/bootaa64.efi
858216 bytes read in 49 ms (16.7 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
## Starting EFI application at 00280000 ...
Adding bank: 0x00200000 - 0xf8000000 (size: 0xf7e00000)
Card did not respond to voltage select!
mmc_init: -95, time 50
Scanning disk dwmmc...
Scanning disk sdhci...
Scanning disk dwmmc...
Found 3 disks
Could not verify MokList: Device Error
Could not verify MokListX: Device Error
Could not verify MokSBState: Device Error
Could not verify MokDBState: Device Error
Something has gone seriously wrong: import_mok_state() failed
: Device Error

Expected results:
Successful boot.

Additional info:
Full log attached.

Comment 1 Dominik 'Rathann' Mierzejewski 2021-01-06 12:04:40 UTC
Looks similar to what is reported here: https://github.com/ayufan-rock64/linux-build/issues/222 .

Comment 2 Dominik 'Rathann' Mierzejewski 2021-01-08 00:56:24 UTC
Created attachment 1745466 [details]
u-boot log with eMMC disabled and binaries flashed to correct SD card offset

I did some reading and it looks like this is due to too-old u-boot pre-installed on the eMMC. After disabling the eMMC it still didn't boot from the SD card until I put both idbloader.img and u-boot.itb from rawhide uboot-tools at the correct offset (https://wiki.pine64.org/wiki/RK3399_boot_sequence#General_maintenance ):

1. make backup of the contents of the first SD card partition (here: sdg1)
2. delete sdg1 in fdisk
3. create a new sdg1 partition at offset 18432 instead of 2048 sectors (and mark it bootable)
4. sudo mkfs.fat -n 607B-AB6B -v -h 2048 /dev/sdg1
5. copy the contents of original partition to sdg1
6. sudo dd if=idbloader.img conv=notrunc seek=64 of=/dev/sdg
7. sudo dd if=u-boot.itb conv=notrunc seek=16384 of=/dev/sdg

I'm now able to boot to u-boot console. Even the display and keyboard seem to work. :) kernel is still not booting, though. New log attached.

I guess I should reassign to arm-image installer since it produces an unbootable image.

Comment 3 Peter Robinson 2021-01-08 12:52:49 UTC
It's because the rockchip firmware is too large and writes through the partition table and the beginning of the VFAT partition, it's a known issue and should be solved one way or another for f34. It's not really a bug with arm-image-installer, but what ever.

Comment 4 Dominik 'Rathann' Mierzejewski 2021-01-11 11:54:24 UTC
I was able to boot grub manually using:

load mmc 1:2 0x01f00000 /dtb/rockchip/rk3399-pinebook-pro.dtb
load mmc 1:1 0x02080000 /efi/fedora/grubaa64.efi
bootefi 0x02080000 0x01f00000

... which is what seems to be the default. I don't know why it's failing, but @pbrobinson said he's dealing with it, so hopefully he'll be able to fix it soon.

Having said that, I removed "rhgb quiet" from grub command line, added console=ttyS2,1500000 and booted the kernel. It printed the following on both the LCD and the serial console:
EFI stub: Booting Linux Kernel...
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services and installing virtual address map...

and then nothing.

Comment 5 Dominik 'Rathann' Mierzejewski 2021-01-11 11:55:15 UTC
Sorry about the needinfo, my mistake.

Comment 6 Ben Cotton 2021-02-09 15:37:23 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 7 Javier Martinez Canillas 2022-03-23 08:52:50 UTC
Is this bug still present? I'm able to boot successfully on two rk3399 devices.

I believe we could just close it.

Comment 8 Dominik 'Rathann' Mierzejewski 2022-03-23 20:55:39 UTC
This might be Pinebook Pro specific, but we can close this. If I understand correctly, the supported way of installing and booting Fedora is to flash u-boot to the SPI anyway.

Comment 9 Peter Robinson 2022-03-24 15:00:04 UTC
So I think this was basically the dd overwriting the early bits of the ESP partition.