6

There should be a standard, board and architecture independent way to do this just like there is with initfamfs, no?

I'm using powerpc and linux-3.10, if it matters. If there are better facilities later, I'd be interested to hear about them.

And if anyone knows of a board where this is currently working that I could use as a reference, that would also be helpful.

I've been searching and searching and I find a lot of information about why dts/dtb exists, a fair amount about the ongoing discussion of whether they are useful, and some about how to write dts or use existing dts, but nothing about how to embed them.

Quick descriptions or pointers to relevant doc would be very much appreciated.

K Richard Pixley
  • 617
  • 1
  • 6
  • 10
  • 1
    DT for PPC predates the ARM implementation. The ARM way of appending the dtb to a kernel image is on page 8 of [this presentation](http://free-electrons.com/pub/conferences/2014/elc/petazzoni-device-tree-dummies/petazzoni-device-tree-dummies.pdf). – sawdust Feb 12 '15 at 20:26
  • Thanks. Odd how that's arm specific rather than device independent. – K Richard Pixley Feb 12 '15 at 22:20

2 Answers2

2

What you need is Flattened Image Tree format (FIT). FIT uses DTS syntax/format to describe images embedded into one master image. For example you can package zImage and one or more DTB files and initramfs image and what so ever. Take a look at these slides for details.

yegorich
  • 4,653
  • 3
  • 31
  • 37
  • Will. Thanks. Whatever works.(although it seems kinda redundant when ELF can do all of that already). – K Richard Pixley Feb 12 '15 at 21:38
  • Oh, I read this earlier. It mentions CONFIG_APPENDED_DTB which doesnt' appear in my kernel tree at all. Nor do I see any of the code to implement FIT either in the kernel or in mkimage. This reads more like an experiment than a production facility. Have you used it successfully? – K Richard Pixley Feb 12 '15 at 22:27
  • Yes, I've used FIT. See our [BSP](https://github.com/visionsystemsgmbh/onrisc_br_bsp), especially this [script](https://github.com/visionsystemsgmbh/onrisc_br_bsp/blob/master/board/vscom/baltos/custom-FIT.sh) and corresponding source files. – yegorich Feb 12 '15 at 22:46
  • 1
    I've gone with fitimage which is a function of u-boot, not a function of the linux kernel. Instructions are in u-boot and revolve around using mkimage to create an archive of both kernel and dtb which u-boot apparently tears apart, handing dtb to kernel. This was confusing to me because I was expecting a linux kernel facility for doing this. – K Richard Pixley Feb 19 '15 at 16:04
0

If the bootloader supports device tree, the DTB can be loaded like any other (u/m)Image, but should have it pass to the kernel. If not, we have to use kernel CONFIG_(ARM_)APPENDED_DTB to load newer kernels. Not an option for PowerPC?

cat x.dtb >> zImage

To load an initramfs in that case, use CONFIG_INITRAMFS_SOURCE to include it in the kernel build.

duing
  • 1
  • 1