Embed dtc and libfdt in the kernel (spin the third)
Subsystems (2)
cover Embed dtc and libfdt in the kernel (spin the third)
Another spin of my patches to to embed and use dtc in the kernel source, rather than relying on it as an external dependency, and to use libfdt in favour of flatdevtree.c in the bootwrapper.
Only two changes from the last version:
- trivial changes to make the patches apply to the current
tree
- fdt_init() now calls fdt_open_into() to make sure the tree
is ready to go. This means the bootwrapper using libfdt can cope if supplied with a v16 tree, or a tree with the blocks in a non-preferred order.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 1/4 Merge dtc and libfdt upstream source
This very large patch incorporates a copy of dtc (including libfdt) into the kernel source, in arch/powerpc/boot/dtc-src. This patch only imports the upstream sources verbatim, later patches are needed to actually link it into the kernel Makefiles and use the embedded code during the kernel build.
--- arch/powerpc/boot/dtc-src/Makefile.dtc | 25 arch/powerpc/boot/dtc-src/checks.c | 460 ++++ arch/powerpc/boot/dtc-src/data.c | 351 +++ arch/powerpc/boot/dtc-src/dtc-lexer.l | 341 +++ arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped | 2184 +++++++++++++++++++++ arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped | 1925 ++++++++++++++++++ arch/powerpc/boot/dtc-src/dtc-parser.tab.h_shipped | 110 + arch/powerpc/boot/dtc-src/dtc-parser.y | 304 ++ arch/powerpc/boot/dtc-src/dtc.c | 240 ++ arch/powerpc/boot/dtc-src/dtc.h | 253 ++ arch/powerpc/boot/dtc-src/flattree.c | 959 +++++++++ arch/powerpc/boot/dtc-src/fstree.c | 94 arch/powerpc/boot/dtc-src/libfdt/Makefile.libfdt | 14 arch/powerpc/boot/dtc-src/libfdt/fdt.c | 156 + arch/powerpc/boot/dtc-src/libfdt/fdt.h | 60 arch/powerpc/boot/dtc-src/libfdt/fdt_ro.c | 562 +++++ arch/powerpc/boot/dtc-src/libfdt/fdt_rw.c | 447 ++++ arch/powerpc/boot/dtc-src/libfdt/fdt_strerror.c | 96 arch/powerpc/boot/dtc-src/libfdt/fdt_sw.c | 258 ++ arch/powerpc/boot/dtc-src/libfdt/fdt_wip.c | 144 + arch/powerpc/boot/dtc-src/libfdt/libfdt.h | 593 +++++ arch/powerpc/boot/dtc-src/libfdt/libfdt_internal.h | 89 arch/powerpc/boot/dtc-src/livetree.c | 350 +++ arch/powerpc/boot/dtc-src/srcpos.c | 105 + arch/powerpc/boot/dtc-src/srcpos.h | 75 arch/powerpc/boot/dtc-src/treesource.c | 236 ++ arch/powerpc/boot/dtc-src/version_gen.h | 1 27 files changed, 10432 insertions(+)
Much too big for the list. Full patch at:
http://ozlabs.org/~dgibson/home/merge-dtc.patch
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [PATCH 1/4] Merge dtc and libfdt upstream source
Quoted 5 lines · David Gibson
This very large patch incorporates a copy of dtc (including libfdt) into the kernel source, in
arch/powerpc/boot/dtc-src. This patch only imports the upstream sources verbatim, later patches are needed to actually link it into the kernel Makefiles and use the embedded code during the kernel build.
Maybe it should go somewhere outside arch/powerpc, so it can be used by other architectures down the road.
-Scott
RE: [PATCH 1/4] Merge dtc and libfdt upstream source
Quoted 6 lines
-----Original Message-----
From:=20 [email protected] g=20 [mailto:linuxppc-dev-bounces+stephen.neuendorffer=3Dxilinx.com@o
zlabs.org] On Behalf Of Scott Wood
Quoted 12 lines
Sent: Monday, November 12, 2007 9:13 AM
To: David Gibson
Cc: [email protected]; Paul Mackerras
Subject: Re: [PATCH 1/4] Merge dtc and libfdt upstream source =20Quoted 2 lines · David Gibson
This very large patch incorporates a copy of dtc (including libfdt) into the kernel source, in
arch/powerpc/boot/dtc-src. This=20patch only
Quoted 3 lines
imports the upstream sources verbatim, later patches are needed to actually link it into the kernel Makefiles and use the embedded code during the kernel build.
Quoted 6 lines
=20
Maybe it should go somewhere outsidearch/powerpc, so it can=20 be used by
other architectures down the road.
=20
-Scott
I second that...
Steve
Re: [PATCH 1/4] Merge dtc and libfdt upstream source
In reply to Scott WoodQuoted 9 lines · Scott Wood
Quoted 5 lines · David Gibson
This very large patch incorporates a copy of dtc (including libfdt) into the kernel source, in
arch/powerpc/boot/dtc-src. This patch only imports the upstream sources verbatim, later patches are needed to actually link it into the kernel Makefiles and use the embedded code during the kernel build.Maybe it should go somewhere outside
arch/powerpc, so it can be used by other architectures down the road.
If other architectures want to use it down the road, we can move it down the road.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 2/4 Use embedded dtc in kernel builds
In reply to David GibsonThis patch alters the kernel makefiles to build dtc from the sources embedded in the previous patch. It also changes the arch/powerpc/boot/wrapper script to use the embedded dtc, rather than expecting a copy of dtc already installed on the system.
--- arch/powerpc/boot/Makefile | 41 ++++++++++++++++++++++++++++++++++++++--- arch/powerpc/boot/wrapper | 2 +- 2 files changed, 39 insertions(+), 4 deletions(-)
arch/powerpc/boot/Makefile +38 -3
@@ -108,17 +108,52 @@ $(patsubst %.S,%.o, $(filter %.S, $(src- $(obj)/wrapper.a: $(obj-wlib) FORCE $(call if_changed,bootar) -hostprogs-y := addnote addRamDisk hack-coff mktree +hostprogs-y := addnote addRamDisk hack-coff mktree dtc targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds wrapper :=$(srctree)/$(src)/wrapper -wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \ +wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree dtc) \ $(wrapper) FORCE ############# +# Bits for building dtc +# DTC_GENPARSER := 1 # Uncomment to rebuild flex/bison output + +dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o srcpos.o checks.o +dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o +dtc-objs := $(addprefix dtc-src/, $(dtc-objs)) + +# prerequisites on generated files needs to be explicit +$(obj)/dtc-src/dtc-parser.tab.o: $(obj)/dtc-src/dtc-parser.tab.c $(obj)/dtc-src/dtc-parser.tab.h +$(obj)/dtc-src/dtc-lexer.lex.o: $(obj)/dtc-src/dtc-lexer.lex.c $(obj)/dtc-src/dtc-parser.tab.h + +HOSTCFLAGS += -I$(src)/dtc-src/libfdt/ + +targets += dtc-src/dtc-parser.tab.c +targets += dtc-src/dtc-lexer.lex.c + +ifdef DTC_GENPARSER +BISON = bison +FLEX = flex + +quiet_cmd_bison = BISON $@ + cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped +quiet_cmd_flex = FLEX $@ + cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped + +$(obj)/dtc-src/dtc-parser.tab.c: $(src)/dtc-src/dtc-parser.y FORCE + $(call if_changed,bison) + +$(obj)/dtc-src/dtc-parser.tab.h: $(obj)/dtc-src/dtc-parser.tab.c + +$(obj)/dtc-src/dtc-lexer.lex.c: $(src)/dtc-src/dtc-lexer.l FORCE + $(call if_changed,flex) +endif + +############# # Bits for building various flavours of zImage ifneq ($(CROSS32_COMPILE),)
@@ -236,7 +271,7 @@ install: $(CONFIGURE) $(addprefix $(obj) # anything not in $(targets) clean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.* treeImage.* \ - otheros.bld + otheros.bld $(dtc-clean-files) # clean up files cached by wrapper clean-kernel := vmlinux.strip vmlinux.bin
arch/powerpc/boot/wrapper +1 -1
@@ -119,7 +119,7 @@ if [ -n "$dts" ]; then if [ -z "$dtb" ]; then dtb="$platform.dtb" fi - dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts" + $object/dtc -O dtb -o "$dtb" -b 0 "$dts" fi if [ -z "$kernel" ]; then
Re: [PATCH 2/4] Use embedded dtc in kernel builds
This patch alters the kernel makefiles to build dtc from the sources embedded in the previous patch. It also changes the arch/powerpc/boot/wrapper script to use the embedded dtc, rather than expecting a copy of dtc already installed on the system.
---
Previous version would screw up badly if building with O=... Fixed now.
arch/powerpc/boot/Makefile +37 -2
@@ -108,17 +108,52 @@ $(patsubst %.S,%.o, $(filter %.S, $(src- $(obj)/wrapper.a: $(obj-wlib) FORCE $(call if_changed,bootar) -hostprogs-y := addnote addRamDisk hack-coff mktree +hostprogs-y := addnote addRamDisk hack-coff mktree dtc targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds wrapper :=$(srctree)/$(src)/wrapper -wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \ +wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree dtc) \ $(wrapper) FORCE ############# +# Bits for building dtc +# DTC_GENPARSER := 1 # Uncomment to rebuild flex/bison output + +dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o srcpos.o checks.o +dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o +dtc-objs := $(addprefix dtc-src/, $(dtc-objs)) + +# prerequisites on generated files needs to be explicit +$(obj)/dtc-src/dtc-parser.tab.o: $(obj)/dtc-src/dtc-parser.tab.c $(obj)/dtc-src/dtc-parser.tab.h +$(obj)/dtc-src/dtc-lexer.lex.o: $(obj)/dtc-src/dtc-lexer.lex.c $(obj)/dtc-src/dtc-parser.tab.h + +HOSTCFLAGS += -I$(src)/dtc-src/ -I$(src)/dtc-src/libfdt/ + +targets += dtc-src/dtc-parser.tab.c +targets += dtc-src/dtc-lexer.lex.c + +ifdef DTC_GENPARSER +BISON = bison +FLEX = flex + +quiet_cmd_bison = BISON $@ + cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped +quiet_cmd_flex = FLEX $@ + cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped + +$(obj)/dtc-src/dtc-parser.tab.c: $(src)/dtc-src/dtc-parser.y FORCE + $(call if_changed,bison) + +$(obj)/dtc-src/dtc-parser.tab.h: $(obj)/dtc-src/dtc-parser.tab.c + +$(obj)/dtc-src/dtc-lexer.lex.c: $(src)/dtc-src/dtc-lexer.l FORCE + $(call if_changed,flex) +endif + +############# # Bits for building various flavours of zImage ifneq ($(CROSS32_COMPILE),)
arch/powerpc/boot/wrapper +1 -1
@@ -119,7 +119,7 @@ if [ -n "$dts" ]; then if [ -z "$dtb" ]; then dtb="$platform.dtb" fi - dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts" + $object/dtc -O dtb -o "$dtb" -b 0 "$dts" fi if [ -z "$kernel" ]; then
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 3/4 Use embedded libfdt in the bootwrapper
In reply to David GibsonThis patch incorporates libfdt (from the source embedded in an earlier patch) into the wrapper.a library used by the bootwrapper. This includes adding a libfdt_env.h file, which the libfdt sources need in order to integrate into the bootwrapper environment, and a libfdt-wrapper.c which provides glue to connect the bootwrappers abstract device tree callbacks to the libfdt functions.
In addition, this patch changes the various wrapper and platform files to use libfdt functions instead of the older flatdevtree.c library.
--- arch/powerpc/boot/Makefile | 4 arch/powerpc/boot/bamboo.c | 2 arch/powerpc/boot/cuboot-52xx.c | 2 arch/powerpc/boot/cuboot-83xx.c | 2 arch/powerpc/boot/cuboot-85xx.c | 2 arch/powerpc/boot/cuboot-8xx.c | 2 arch/powerpc/boot/cuboot-hpc2.c | 2 arch/powerpc/boot/cuboot-pq2.c | 2 arch/powerpc/boot/cuboot-sequoia.c | 2 arch/powerpc/boot/ebony.c | 2 arch/powerpc/boot/ep88xc.c | 2 arch/powerpc/boot/holly.c | 2 arch/powerpc/boot/libfdt-wrapper.c | 182 ++++++++++++++++++++++++++++++++++++ arch/powerpc/boot/libfdt_env.h | 17 +++ arch/powerpc/boot/ops.h | 1 arch/powerpc/boot/prpmc2800.c | 3 arch/powerpc/boot/ps3.c | 2 arch/powerpc/boot/treeboot-walnut.c | 2 18 files changed, 217 insertions(+), 16 deletions(-)
arch/powerpc/boot/Makefile +3 -1
@@ -33,7 +33,7 @@ ifeq ($(call cc-option-yn, -fstack-prote BOOTCFLAGS += -fno-stack-protector endif -BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) +BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) -I$(src)/dtc-src/libfdt $(obj)/4xx.o: BOOTCFLAGS += -mcpu=440 $(obj)/ebony.o: BOOTCFLAGS += -mcpu=440
@@ -46,7 +46,9 @@ zliblinuxheader := zlib.h zconf.h zutil. $(addprefix $(obj)/,$(zlib) gunzip_util.o main.o): \ $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) +src-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \ + $(addprefix dtc-src/libfdt/,$(src-libfdt)) libfdt-wrapper.c \ ns16550.c serial.c simple_alloc.c div64.S util.S \ gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
arch/powerpc/boot/libfdt_env.h new file +17 -0
@@ -0,0 +1,17 @@ +#ifndef _ARCH_POWERPC_BOOT_LIBFDT_ENV_H +#define _ARCH_POWERPC_BOOT_LIBFDT_ENV_H + +#include <types.h> +#include <string.h> + +typedef u32 uint32_t ; +typedef u64 uint64_t ; + +#define fdt16_to_cpu (x) (x) +#define cpu_to_fdt16 (x) (x) +#define fdt32_to_cpu (x) (x) +#define cpu_to_fdt32 (x) (x) +#define fdt64_to_cpu (x) (x) +#define cpu_to_fdt64 (x) (x) + +#endif /* _ARCH_POWERPC_BOOT_LIBFDT_ENV_H */
arch/powerpc/boot/bamboo.c +1 -1
@@ -42,6 +42,6 @@ void bamboo_init(void *mac0, void *mac1) platform_ops.exit = ibm44x_dbcr_reset; bamboo_mac0 = mac0; bamboo_mac1 = mac1; -ft_init (_dtb_start,0 ,32 ); +fdt_init (_dtb_start);serial_console_init (); }
arch/powerpc/boot/cuboot-52xx.c +1 -1
@@ -53,7 +53,7 @@ void platform_init(unsigned long r3, uns unsigned long r6, unsigned long r7) {CUBOOT_INIT (); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); platform_ops.fixups = platform_fixups; }
arch/powerpc/boot/cuboot-83xx.c +1 -1
@@ -52,7 +52,7 @@ void platform_init(unsigned long r3, uns unsigned long r6, unsigned long r7) {CUBOOT_INIT (); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); platform_ops.fixups = platform_fixups; }
arch/powerpc/boot/cuboot-85xx.c +1 -1
@@ -53,7 +53,7 @@ void platform_init(unsigned long r3, uns unsigned long r6, unsigned long r7) {CUBOOT_INIT (); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); platform_ops.fixups = platform_fixups; }
arch/powerpc/boot/cuboot-8xx.c +1 -1
@@ -41,7 +41,7 @@ void platform_init(unsigned long r3, uns unsigned long r6, unsigned long r7) {CUBOOT_INIT (); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); platform_ops.fixups = platform_fixups; }
arch/powerpc/boot/cuboot-hpc2.c +1 -1
@@ -42,7 +42,7 @@ void platform_init(unsigned long r3, uns unsigned long r6, unsigned long r7) {CUBOOT_INIT (); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); platform_ops.fixups = platform_fixups; }
arch/powerpc/boot/cuboot-pq2.c +1 -1
@@ -255,7 +255,7 @@ void platform_init(unsigned long r3, uns unsigned long r6, unsigned long r7) {CUBOOT_INIT (); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); platform_ops.fixups = pq2_platform_fixups; }
arch/powerpc/boot/cuboot-sequoia.c +1 -1
@@ -51,6 +51,6 @@ void platform_init(unsigned long r3, unsCUBOOT_INIT (); platform_ops.fixups = sequoia_fixups; platform_ops.exit = ibm44x_dbcr_reset; -ft_init (_dtb_start,0 ,32 ); +fdt_init (_dtb_start);serial_console_init (); }
arch/powerpc/boot/ebony.c +1 -1
@@ -146,6 +146,6 @@ void ebony_init(void *mac0, void *mac1) platform_ops.exit = ibm44x_dbcr_reset; ebony_mac0 = mac0; ebony_mac1 = mac1; -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); }
arch/powerpc/boot/ep88xc.c +1 -1
@@ -45,7 +45,7 @@ void platform_init(unsigned long r3, uns mem_size *=1024 *1024 ;simple_alloc_init (_end, mem_size - (unsigned long )_end,32 ,64 ); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);planetcore_set_stdout_path (table);
arch/powerpc/boot/holly.c +1 -1
@@ -28,6 +28,6 @@ void platform_init(unsigned long r3, unsu32 heapsize =0x8000000 - (u32 )_end;/* 128M */ simple_alloc_init (_end, heapsize,32 ,64 ); -ft_init (_dtb_start,0 ,4 ); +fdt_init (_dtb_start);serial_console_init (); }
arch/powerpc/boot/libfdt-wrapper.c new file +182 -0
182 lines not on this page · raw message
arch/powerpc/boot/ops.h +1 -0
@@ -80,6 +80,7 @@ extern struct loader_info loader_info;void start (void );int ft_init (void *dt_blob,unsigned int max_size,unsigned int max_find_device); +void fdt_init (void *blob);int serial_console_init (void );int ns16550_console_init (void *devp,struct serial_console_data *scdp);int mpsc_console_init (void *devp,struct serial_console_data *scdp);
arch/powerpc/boot/prpmc2800.c +1 -2
@@ -547,8 +547,7 @@ void platform_init(unsigned long r3, unsif (!dtb)exit ();memmove (dtb, _dtb_start, dt_size); -if (ft_init (dtb, dt_size,16 )) -exit (); +fdt_init (dtb); bridge_base =mv64x60_get_bridge_base ();
arch/powerpc/boot/ps3.c +1 -1
@@ -131,7 +131,7 @@ void platform_init(void)printf ("\n-- PS3 bootwrapper --\n" );simple_alloc_init (_end, heapsize,32 ,64 ); -ft_init (_dtb_start,0 ,4 ); +fdt_init (_dtb_start); chosen =finddevice ("/chosen" );
arch/powerpc/boot/treeboot-walnut.c +1 -1
@@ -128,6 +128,6 @@ void platform_init(void)simple_alloc_init (_end, avail_ram,32 ,32 ); platform_ops.fixups = walnut_fixups; platform_ops.exit = ibm40x_dbcr_reset; -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); }
Re: [PATCH 3/4] Use embedded libfdt in the bootwrapper
Use embedded libfdt in the bootwrapper
This patch incorporates libfdt (from the source embedded in an earlier patch) into the wrapper.a library used by the bootwrapper. This includes adding a libfdt_env.h file, which the libfdt sources need in order to integrate into the bootwrapper environment, and a libfdt-wrapper.c which provides glue to connect the bootwrappers abstract device tree callbacks to the libfdt functions.
In addition, this patch changes the various wrapper and platform files to use libfdt functions instead of the older flatdevtree.c library.
---
Fixed for O= builds.
arch/powerpc/boot/Makefile +5 -1
@@ -33,7 +33,7 @@ ifeq ($(call cc-option-yn, -fstack-prote BOOTCFLAGS += -fno-stack-protector endif -BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) +BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) -I$(srctree)/$(src)/dtc-src/libfdt $(obj)/4xx.o: BOOTCFLAGS += -mcpu=440 $(obj)/ebony.o: BOOTCFLAGS += -mcpu=440
@@ -46,7 +46,9 @@ zliblinuxheader := zlib.h zconf.h zutil. $(addprefix $(obj)/,$(zlib) gunzip_util.o main.o): \ $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) +src-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \ + $(addprefix dtc-src/libfdt/,$(src-libfdt)) libfdt-wrapper.c \ ns16550.c serial.c simple_alloc.c div64.S util.S \ gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
@@ -101,8 +103,10 @@ quiet_cmd_bootar = BOOTAR $@ cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE + $(Q)mkdir -p $(dir $@) $(call if_changed_dep,bootcc) $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE + $(Q)mkdir -p $(dir $@) $(call if_changed_dep,bootas) $(obj)/wrapper.a: $(obj-wlib) FORCE
arch/powerpc/boot/libfdt_env.h new file +17 -0
@@ -0,0 +1,17 @@ +#ifndef _ARCH_POWERPC_BOOT_LIBFDT_ENV_H +#define _ARCH_POWERPC_BOOT_LIBFDT_ENV_H + +#include <types.h> +#include <string.h> + +typedef u32 uint32_t ; +typedef u64 uint64_t ; + +#define fdt16_to_cpu (x) (x) +#define cpu_to_fdt16 (x) (x) +#define fdt32_to_cpu (x) (x) +#define cpu_to_fdt32 (x) (x) +#define fdt64_to_cpu (x) (x) +#define cpu_to_fdt64 (x) (x) + +#endif /* _ARCH_POWERPC_BOOT_LIBFDT_ENV_H */
arch/powerpc/boot/bamboo.c +1 -1
@@ -42,6 +42,6 @@ void bamboo_init(void *mac0, void *mac1) platform_ops.exit = ibm44x_dbcr_reset; bamboo_mac0 = mac0; bamboo_mac1 = mac1; -ft_init (_dtb_start,0 ,32 ); +fdt_init (_dtb_start);serial_console_init (); }
arch/powerpc/boot/cuboot-52xx.c +1 -1
@@ -53,7 +53,7 @@ void platform_init(unsigned long r3, uns unsigned long r6, unsigned long r7) {CUBOOT_INIT (); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); platform_ops.fixups = platform_fixups; }
arch/powerpc/boot/cuboot-83xx.c +1 -1
@@ -52,7 +52,7 @@ void platform_init(unsigned long r3, uns unsigned long r6, unsigned long r7) {CUBOOT_INIT (); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); platform_ops.fixups = platform_fixups; }
arch/powerpc/boot/cuboot-85xx.c +1 -1
@@ -53,7 +53,7 @@ void platform_init(unsigned long r3, uns unsigned long r6, unsigned long r7) {CUBOOT_INIT (); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); platform_ops.fixups = platform_fixups; }
arch/powerpc/boot/cuboot-8xx.c +1 -1
@@ -41,7 +41,7 @@ void platform_init(unsigned long r3, uns unsigned long r6, unsigned long r7) {CUBOOT_INIT (); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); platform_ops.fixups = platform_fixups; }
arch/powerpc/boot/cuboot-hpc2.c +1 -1
@@ -42,7 +42,7 @@ void platform_init(unsigned long r3, uns unsigned long r6, unsigned long r7) {CUBOOT_INIT (); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); platform_ops.fixups = platform_fixups; }
arch/powerpc/boot/cuboot-pq2.c +1 -1
@@ -255,7 +255,7 @@ void platform_init(unsigned long r3, uns unsigned long r6, unsigned long r7) {CUBOOT_INIT (); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); platform_ops.fixups = pq2_platform_fixups; }
arch/powerpc/boot/cuboot-sequoia.c +1 -1
@@ -51,6 +51,6 @@ void platform_init(unsigned long r3, unsCUBOOT_INIT (); platform_ops.fixups = sequoia_fixups; platform_ops.exit = ibm44x_dbcr_reset; -ft_init (_dtb_start,0 ,32 ); +fdt_init (_dtb_start);serial_console_init (); }
arch/powerpc/boot/ebony.c +1 -1
@@ -146,6 +146,6 @@ void ebony_init(void *mac0, void *mac1) platform_ops.exit = ibm44x_dbcr_reset; ebony_mac0 = mac0; ebony_mac1 = mac1; -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); }
arch/powerpc/boot/ep88xc.c +1 -1
@@ -45,7 +45,7 @@ void platform_init(unsigned long r3, uns mem_size *=1024 *1024 ;simple_alloc_init (_end, mem_size - (unsigned long )_end,32 ,64 ); -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);planetcore_set_stdout_path (table);
arch/powerpc/boot/holly.c +1 -1
@@ -28,6 +28,6 @@ void platform_init(unsigned long r3, unsu32 heapsize =0x8000000 - (u32 )_end;/* 128M */ simple_alloc_init (_end, heapsize,32 ,64 ); -ft_init (_dtb_start,0 ,4 ); +fdt_init (_dtb_start);serial_console_init (); }
arch/powerpc/boot/libfdt-wrapper.c new file +182 -0
182 lines not on this page · raw message
arch/powerpc/boot/ops.h +1 -0
@@ -80,6 +80,7 @@ extern struct loader_info loader_info;void start (void );int ft_init (void *dt_blob,unsigned int max_size,unsigned int max_find_device); +void fdt_init (void *blob);int serial_console_init (void );int ns16550_console_init (void *devp,struct serial_console_data *scdp);int mpsc_console_init (void *devp,struct serial_console_data *scdp);
arch/powerpc/boot/prpmc2800.c +1 -2
@@ -547,8 +547,7 @@ void platform_init(unsigned long r3, unsif (!dtb)exit ();memmove (dtb, _dtb_start, dt_size); -if (ft_init (dtb, dt_size,16 )) -exit (); +fdt_init (dtb); bridge_base =mv64x60_get_bridge_base ();
arch/powerpc/boot/ps3.c +1 -1
@@ -131,7 +131,7 @@ void platform_init(void)printf ("\n-- PS3 bootwrapper --\n" );simple_alloc_init (_end, heapsize,32 ,64 ); -ft_init (_dtb_start,0 ,4 ); +fdt_init (_dtb_start); chosen =finddevice ("/chosen" );
arch/powerpc/boot/treeboot-walnut.c +1 -1
@@ -128,6 +128,6 @@ void platform_init(void)simple_alloc_init (_end, avail_ram,32 ,32 ); platform_ops.fixups = walnut_fixups; platform_ops.exit = ibm40x_dbcr_reset; -ft_init (_dtb_start, _dtb_end - _dtb_start,32 ); +fdt_init (_dtb_start);serial_console_init (); }
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 4/4 Kill flatdevtree.c
In reply to David GibsonNow that earlier patches have switched the bootwrapper to using libfdt for device tree manipulation, this patch removes the now unused flatdevtree.c and related files.
--- arch/powerpc/boot/Makefile | 2 arch/powerpc/boot/flatdevtree.c | 1036 ----------------------------------- arch/powerpc/boot/flatdevtree.h | 113 --- arch/powerpc/boot/flatdevtree_misc.c | 79 -- arch/powerpc/boot/main.c | 1 arch/powerpc/boot/ops.h | 1 6 files changed, 1 insertion(+), 1231 deletions(-)
arch/powerpc/boot/Makefile +1 -1
@@ -47,7 +47,7 @@ $(addprefix $(obj)/,$(zlib) gunzip_util. $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) src-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c -src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \ +src-wlib := string.S crt0.S stdio.c main.c \ $(addprefix dtc-src/libfdt/,$(src-libfdt)) libfdt-wrapper.c \ ns16550.c serial.c simple_alloc.c div64.S util.S \ gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
arch/powerpc/boot/flatdevtree.c deleted +0 -1036
1,036 lines not on this page · raw message
arch/powerpc/boot/flatdevtree.h deleted +0 -113
113 lines not on this page · raw message
arch/powerpc/boot/flatdevtree_misc.c deleted +0 -79
79 lines not on this page · raw message
arch/powerpc/boot/main.c +0 -1
@@ -16,7 +16,6 @@#include "stdio.h" #include "ops.h" #include "gunzip_util.h" -#include "flatdevtree.h" #include "reg.h" static struct gunzip_state gzstate;
arch/powerpc/boot/ops.h +0 -1
@@ -79,7 +79,6 @@ struct loader_info {extern struct loader_info loader_info;void start (void ); -int ft_init (void *dt_blob,unsigned int max_size,unsigned int max_find_device);void fdt_init (void *blob);int serial_console_init (void );int ns16550_console_init (void *devp,struct serial_console_data *scdp);