0

i have run into a problem when trying to configure the bootargs for my embedded linux system. The device tree is compiled into the same image as the kernel. It includes bootargs ( /chosen/bootargs ). Additionally I need to configure some times at (uboot) runtime. This means I need to be able to use both. I know there is a config define for the Kernel (https://stackoverflow.com/a/48814885/11312396) but this only exists for arm ( i am using aarch64 ).

I am currently trying to use the fdt commands of uboot to load the device tree bootargs into uboot and append them there. The kernel then uses the ones passed by uboot.

The problem there is getting the device tree address. Because it is compiled into a Flattened Image Tree of which i only know the base address I dont have the address of the device tree blob itself. I can find it out by hand by using the iminfo uboot command but uboot has no tools to parse the output of that command.

## Checking Image at 03000000 ...
FIT image found
FIT description: U-Boot fitImage for Ultra96 kernel
Image 0 (kernel@0)
 Description:  Linux Kernel
 Type:         Kernel Image
 Compression:  gzip compressed
 Data Start:   0x030000d4
 Data Size:    7399390 Bytes = 7.1 MiB
 Architecture: AArch64
 OS:           Linux
 Load Address: 0x00080000
 Entry Point:  0x00080000
 Hash algo:    sha1
 Hash value:   47edccde80d64c636a01dbf4916662e2cdbfda96
Image 1 (fdt@0)
 Description:  Flattened Device Tree blob
 Type:         Flat Device Tree
 Compression:  uncompressed
 Data Start:   0x0370e9ac
 Data Size:    41889 Bytes = 40.9 KiB
 Architecture: AArch64
 Hash algo:    sha1
 Hash value:   d977763b2ec8079aca8908b28c732c3a79e1f7ab
Default Configuration: 'conf@1'
Configuration 0 (conf@1)
 Description:  Boot Linux kernel with FDT blob
 Kernel:       kernel@0
 FDT:          fdt@0
## Checking hash(es) for FIT Image at 03000000 ...
Hash(es) for Image 0 (kernel@0): sha1+ 
Hash(es) for Image 1 (fdt@0): sha1+ 

So i tried to decompile the header of it myself but this is kind of beyond my capabilities:

03000000: edfe0dd0 98907100 38000000 988e7100    .....q.....8.q..
03000010: 28000000 11000000 10000000 00000000    ...(............
03000020: 6c000000 608e7100 00000000 00000000    ...l.q.`........
03000030: 00000000 00000000 01000000 00000000    ................
03000040: 03000000 04000000 5c000000 e1e8455c    ...........\\E..
03000050: 03000000 23000000 00000000 6f422d55    .......#....U-Bo
03000060: 6620746f 6d497469 20656761 20726f66    ot fitImage for 
03000070: 72746c55 20363961 6e72656b 00006c65    Ultra96 kernel..
03000080: 03000000 04000000 0c000000 01000000    ................
03000090: 01000000 67616d69 00007365 01000000    ....images......
030000a0: 6e72656b 30406c65 00000000 03000000    kernel@0........
030000b0: 0d000000 00000000 756e694c 654b2078    ........Linux Ke
030000c0: 6c656e72 00000000 03000000 dee77000    rnel.........p..
030000d0: 1b000000 00088b1f 00000000 5bec0302    ...............[
030000e0: d754540d f7bfff9d 23010f86 c087c332    .TT........#2...
030000f0: 8c0199d9 59ac493a e4688106 d1a260cd    ....:I.Y..h..`..

TLDR: Is there a possebility to get from the FIT file header dump listed above to the start address of the device tree (0x0370e9ac)

0

No, because it's in the middle of your binary dump.

Take a look at this parsing example (the file offsets are at the left):

00000000                 Magic: D00DFEED    FDT File OK
00000004             File Size: 002C076C
00000008      DT Struct Offset: 00000038
0000000C     DT Strings Offset: 002C0564
00000010     Mem RsvMap Offset: 00000028
00000014               Version: 00000011
00000018  Last Compatible Vers: 00000010
0000001C           Boot CPU_ID: 00000000
00000020       DT Strings Size: 0000006C
00000024        DT Struct Size: 002C052C
00000038
00000040     timestamp = 18/01/2019 12:25:33
00000050     description = Jackal Kernel Image generated with Linux kernel and FDT blob
0000009C     #address-cells = 0x00000001
000000AC     images
000000B8        kernel@1
000000C8           description = Linux kernel
000000E4           data = 2872840 Bytes [000000F0-002BD6F7]
002BD6F8           type = kernel
002BD70C           arch = arm
002BD71C           os = linux
002BD730           compression = none
002BD744           load = 0x03000000
002BD754           entry = 0x03000000
002BD764           hash@1
002BD770              value = 29684CCAA0B89E0C9B9E2AB47B120CB0
002BD78C              algo = md5
002BD7A4        fdt@1
002BD7B0           description = Device Tree
002BD7C8           data = 11376 Bytes [002BD7D4-002C0443]
002C0444           type = flat_dt
002C0458           arch = arm
002C0468           compression = none
002C047C           hash@1
002C0488              value = 062502B2C222FE1547BDA6118C6FC1EE
002C04A4              algo = md5
002C04C0     configurations
002C04D4        default = config@1
002C04EC        config@1
002C04FC           description = Boot Linux kernel with FDT blob
002C0528           kernel = kernel@1
002C0540           fdt = fdt@1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.