Commit 2c0f79e44bfdc592913b96aeeb7ecc5acca6eb37

Authored by Simon Glass
Committed by Wolfgang Denk
1 parent bbb0b128c3

fdt: Add support for a separate device tree (CONFIG_OF_SEPARATE)

This adds support for an FDT to be build as a separate binary file called
u-boot.dtb. This can be concatenated with the U-Boot binary to provide a
device tree located at run-time by U-Boot. The Makefile is modified to
provide this file in u-boot-dtb.bin.

Signed-off-by: Simon Glass <sjg@chromium.org>

Showing 3 changed files with 23 additions and 2 deletions Side-by-side Diff

... ... @@ -35,6 +35,7 @@
35 35 /u-boot.dis
36 36 /u-boot.lds
37 37 /u-boot.ubl
  38 +/u-boot.dtb
38 39  
39 40 #
40 41 # Generated files
... ... @@ -359,8 +359,16 @@
359 359 ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin
360 360 ALL-$(CONFIG_MMC_U_BOOT) += $(obj)mmc_spl/u-boot-mmc-spl.bin
361 361 ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
  362 +ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
362 363  
363 364 all: $(ALL-y) $(SUBDIR_EXAMPLES)
  365 +
  366 +$(obj)u-boot.dtb: $(obj)u-boot
  367 + $(MAKE) -C dts binary
  368 + mv $(obj)dts/dt.dtb $@
  369 +
  370 +$(obj)u-boot-dtb.bin: $(obj)u-boot.bin $(obj)u-boot.dtb
  371 + cat $^ >$@
364 372  
365 373 $(obj)u-boot.hex: $(obj)u-boot
366 374 $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
... ... @@ -824,8 +824,8 @@
824 824 experimental and only available on a few boards. The device
825 825 tree is available in the global data as gd->fdt_blob.
826 826  
827   - U-Boot needs to get its device tree from somewhere. At present
828   - the only way is to embed it in the image with CONFIG_OF_EMBED.
  827 + U-Boot needs to get its device tree from somewhere. This can
  828 + be done using one of the two options below:
829 829  
830 830 CONFIG_OF_EMBED
831 831 If this variable is defined, U-Boot will embed a device tree
... ... @@ -833,6 +833,18 @@
833 833 board directory and called <soc>-<board>.dts. The binary file
834 834 is then picked up in board_init_f() and made available through
835 835 the global data structure as gd->blob.
  836 +
  837 + CONFIG_OF_SEPARATE
  838 + If this variable is defined, U-Boot will build a device tree
  839 + binary. It will be called u-boot.dtb. Architecture-specific
  840 + code will locate it at run-time. Generally this works by:
  841 +
  842 + cat u-boot.bin u-boot.dtb >image.bin
  843 +
  844 + and in fact, U-Boot does this for you, creating a file called
  845 + u-boot-dtb.bin which is useful in the common case. You can
  846 + still use the individual files if you need something more
  847 + exotic.
836 848  
837 849 - Watchdog:
838 850 CONFIG_WATCHDOG