Libfdt is used for:
- Unflatten the Flatten Device-Tree (FDT) blob
- Create Device-Tree for the Hardware-Domain
Both use are done during the initialization of Xen. So move all the
libfdt to init.
Note that the runes was borrowed from libelf Makefile.
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
include Makefile.libfdt
-obj-y += $(LIBFDT_OBJS)
+SECTIONS := text data $(SPECIAL_DATA_SECTIONS)
+
+obj-y += libfdt.o
CFLAGS += -I$(BASEDIR)/include/xen/libfdt/
+
+libfdt.o: libfdt-temp.o Makefile
+ $(OBJCOPY) $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
+
+libfdt-temp.o: $(LIBFDT_OBJS)
+ $(LD) $(LDFLAGS) -r -o $@ $^