Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:edge2:troubleshooting:edge2-uboot-uefi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
products:sbc:edge2:troubleshooting:edge2-uboot-uefi [2023/07/17 23:30]
hyphop
products:sbc:edge2:troubleshooting:edge2-uboot-uefi [2023/08/28 01:26]
hyphop [Downloads]
Line 1: Line 1:
-===== Edge2 Uboot EFI =====+~~tag> Edge2 Uboot UEFI boot~~ 
 +  
 +===== Edge2 Uboot UEFI =====
  
-WIP: thinking about how to find the best way I have some ideas but I need to check all+<WRAP important >
  
-```shell partitions dump +We recommend start 1st partition from 32768 block
-master@universe:/tmp/uboot$ sfdisk --dump /dev/sda+
  
-label: gpt +``` 
-label-id: 73987B6B-4974-4C94-A3E8-58AB2EB7A946 +sfdisk --dump /dev/mmcblk0 | grep -e first -e start= 
-device: /dev/sda +first-lba: 32768 
-unit: sectors +/dev/mmcblk0p1 start=       32768, 
-first-lba: 34 +```
-last-lba31116254+
  
-/dev/sda1 : start=        2048, size=       16384, type=F808D051-1602-4DCD-9452-F9637FEFC49A, uuid=B750E44E-833F-4A30-C38C-B117241D84D4, name="uboot"+</WRAP>
  
 +<WRAP tip >
 +UEFI bootloader for [[:Edge2]] can be fixed/updated via [[:OOWOW]] online scripts
 +</WRAP>
  
-```+<WRAP tip > 
 +UEFI bootloader for [[:Edge2]] can be installed via [[:OOWOW]] online images 
 +</WRAP>
  
-```shell SPL boot log+<WRAP tip > 
 +Problems was solved: [[#solution]], after we can start EFI loader and boot up next system 
 +</WRAP> 
 + 
 +<WRAP alert > 
 +eMMC storage From **16384** to **32768** block must be reserved for boot-loader 
 +</WRAP> 
 + 
 + 
 +===== Default Boot problem ===== 
 + 
 +OOWOW SPL loader can't find FIT-image at **0x4000** sector eMMC | SD 
 + 
 +```log OOWOW SPL boot log
  
 U-Boot SPL board init U-Boot SPL board init
Line 36: Line 54:
 Trying fit image at 0x4000 sector Trying fit image at 0x4000 sector
 Not fit magic Not fit magic
-Trying fit image at 0x5000 sector +...
-Not fit magic +
 ``` ```
  
 ===== Solution ===== ===== Solution =====
  
-Rebuild EFI boot as FIT image and write to **0x4000** sector+Write FIT image to eMMC or SD **0x4000** sector 
 + 
 +```sh write-uefi-bootloader-to-emmc 
 +EFI=edge2_UEFI_Release_v0.7.1.img 
 +wget https://github.com/edk2-porting/edk2-rk3588/releases/download/v0.7.1/$EFI 
 +DISK=${DISK:-/dev/mmcblk0} 
 +dd skip=2048 seek=$((0x4000)) count=$((0x4000)) of=$DISK if=$EFI conv=fsync,notrunc 
 +``` 
 + 
 +For example 1st write https://dl.khadas.com/.test/edge2_UEFI_Release_3676af4b.img  
 +to USB flash, start OOWOW going into shell... 
 + 
 +```sh copy FIT image to eMMC 
 +dd if=/dev/sda skip=2048 count=$((0x4000)) seek=$((0x4000)) of=/dev/mmcblk0 
 +``` 
 + 
 +or just using oowow with Internet, start OOWOW going into shell...  
 + 
 +```shell oowow copy EFI loader to eMMC  
 +root@edge2-00000:/# curl -jkL \ 
 + https://dl.khadas.com/.test/edge2_UEFI_Release_3676af4b.img \ 
 + -r$((2048*512))-$(((2048+3440)*512)) | dd seek=$((0x4000)) of=$(mmc_disk) 
 +``` 
 + 
 +```shell check eMMC EFI Image header 
 +root@edge2-00000:/# dd if=/dev/mmcblk0 skip=$((0x4000)) count=1 2>/dev/null \ 
 +| hexdump -C | grep "00000080  49 6d 61" 
 +``` 
 + 
 +```shell check eMMC  
 +root@edge2-00000:/# dd if=/dev/mmcblk0 skip=$((0x4000)) count=1 | hexdump -C 
 + 
 +1+0 records in 
 +1+0 records out 
 +512 bytes copied, 0.000668208 s, 766 kB/s 
 +00000000  d0 0d fe ed 00 00 08 b3  00 00 00 38 00 00 07 e8  |...........8....| 
 +00000010  00 00 00 28 00 00 00 11  00 00 00 10 00 00 00 00  |...(............| 
 +00000020  00 00 00 cb 00 00 07 b0  00 00 00 00 00 00 00 00  |................| 
 +00000030  00 00 00 00 00 00 00 00  00 00 00 01 00 00 00 00  |................| 
 +00000040  00 00 00 03 00 00 00 04  00 00 00 a7 00 00 00 00  |................| 
 +00000050  00 00 00 03 00 00 00 04  00 00 00 9d 00 1a da 57  |...............W| 
 +00000060  00 00 00 03 00 00 00 04  00 00 00 93 64 5d 13 d5  |............d]..| 
 +00000070  00 00 00 03 00 00 00 1f  00 00 00 00 46 49 54 20  |............FIT | 
 +00000080  49 6d 61 67 65 20 77 69  74 68 20 41 54 46 2f 4f  |Image with ATF/O| 
 +00000090  50 2d 54 45 45 2f 55 45  46 49 00 00 00 00 00 03  |P-TEE/UEFI......| 
 +000000a0  00 00 00 04 00 00 00 0c  00 00 00 01 00 00 00 01  |................| 
 +000000b0  69 6d 61 67 65 73 00 00  00 00 00 01 75 62 6f 6f  |images......uboo| 
 +000000c0  74 00 00 00 00 00 00 03  00 00 00 04 00 00 00 c1  |t...............| 
 +000000d0  00 10 00 00 00 00 00 03  00 00 00 04 00 00 00 b5  |................| 
 +000000e0  00 00 00 00 00 00 00 03  00 00 00 05 00 00 00 00  |................| 
 +000000f0  55 45 46 49 00 00 00 00  00 00 00 03 00 00 00 0b  |UEFI............| 
 +00000100  00 00 00 20 73 74 61 6e  64 61 6c 6f 6e 65 00 00  |... standalone..| 
 +00000110  00 00 00 03 00 00 00 06  00 00 00 25 61 72 6d 36  |...........%arm6| 
 +00000120  34 00 00 00 00 00 00 03  00 00 00 07 00 00 00 2a  |4..............*| 
 +00000130  55 2d 42 6f 6f 74 00 00  00 00 00 03 00 00 00 05  |U-Boot..........| 
 +00000140  00 00 00 2d 6e 6f 6e 65  00 00 00 00 00 00 00 03  |...-none........| 
 +00000150  00 00 00 04 00 00 00 39  00 20 00 00 00 00 00 01  |.......9. ......| 
 +00000160  68 61 73 68 00 00 00 00  00 00 00 03 00 00 00 20  |hash........... | 
 +00000170  00 00 00 af 43 5a 62 74  4c df d5 01 33 2d 58 d0  |....CZbtL...3-X.| 
 +00000180  28 fe b1 37 45 eb 6c e5  84 f6 e9 f6 ca 69 77 af  |(..7E.l......iw.| 
 +00000190  5f 8b c8 a5 00 00 00 03  00 00 00 07 00 00 00 3e  |_..............>
 +000001a0  73 68 61 32 35 36 00 00  00 00 00 02 00 00 00 02  |sha256..........| 
 +000001b0  00 00 00 01 61 74 66 2d  31 00 00 00 00 00 00 03  |....atf-1.......| 
 +000001c0  00 00 00 04 00 00 00 c1  00 02 f7 64 00 00 00 03  |...........d....| 
 +000001d0  00 00 00 04 00 00 00 b5  00 10 00 00 00 00 00 03  |................| 
 +000001e0  00 00 00 15 00 00 00 00  41 52 4d 20 54 72 75 73  |........ARM Trus| 
 +000001f0  74 65 64 20 46 69 72 6d  77 61 72 65 00 00 00 00  |ted Firmware....| 
 +00000200 
 + 
 +``` 
 +===== UBOOT SPL EFI logs ===== 
 + 
 +```log UBOOT SPL EFI logs 
 +Trying to boot from MMC1 :: 1 
 +Trying fit image at 0x4000 sector 
 +## Verified-boot:
 +## Checking atf-1 0x00040000 ... sha256(909ea14106...) + OK 
 +## Checking uboot 0x00200000 ... sha256(435a62744c...) + OK 
 +## Checking fdt 0x00300000 ... sha256(c07f4a4d71...) + OK 
 +## Checking atf-2 0x000f0000 ... sha256(6a970ae6b4...) + OK 
 +## Checking atf-3 0xff100000 ... sha256(3ea8cf0d7e...) + OK 
 +## Checking optee 0x08400000 ... sha256(fde0860845...) + OK 
 +Jumping to U-Boot(0x00200000) via ARM Trusted Firmware(0x00040000) 
 +Total: 126.537 ms 
 +... 
 +UEFI firmware (version 3676af4b built at 16:11:00 on May 11 2023) 
 +... 
 + 
 +``` 
 + 
 +===== UBOOT EFI disk partitions ===== 
 + 
 +```shell UBOOT EFI partitions dump 
 +~$ sfdisk --dump /dev/sda 
 + 
 +label: gpt 
 +label-id: 73987B6B-4974-4C94-A3E8-58AB2EB7A946 
 +device: /dev/sda 
 +unit: sectors 
 +first-lba: 34 
 +last-lba: 31116254 
 + 
 +/dev/sda1 : start=        2048, size=       16384, type=F808D051-1602-4DCD-9452-F9637FEFC49A, uuid=B750E44E-833F-4A30-C38C-B117241D84D4, name="uboot" 
 + 
 +``` 
 + 
 +===== UEFI image info ===== 
 + 
 +```shell UEFI-info example 
 + 
 +~$ ./edge2-uefi-extract RK3588_NOR_FLASH_REL.img  
 + 
 +/dts-v1/; 
 + version = <0x00>; 
 + totalsize = <0x5afc0b>; 
 + timestamp = <0x64ebea49>; 
 + description = "FIT Image with ATF/OP-TEE/UEFI"; 
 + #address-cells = <0x01>; 
 + 
 +SIZE: 0x5afc0b == 5962763 : 11646 == 5962774 
 +LAST: 7274496(14208 - 0x3780) < 7274496 < 0x6F0000 
 + 
 +# dd skip=2048 count=11646 of=edge2-uefi-bootloader.img if=RK3588_NOR_FLASH_REL.img conv=fsync,notrunc 
 + 
 +/ { 
 + images { 
 + uboot { 
 + data-size = <0x500000>; 
 + data-offset = <0x00>; 
 + atf-1 { 
 + data-size = <0x3084c>; 
 + data-offset = <0x500000>; 
 + atf-2 { 
 + data-size = <0x6000>; 
 + data-offset = <0x530a00>; 
 + atf-3 { 
 + data-size = <0x6000>; 
 + data-offset = <0x536a00>; 
 + optee { 
 + data-size = <0x70998>; 
 + data-offset = <0x53ca00>; 
 + fdt { 
 + data-size = <0x1e95>; 
 + data-offset = <0x5ad400>; 
 + nvdata { 
 + data-position = <0x6c0000>; 
 + data-size = <0x30000>; 
 + configurations { 
 + loadables = "uboot\0atf-2\0atf-3\0optee\0nvdata"; 
 + 
 +005afb70  67 2d 69 6f 2d 77 69 64  74 68 00 64 6d 61 73 00  |g-io-width.dmas.| 
 +005afb80  23 69 6f 2d 63 68 61 6e  6e 65 6c 2d 63 65 6c 6c  |#io-channel-cell| 
 +005afb90  73 00 67 70 69 6f 2d 63  6f 6e 74 72 6f 6c 6c 65  |s.gpio-controlle| 
 +005afba0  72 00 23 67 70 69 6f 2d  63 65 6c 6c 73 00 67 70  |r.#gpio-cells.gp| 
 +005afbb0  69 6f 2d 72 61 6e 67 65  73 00 69 6e 74 65 72 72  |io-ranges.interr| 
 +005afbc0  75 70 74 2d 63 6f 6e 74  72 6f 6c 6c 65 72 00 23  |upt-controller.#
 +005afbd0  69 6e 74 65 72 72 75 70  74 2d 63 65 6c 6c 73 00  |interrupt-cells.| 
 +005afbe0  62 69 61 73 2d 70 75 6c  6c 2d 75 70 00 62 69 61  |bias-pull-up.bia| 
 +005afbf0  73 2d 64 69 73 61 62 6c  65 00 64 72 69 76 65 2d  |s-disable.drive-| 
 +005afc00 
 + 
 +1f206fece22135a50e929aff52105782  edge2-uefi-bootloader.img 
 + 
 +edge2-uefi-bootloader.img: Device Tree Blob version 17, size=2413, boot CPU=0, string block size=217, DT structure block size=2140 
 + 
 + 
 + 
 +``` 
 + 
 +===== Downloads ===== 
 + 
 +  * [[dl>/products/edge2/firmware/UEFI/]] 
 +  * [[gh>/edk2-porting/edk2-rk3588/]] 
 + 
 +===== Links =====
  
 +  * https://opensource.rock-chips.com/wiki_Boot_option
 +  * https://opensource.rock-chips.com/wiki_U-Boot
 +  * https://github.com/edk2-porting/edk2-rk3588/
 +  * https://dl.khadas.com/.test/edge2_UEFI_Release_3676af4b.img 
  
Last modified: 2023/08/28 02:14 by hyphop