Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Architectures & Platforms Gentoo on ARM
  • Search

What's the right way to build the DTS Blob

Gentoo on all things ARM. Both 32 bit and 64 bit.
Tell about your hardware and CHOST.
Problems with crossdev targeting ARM hardware go here too.
Post Reply
  • Print view
Advanced search
4 posts • Page 1 of 1
Author
Message
TJNII
l33t
l33t
User avatar
Posts: 648
Joined: Sun Nov 09, 2003 3:16 am
Location: for(;;);

What's the right way to build the DTS Blob

  • Quote

Post by TJNII » Sun Jun 16, 2024 3:40 pm

Maybe I didn't Google hard enough last night, I was so close to getting the board booted I didn't want to stop and find the "right" way.

When booting a OrangePi Zero I found it needed a device tree blob. The DTS files are included in the kernel source, but need preprocessing. The steps I ran to build the blob are:

Code: Select all

cpp -nostdinc -I include -I arch  -undef -x assembler-with-cpp  arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts /tmp/sun8i-h2-plus-orangepi-zero.dts.preprocessed
scripts/dtc/dtc -I dts -O dtb /tmp/sun8i-h2-plus-orangepi-zero.dts.preprocessed > /boot/sun8i-h2-plus-orangepi-zero.dtb
This worked fine. But given the high levels of scripting and documentation around all the rest of the processes having to suss a cpp command out of a forum post to build this blob felt very out of place. Is there a utility I didn't find that handles this?
Top
TJNII
l33t
l33t
User avatar
Posts: 648
Joined: Sun Nov 09, 2003 3:16 am
Location: for(;;);

  • Quote

Post by TJNII » Sun Jun 16, 2024 3:45 pm

And some breadcrumbs for search engines:

Original error:

Code: Select all

=> ext2load mmc 0:1 42000000 boot/uImage
8319736 bytes read in 346 ms (22.9 MiB/s)
=> bootm 42000000
## Booting kernel from Legacy Image at 42000000 ...
   Image Name:   Linux-5.15.158-gentoo
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    8319672 Bytes = 7.9 MiB
   Load Address: 42000000
   Entry Point:  42000000
   Verifying Checksum ... OK
Working FDT set to 0
   Loading Kernel Image to 42000000
FDT and ATAGS support not compiled in

resetting ...

Code: Select all

FDT and ATAGS support not compiled in
is a bit misleading, the real error is not passing a device tree address. I did the steps in my first post then booted with:

Code: Select all

=> ext2load mmc 0:1 43000000 boot/sun8i-h2-plus-orangepi-zero.dtb
23240 bytes read in 3 ms (7.4 MiB/s)
=> setenv bootargs "console=ttyS0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 mem=512M loglevel=7 single init=/bin/bash"
=> ext2load mmc 0:1 42000000 boot/uImage
8319736 bytes read in 346 ms (22.9 MiB/s)
=> bootm 42000000 - 43000000
## Booting kernel from Legacy Image at 42000000 ...
   Image Name:   Linux-5.15.158-gentoo
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    8319672 Bytes = 7.9 MiB
   Load Address: 42000000
   Entry Point:  42000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 43000000
   Booting using the fdt blob at 0x43000000
Working FDT set to 43000000
   Loading Kernel Image to 42000000
   Loading Device Tree to 49ff7000, end 49fffac7 ... OK
Working FDT set to 49ff7000

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
The 3 args to the `bootm` U-Boot command are the address the kernel was loaded into, the initrd address (- in this case as I'm not using a initrd), and the address the dtb blob was loaded into. Note these addresses are device specific, on the SBC I'm booting 0x4000:0000 - 0xBFFF:FFFF is RAM.
Top
TJNII
l33t
l33t
User avatar
Posts: 648
Joined: Sun Nov 09, 2003 3:16 am
Location: for(;;);

  • Quote

Post by TJNII » Sat Jun 22, 2024 12:17 pm

Code: Select all

make dtbs
in the kernel source tree.

Haven't learned how overlays are meant to be customized yet, I stumbled across this working on something unrelated.
Top
M95D
Tux's lil' helper
Tux's lil' helper
Posts: 126
Joined: Fri Jan 03, 2020 9:40 am

  • Quote

Post by M95D » Wed Jul 24, 2024 9:51 pm

When you build the kernel (make), DTBs are automatically built.

The kernel and DTB addresses are not really strict. You can change them as long as you keep track where everything else is in memory. Possible mistakes would be to overwrite uboot's memory, load stuff where the devices are (UART address, emmc I/O, PCI, etc.), or load the kernel and then overwrite part of it with the dtb.
Top
Post Reply
  • Print view

4 posts • Page 1 of 1

Return to “Gentoo on ARM”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic