Adding DTB's to architecture independent vmlinux
Subsystems (4)
cover Adding DTB's to architecture independent vmlinux
From: Dirk Brandewie <[email protected]>
This patch set adds support for linking an arbitrary number of device tree blobs into the kernel image and allow passing the "compatible" string for the platform on the kernel command line.
Patch 1/2:
modifies asm-generic/vmlinux.lds.h to add linking .dtb.init.rodata sections into the .init.data section of the vmlinux image. modifies scripts/Makefile.lib to add a kbuild command to compile DTS files to device tree blobs and a rule to create objects to wrap the blobs for linking into vmlinux.
A DTB is linked in by adding the DTB object to the list of objects to be linked into vmlinux in the archtecture specific Makefile using
obj-y += dts/foo.dtb.o
$(obj)/%.dtb: $(src)/%.dts
$(call if_changed,dtc)
The location of the device tree DTS files is architecture specific.
Patch 2/2:
Adds a kernel command line option "dtb_compat=<string>" and functions for architecture/platform specific code to retrieve the command line string and locate the compatible DTB linked into the kernel e.g.
compat_string = of_get_dtb_compatible_string();
compat_dtb = of_find_compatible_dtb(compat_string);Changes from V4:
Patch to device tree compiler dropped, alignment done in DTB wrapper object code.
Name of DTB section changed to .dtb.init.rodata from .dtb
Code cleanup in of_find_compatible_dtb() to remove redundant code and improve readabiility.
Patch to arch/x86/kernel Makefile dropped from this set.
Dirk Brandewie (2):
of: Add support for linking device tree blobs into vmlinux of/fdt: add kernel command line option for dtb_compat string
Documentation/kernel-parameters.txt | 7 ++++ drivers/of/fdt.c | 55 +++++++++++++++++++++++++++++++++++ include/asm-generic/vmlinux.lds.h | 19 +++++++++++- include/linux/of_fdt.h | 5 +++ scripts/Makefile.lib | 17 +++++++++++ 5 files changed, 101 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.2.3
PATCH 1/2 of: Add support for linking device tree blobs into vmlinux
In reply to a message not in the archiveFrom: Dirk Brandewie <[email protected]>
This patch adds support for linking device tree blobs into vmlinux. The device tree blobs are placed in the init.data section.
--- include/asm-generic/vmlinux.lds.h | 19 +++++++++++++++++-- scripts/Makefile.lib | 17 +++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-)
include/asm-generic/vmlinux.lds.h +17 -2
@@ -67,7 +67,14 @@* Align to a 32 byte boundary equal to the * alignment gcc 4.5 uses for a struct */ -#define STRUCT_ALIGN () . = ALIGN(32) +#define STRUCT_ALIGNMENT 32 +#define STRUCT_ALIGN () . = ALIGN(STRUCT_ALIGNMENT) + +/* Device tree blobs linked into the kernel need to have proper +* structure alignment to be parsed by the flat device tree library +* used in early boot +*/ +#define DTB_ALIGNMENT STRUCT_ALIGNMENT/* The actual configuration determine if the init/exit sections * are handled as text/data or they can be discarded (which
@@ -146,6 +153,13 @@#define TRACE_SYSCALLS ()#endif + +#define KERNEL_DTB () \ + . = ALIGN(DTB_ALIGNMENT); \ + VMLINUX_SYMBOL(__dtb_start) = .; \ + *(.dtb.init.rodata) \ + VMLINUX_SYMBOL(__dtb_end) = .; +/* .data section */ #define DATA_DATA \ *(.data) \
@@ -468,7 +482,8 @@ MCOUNT_REC() \ DEV_DISCARD(init.rodata) \ CPU_DISCARD(init.rodata) \ - MEM_DISCARD(init.rodata) + MEM_DISCARD(init.rodata) \ + KERNEL_DTB()#define INIT_TEXT \ *(.init.text) \
scripts/Makefile.lib +17 -0
@@ -200,6 +200,23 @@ quiet_cmd_gzip = GZIP $@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \ (rm -f $@ ; false) +# DTC +# --------------------------------------------------------------------------- +$(obj)/%.dtb.S: $(obj)/%.dtb FORCE + @echo '#include <asm-generic/vmlinux.lds.h>' > $@ + @echo '.section .dtb.init.rodata,"a"' >> $@ + @echo '.balign DTB_ALIGNMENT' >> $@ + @echo '.global __dtb_$(*F)_begin' >> $@ + @echo '__dtb_$(*F)_begin:' >> $@ + @echo '.incbin "$<" ' >> $@ + @echo '__dtb_$(*F)_end:' >> $@ + @echo '.global __dtb_$(*F)_end' >> $@ + @echo '.balign DTB_ALIGNMENT' >> $@ + +DTC = $(objtree)/scripts/dtc/dtc + +quiet_cmd_dtc = DTC $@ + cmd_dtc = $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 $(src)/$*.dts # Bzip2 # ---------------------------------------------------------------------------
Signature · 1 line
1.7.2.3
PATCH 2/2 of/fdt: add kernel command line option for dtb_compat string
In reply to a message not in the archiveFrom: Dirk Brandewie <[email protected]>
Add support for specifying a "compatible" string from the kernel command line and functions for the platform to find the compatible blob present in the kernel image if any.
--- Documentation/kernel-parameters.txt | 7 ++++ drivers/of/fdt.c | 55 +++++++++++++++++++++++++++++++++++ include/linux/of_fdt.h | 5 +++ 3 files changed, 67 insertions(+), 0 deletions(-)
Documentation/kernel-parameters.txt +7 -0
@@ -655,6 +655,13 @@ and is between 256 and 4096 characters. It is defined in the file dscc4.setup= [NET] + dtb_compat= [KNL] + Specify the "compatible" string for the device + tree blob present in the kernel image. This + string will be used to select the first device + tree blob whose compatible property matches + the string passed on the kernel commandline. + dynamic_printk Enables pr_debug()/dev_dbg() calls if CONFIG_DYNAMIC_PRINTK_DEBUG has been enabled. These can also be switched on/off via
drivers/of/fdt.c +55 -0
64 lines not on this page · raw message
include/linux/of_fdt.h +5 -0
@@ -58,6 +58,8 @@ struct boot_param_header { };#if defined(CONFIG_OF_FLATTREE ) +#define MAX_DTB_COMPAT_STR 64 +/* TBD: Temporary export of fdt globals - remove when code fully merged */ extern int __initdata dt_root_addr_cells;extern int __initdata dt_root_size_cells;
@@ -82,6 +84,9 @@ extern void early_init_dt_add_memory_arch(u64 base, u64 size);extern u64 early_init_dt_alloc_memory_arch (u64 size,u64 align);extern u64 dt_mem_next_cell (int s,__be32 **cellp); +extern char *of_get_dtb_compatible_string (void ); +extern void *of_find_compatible_dtb (char *name); +/* * If BLK_DEV_INITRD, the fdt early init code will call this function, * to be provided by the arch code. start and end are specified as
Signature · 1 line
1.7.2.3
Re: [PATCH 1/2] of: Add support for linking device tree blobs into vmlinux
In reply to a message not in the archiveQuoted 71 lines · On Mon, Nov 15, 2010 at 08:01:20PM -0800…
From: Dirk Brandewie <[email protected]>
This patch adds support for linking device tree blobs into vmlinux. The device tree blobs are placed in the init.data section.
Signed-off-by Dirk Brandewie <[email protected]>--- include/asm-generic/vmlinux.lds.h | 19 +++++++++++++++++-- scripts/Makefile.lib | 17 +++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-)include/asm-generic/vmlinux.lds.h +17
-2@@ -67,7 +67,14 @@* Align to a 32 byte boundary equal to the * alignment gcc 4.5 uses for a struct */ -#define STRUCT_ALIGN () . = ALIGN(32) +#define STRUCT_ALIGNMENT 32 +#define STRUCT_ALIGN () . = ALIGN(STRUCT_ALIGNMENT) + +/* Device tree blobs linked into the kernel need to have proper +* structure alignment to be parsed by the flat device tree library +* used in early boot +*/ +#define DTB_ALIGNMENT STRUCT_ALIGNMENT/* The actual configuration determine if the init/exit sections * are handled as text/data or they can be discarded (which @@ -146,6 +153,13 @@#define TRACE_SYSCALLS ()#endif + +#define KERNEL_DTB () \ + . = ALIGN(DTB_ALIGNMENT); \ + VMLINUX_SYMBOL(__dtb_start) = .; \ + *(.dtb.init.rodata) \ + VMLINUX_SYMBOL(__dtb_end) = .; +/* .data section */ #define DATA_DATA \ *(.data) \@@ -468,7 +482,8 @@ MCOUNT_REC() \ DEV_DISCARD(init.rodata) \ CPU_DISCARD(init.rodata) \ - MEM_DISCARD(init.rodata) + MEM_DISCARD(init.rodata) \ + KERNEL_DTB()#define INIT_TEXT \ *(.init.text) \scripts/Makefile.lib +7
-0@@ -200,6 +200,23 @@ quiet_cmd_gzip = GZIP $@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \ (rm -f $@ ; false) +# DTC +# --------------------------------------------------------------------------- +$(obj)/%.dtb.S: $(obj)/%.dtb FORCE + @echo '#include <asm-generic/vmlinux.lds.h>' > $@ + @echo '.section .dtb.init.rodata,"a"' >> $@ + @echo '.balign DTB_ALIGNMENT' >> $@ + @echo '.global __dtb_$(*F)_begin' >> $@
scripts/Makefile.lib quiet_cmd_gzip = GZIP $@ · line 219
Quoted 10 lines
scripts/Makefile.lib +10
-0+ @echo '__dtb_$(*F)_begin:' >> $@ + @echo '.incbin "$<" ' >> $@ + @echo '__dtb_$(*F)_end:' >> $@ + @echo '.global __dtb_$(*F)_end' >> $@ + @echo '.balign DTB_ALIGNMENT' >> $@ + +DTC = $(objtree)/scripts/dtc/dtc + +quiet_cmd_dtc = DTC $@ + cmd_dtc = $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 $(src)/$*.dts
Missing the %.dtb: %.dts rule, but otherwise looks okay. You will need to make sure this doesn't break powerpc or microblaze when the dts->dtb rule is added.
g.
Re: [PATCH 1/2] of: Add support for linking device tree blobs into vmlinux
In reply to a message not in the archiveQuoted 78 lines · Grant Likely
Quoted 77 lines · On Mon, Nov 15, 2010 at 08:01:20PM -0800…
From: Dirk Brandewie<[email protected]>
This patch adds support for linking device tree blobs into vmlinux. The device tree blobs are placed in the init.data section.
Signed-off-by Dirk Brandewie<[email protected]>--- include/asm-generic/vmlinux.lds.h | 19 +++++++++++++++++-- scripts/Makefile.lib | 17 +++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-)include/asm-generic/vmlinux.lds.h +17
-2@@ -67,7 +67,14 @@* Align to a 32 byte boundary equal to the * alignment gcc 4.5 uses for a struct */ -#define STRUCT_ALIGN () . = ALIGN(32) +#define STRUCT_ALIGNMENT 32 +#define STRUCT_ALIGN () . = ALIGN(STRUCT_ALIGNMENT) + +/* Device tree blobs linked into the kernel need to have proper +* structure alignment to be parsed by the flat device tree library +* used in early boot +*/ +#define DTB_ALIGNMENT STRUCT_ALIGNMENT/* The actual configuration determine if the init/exit sections * are handled as text/data or they can be discarded (which @@ -146,6 +153,13 @@#define TRACE_SYSCALLS ()#endif + +#define KERNEL_DTB () \ + . = ALIGN(DTB_ALIGNMENT); \ + VMLINUX_SYMBOL(__dtb_start) = .; \ + *(.dtb.init.rodata) \ + VMLINUX_SYMBOL(__dtb_end) = .; +/* .data section */ #define DATA_DATA \ *(.data) \@@ -468,7 +482,8 @@ MCOUNT_REC() \ DEV_DISCARD(init.rodata) \ CPU_DISCARD(init.rodata) \ - MEM_DISCARD(init.rodata) + MEM_DISCARD(init.rodata) \ + KERNEL_DTB()#define INIT_TEXT \ *(.init.text) \scripts/Makefile.lib +13
-0@@ -200,6 +200,23 @@ quiet_cmd_gzip = GZIP $@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9> $@) || \ (rm -f $@ ; false) +# DTC +# --------------------------------------------------------------------------- +$(obj)/%.dtb.S: $(obj)/%.dtb FORCE + @echo '#include<asm-generic/vmlinux.lds.h>'> $@ + @echo '.section .dtb.init.rodata,"a"'>> $@ + @echo '.balign DTB_ALIGNMENT'>> $@ + @echo '.global __dtb_$(*F)_begin'>> $@ + @echo '__dtb_$(*F)_begin:'>> $@ + @echo '.incbin "$<" '>> $@ + @echo '__dtb_$(*F)_end:'>> $@ + @echo '.global __dtb_$(*F)_end'>> $@ + @echo '.balign DTB_ALIGNMENT'>> $@ +
Quoted 9 lines
scripts/Makefile.lib quiet_cmd_gzip = GZIP $@ · line 219
Quoted 4 lines
scripts/Makefile.lib +4
-0+DTC = $(objtree)/scripts/dtc/dtc + +quiet_cmd_dtc = DTC $@ + cmd_dtc = $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 $(src)/$*.dtsMissing the %.dtb: %.dts rule, but otherwise looks okay. You will need to make sure this doesn't break powerpc or microblaze when the
dts->dtbrule is added.
I have the rule
$(obj)/%.dtb: $(src)/%.dts
$(call if_changed,dtc)
in the arch/x86/kernel/Makefile to prevent this sneaking into other other architectures.
I need some more skilled in kbuild to help craft the more generic rule so we can have the dts files anywhere in the arch/<*>/ directory structure and be able to find the correct dts files.
--Dirk
Re: [PATCH 1/2] of: Add support for linking device tree blobs into vmlinux
Quoted 92 lines · Dirk Brandewie
Quoted 82 lines · Grant Likely
Quoted 80 lines · On Mon, Nov 15, 2010 at 08:01:20PM -0800, [email protected] wrote:
From: Dirk Brandewie<[email protected]>
This patch adds support for linking device tree blobs into vmlinux. The device tree blobs are placed in the init.data section.
Signed-off-by Dirk Brandewie<[email protected]>---
include/asm-generic/vmlinux.lds.h | 19 +++++++++++++++++--scripts/Makefile.lib| 17 +++++++++++++++++2 files changed, 34 insertions(+), 2 deletions(-)include/asm-generic/vmlinux.lds.h +17
-2@@ -67,7 +67,14 @@* Align to a 32 byte boundary equal to the * alignment gcc 4.5 uses for a struct */ -#define STRUCT_ALIGN () . = ALIGN(32) +#define STRUCT_ALIGNMENT 32 +#define STRUCT_ALIGN () . = ALIGN(STRUCT_ALIGNMENT) + +/* Device tree blobs linked into the kernel need to have proper +* structure alignment to be parsed by the flat device tree library +* used in early boot +*/ +#define DTB_ALIGNMENT STRUCT_ALIGNMENT /* The actual configuration determine if the init/exit sections* are handled as text/data or they can be discarded (which @@ -146,6 +153,13 @@ #define TRACE_SYSCALLS() #endif + +#define KERNEL_DTB () \ + . = ALIGN(DTB_ALIGNMENT); \ + VMLINUX_SYMBOL(__dtb_start) = .; \ + *(.dtb.init.rodata) \ + VMLINUX_SYMBOL(__dtb_end) = .; + /* .data section */ #define DATA_DATA \ *(.data) \@@ -468,7 +482,8 @@ MCOUNT_REC() \ DEV_DISCARD(init.rodata) \ CPU_DISCARD(init.rodata) \ - MEM_DISCARD(init.rodata) + MEM_DISCARD(init.rodata) \ + KERNEL_DTB() #define INIT_TEXT \ *(.init.text) \scripts/Makefile.lib +2
-0@@ -200,6 +200,23 @@ quiet_cmd_gzip = GZIP $@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9> $@) || \ (rm -f $@ ; false) +# DTC +#---------------------------------------------------------------------------
+$(obj)/%.dtb.S: $(obj)/%.dtb FORCE
+ @echo '#include<asm-generic/vmlinux.lds.h>'> $@
+ @echo '.section .dtb.init.rodata,"a"'>> $@
+ @echo '.balignDTB_ALIGNMENT'>> $@
+ @echo '.global __dtb_$(*F)_begin'>> $@
+ @echo '__dtb_$(*F)_begin:'>> $@
+ @echo '.incbin "$<" '>> $@
+ @echo '__dtb_$(*F)_end:'>> $@
+ @echo '.global __dtb_$(*F)_end'>> $@
+ @echo '.balignDTB_ALIGNMENT'>> $@
+Quoted 9 lines
scripts/Makefile.lib quiet_cmd_gzip = GZIP $@ · line 219
Quoted 4 lines
scripts/Makefile.lib +4
-0+DTC = $(objtree)/scripts/dtc/dtc + +quiet_cmd_dtc = DTC $@ + cmd_dtc = $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 $(src)/$*.dtsMissing the %.dtb: %.dts rule, but otherwise looks okay. You will need to make sure this doesn't break powerpc or microblaze when the
dts->dtbrule is added.
Quoted 5 lines
I have the rule
$(obj)/%.dtb: $(src)/%.dts
$(call if_changed,dtc)
in thearch/x86/kernel/Makefileto prevent this sneaking into other other architectures.
This rule looks correct. PowerPC and Microblaze need to be modified to use it. It should not be hard to do, give it a try. Worst case, your first attempt is wrong and the rest of us fix it up. :-)
Hint: PowerPC currently puts the .dtb file in a different directory from the source .dts file. It doesn't need to do it that way. arch/powerpc/boot/Makefile will need to be modified.
g.
Quoted 7 lines
I need some more skilled in kbuild to help craft the more generic rule so we can have the dts files anywhere in the arch/<*>/ directory structure and be able to find the correct dts files.
--Dirk
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.
Re: [PATCH 1/2] of: Add support for linking device tree blobs into vmlinux
In reply to a message not in the archiveQuoted 100 lines · Grant Likely
Quoted 92 lines · Dirk Brandewie
Quoted 82 lines · Grant Likely
Quoted 80 lines · On Mon, Nov 15, 2010 at 08:01:20PM -0800…
From: Dirk Brandewie<[email protected]>
This patch adds support for linking device tree blobs into vmlinux. The device tree blobs are placed in the init.data section.
Signed-off-by Dirk Brandewie<[email protected]>--- include/asm-generic/vmlinux.lds.h | 19 +++++++++++++++++-- scripts/Makefile.lib | 17 +++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-)include/asm-generic/vmlinux.lds.h +17
-2@@ -67,7 +67,14 @@* Align to a 32 byte boundary equal to the * alignment gcc 4.5 uses for a struct */ -#define STRUCT_ALIGN () . = ALIGN(32) +#define STRUCT_ALIGNMENT 32 +#define STRUCT_ALIGN () . = ALIGN(STRUCT_ALIGNMENT) + +/* Device tree blobs linked into the kernel need to have proper +* structure alignment to be parsed by the flat device tree library +* used in early boot +*/ +#define DTB_ALIGNMENT STRUCT_ALIGNMENT/* The actual configuration determine if the init/exit sections * are handled as text/data or they can be discarded (which @@ -146,6 +153,13 @@#define TRACE_SYSCALLS ()#endif + +#define KERNEL_DTB () \ + . = ALIGN(DTB_ALIGNMENT); \ + VMLINUX_SYMBOL(__dtb_start) = .; \ + *(.dtb.init.rodata) \ + VMLINUX_SYMBOL(__dtb_end) = .; +/* .data section */ #define DATA_DATA \ *(.data) \@@ -468,7 +482,8 @@ MCOUNT_REC() \ DEV_DISCARD(init.rodata) \ CPU_DISCARD(init.rodata) \ - MEM_DISCARD(init.rodata) + MEM_DISCARD(init.rodata) \ + KERNEL_DTB()#define INIT_TEXT \ *(.init.text) \scripts/Makefile.lib +13
-0@@ -200,6 +200,23 @@ quiet_cmd_gzip = GZIP $@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9> $@) || \ (rm -f $@ ; false) +# DTC +# --------------------------------------------------------------------------- +$(obj)/%.dtb.S: $(obj)/%.dtb FORCE + @echo '#include<asm-generic/vmlinux.lds.h>'> $@ + @echo '.section .dtb.init.rodata,"a"'>> $@ + @echo '.balign DTB_ALIGNMENT'>> $@ + @echo '.global __dtb_$(*F)_begin'>> $@ + @echo '__dtb_$(*F)_begin:'>> $@ + @echo '.incbin "$<" '>> $@ + @echo '__dtb_$(*F)_end:'>> $@ + @echo '.global __dtb_$(*F)_end'>> $@ + @echo '.balign DTB_ALIGNMENT'>> $@ +Quoted 9 lines
scripts/Makefile.lib quiet_cmd_gzip = GZIP $@ · line 220
Quoted 4 lines
scripts/Makefile.lib +4
-0+DTC = $(objtree)/scripts/dtc/dtc + +quiet_cmd_dtc = DTC $@ + cmd_dtc = $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 $(src)/$*.dtsMissing the %.dtb: %.dts rule, but otherwise looks okay. You will need to make sure this doesn't break powerpc or microblaze when the
dts->dtbrule is added.Quoted 5 lines
I have the rule
$(obj)/%.dtb: $(src)/%.dts$(call if_changed,dtc)in the
arch/x86/kernel/Makefileto prevent this sneaking into other other architectures.
Quoted 8 lines
This rule looks correct. PowerPC and Microblaze need to be modified to use it. It should not be hard to do, give it a try. Worst case, your first attempt is wrong and the rest of us fix it up. :-)
Hint: PowerPC currently puts the .dtb file in a different directory from the source .dts file. It doesn't need to do it that way.
arch/powerpc/boot/Makefilewill need to be modified.
I will give it a shot. The only real difference except for the directory structures is powerpc and microblaze add padding to the dtb with the -p 1024 command line argument to dtc. Is the padding needed when the blob are linked into vmlinux proper?
--Dirk
Re: [PATCH 1/2] of: Add support for linking device tree blobs into vmlinux
Quoted 121 lines · Dirk Brandewie
Quoted 120 lines · Grant Likely
Quoted 107 lines · Dirk Brandewie
Quoted 96 lines · Grant Likely
Quoted 93 lines · On Mon, Nov 15, 2010 at 08:01:20PM -0800, [email protected] wrote:
From: Dirk Brandewie<[email protected]>
This patch adds support for linking device tree blobs into vmlinux. The device tree blobs are placed in the init.data section.
Signed-off-by Dirk Brandewie<[email protected]>---
include/asm-generic/vmlinux.lds.h | 19 +++++++++++++++++--scripts/Makefile.lib| 17 +++++++++++++++++2 files changed, 34 insertions(+), 2 deletions(-)include/asm-generic/vmlinux.lds.h +13
-1@@ -67,7 +67,14 @@* Align to a 32 byte boundary equal to the * alignment gcc 4.5 uses for a struct */ -#define STRUCT_ALIGN () . = ALIGN(32) +#define STRUCT_ALIGNMENT 32 +#define STRUCT_ALIGN () . = ALIGN(STRUCT_ALIGNMENT) + +/* Device tree blobs linked into the kernel need to have proper +* structure alignment to be parsed by the flat device tree library +* used in early boot +*/ +#define DTB_ALIGNMENT STRUCT_ALIGNMENT /* The actual configuration determine if the init/exit sections* are handled as text/data or they can be discarded (which @@ -146,6 +153,13 @@ #define TRACE_SYSCALLS() #endif + +#define KERNEL_DTB () \ + . = ALIGN(DTB_ALIGNMENT); \ + VMLINUX_SYMBOL(__dtb_start) = .; \ + *(.dtb.init.rodata)\
+VMLINUX_SYMBOL(__dtb_end)= .;
+
/* .data section */
#defineDATA_DATA
\
*(.data)
\include/asm-generic/vmlinux.lds.h +1
-1@@ -468,7 +482,8 @@ MCOUNT_REC() \ DEV_DISCARD(init.rodata) \ CPU_DISCARD(init.rodata) \ - MEM_DISCARD(init.rodata) + MEM_DISCARD(init.rodata)\
+KERNEL_DTB()#define
INIT_TEXT
\
*(.init.text)
\scripts/Makefile.lib +2
-0@@ -200,6 +200,23 @@ quiet_cmd_gzip = GZIP $@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9> $@) || \ (rm -f $@ ; false) +# DTC +#---------------------------------------------------------------------------
+$(obj)/%.dtb.S: $(obj)/%.dtb FORCE
+ @echo '#include<asm-generic/vmlinux.lds.h>'> $@
+ @echo '.section .dtb.init.rodata,"a"'>> $@
+ @echo '.balignDTB_ALIGNMENT'>> $@
+ @echo '.global __dtb_$(*F)_begin'>> $@
+ @echo '__dtb_$(*F)_begin:'>> $@
+ @echo '.incbin "$<" '>> $@
+ @echo '__dtb_$(*F)_end:'>> $@
+ @echo '.global __dtb_$(*F)_end'>> $@
+ @echo '.balignDTB_ALIGNMENT'>> $@
+Quoted 9 lines
scripts/Makefile.lib
Quoted 4 lines
scripts/Makefile.lib +4
-0+DTC = $(objtree)/scripts/dtc/dtc + +quiet_cmd_dtc = DTC $@ + cmd_dtc = $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 $(src)/$*.dtsMissing the %.dtb: %.dts rule, but otherwise looks okay. You will need to make sure this doesn't break powerpc or microblaze when the
dts->dtbrule is added.Quoted 5 lines
I have the rule
$(obj)/%.dtb: $(src)/%.dts
$(call if_changed,dtc)
in thearch/x86/kernel/Makefileto prevent this sneaking into other other architectures.This rule looks correct. PowerPC and Microblaze need to be modified to use it. It should not be hard to do, give it a try. Worst case, your first attempt is wrong and the rest of us fix it up. :-)
Quoted 8 lines
Quoted 4 lines
Hint: PowerPC currently puts the .dtb file in a different directory from the source .dts file. It doesn't need to do it that way.
arch/powerpc/boot/Makefilewill need to be modified.I will give it a shot. The only real difference except for the directory structures is powerpc and microblaze add padding to the dtb with the -p 1024 command line argument to dtc.
You could use a $(DTCFLAGS) variable to pass in arch specific flags.
Quoted 2 lines
Is the padding needed when the blob are
linked into vmlinux proper?
Maybe, maybe not. Padding is required to be able to modify the .dtb data in-place, which is important when adapting data from other sources into the device tree structure. However, when it is linked into the kernel, the adding of additional data /possibly/ can be deferred until after the tree is either copied or unflattened.
g.
Re: [PATCH 2/2] of/fdt: add kernel command line option for dtb_compat string
In reply to a message not in the archiveQuoted 7 lines · On Mon, Nov 15, 2010 at 08:01:21PM -0800…
From: Dirk Brandewie <[email protected]>
Add support for specifying a "compatible" string from the kernel command line and functions for the platform to find the compatible blob present in the kernel image if any.
Signed-off-by Dirk Brandewie <[email protected]>
Hi Dirk,
a couple of general comments:
A lot of the information in the cover letter should really be here in the actual patch description. Use the cover letter to provide context for the entire series, but put the specifics with each patch. Version changelog history should also appear in patch description, not the cover letter.
For the next version, please cc: linux-kernel-u79uwXL29TaiAVqoAR/[email protected] This series should have a wider review audience, particularly because
it touches the linker sections and the kernel parameters. You should
also cc: linuxppc-dev-uLR06cmDAlY/[email protected] and microblaze-uclinux-rVRm/[email protected] for the patch that adds the common rules because it will affect both of those architectures directly.
More comments below.
Quoted 38 lines
--- Documentation/kernel-parameters.txt | 7 ++++ drivers/of/fdt.c | 55 +++++++++++++++++++++++++++++++++++ include/linux/of_fdt.h | 5 +++ 3 files changed, 67 insertions(+), 0 deletions(-)Documentation/kernel-parameters.txt +7
-0@@ -655,6 +655,13 @@ and is between 256 and 4096 characters. It is defined in the file dscc4.setup= [NET] + dtb_compat= [KNL] + Specify the "compatible" string for the device + tree blob present in the kernel image. This + string will be used to select the first device + tree blob whose compatible property matches + the string passed on the kernel commandline. + dynamic_printk Enables pr_debug()/dev_dbg() calls if CONFIG_DYNAMIC_PRINTK_DEBUG has been enabled. These can also be switched on/off viadrivers/of/fdt.c +2
-0@@ -15,6 +15,8 @@#include <linux/of_fdt.h> #include <linux/string.h> #include <linux/errno.h> +#include <asm-generic/vmlinux.lds.h> +#ifdef CONFIG_PPC #include <asm/machdep.h>
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 610
Quoted 5 lines
drivers/of/fdt.c +2
-0@@ -604,3 +606,56 @@ void __init unflatten_device_tree(void)pr_debug (" <- unflatten_device_tree()\n" ); } + +#ifndef MODULE
fdt.c cannot be compiled as a module. Is this necessary?
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 611
Quoted 1 line
drivers/of/fdt.c +1
-0+#ifdef CONFIG_OF_FLATTREE
Unnecessary #ifdef. fdt.c is only compiled when CONFIG_OF_FLATTREE is set.
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 622
Quoted 11 lines
drivers/of/fdt.c +11
-0+char dtb_compat_name[MAX_DTB_COMPAT_STR ] ="" ; + +char __init *of_get_dtb_compatible_string (void ) +{ +return dtb_compat_name; +} + + +extern uint8_t __dtb_start[]; +extern uint8_t __dtb_end[]; +void *of_find_compatible_dtb (char *name)
Please rename of_flat_dt_find_compatible_dtb() to match the naming conventions that I'm working to establish in this file.
Also, it should have an __init annotation.
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 627
Quoted 5 lines
drivers/of/fdt.c +5
-0+{ +void *rc =NULL ; +unsigned long root, size; +struct boot_param_header *orig_initial_boot_params; +uint8_t *blob;
blob should be a void* here. It is never used as a uint8.
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 633
Quoted 6 lines
drivers/of/fdt.c +6
-0+ + orig_initial_boot_params = initial_boot_params; + blob = __dtb_start; + initial_boot_params = (struct boot_param_header *)blob; + + do {
Start the loop with "while (blob < __dtb_end) {" to protect against the possibility that __dtb_start == __dtb_end (no dtbs linked in).
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 634
Quoted 1 line
drivers/of/fdt.c +1
-0+ root =of_get_flat_dt_root ();
Just to be defencive, should check the value of initial_boot_params->magic before dereferencing the rest of the structure or trying to parse nodes.
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 636
Quoted 2 lines
drivers/of/fdt.c +2
-0+if (of_flat_dt_is_compatible (root, name) >0 ) { + rc = (void *) blob;
Unnecessary cast (regardless of whether blob is a void* or a uint8_t*).
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 642
Quoted 6 lines
drivers/of/fdt.c +6
-0+break ; + } + + size =be32_to_cpu (initial_boot_params->totalsize); + blob = (uint8_t *)ALIGN (((unsigned long )blob + size), +DTB_ALIGNMENT );
I believe PTR_ALIGN() can be used and the casting removed.
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 652
Quoted 10 lines
drivers/of/fdt.c +10
-0+ initial_boot_params = (struct boot_param_header *)blob; + }while (blob < __dtb_end); + +if (rc ==NULL ) + initial_boot_params = orig_initial_boot_params; +return rc; +} + + +static int __init dtb_compat_setup (char *line)
Please rename of_flat_dt_compat_setup()
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 656
Quoted 4 lines
drivers/of/fdt.c +4
-0+{ +strncpy (dtb_compat_name, line,MAX_DTB_COMPAT_STR ); +return 1 ; +}
I don't remember getting a response about whether or not of_find_compatible_dtb can be called directly from dtb_compat_setup. Doing so would eliminate the arbitrary MAX_DTB_COMPAT_STR because there would be no need to keep around a copy of dtb_compat_name. It also means that of_find_compatible_dtb() can be restricted to the file scope.
Is there a use-case for calling of_find_compatible_dtb() anywhere other than in dtb_compat_setup?
Quoted 10 lines
drivers/of/fdt.c +5
-0+ +early_param ("dtb_compat" , dtb_compat_setup); +#endif +#endif +include/linux/of_fdt.h +0
-0
include/linux/of_fdt.h struct boot_param_header { · line 62
Quoted 5 lines
include/linux/of_fdt.h +2
-0@@ -58,6 +58,8 @@ struct boot_param_header { };#if defined(CONFIG_OF_FLATTREE ) +#define MAX_DTB_COMPAT_STR 64 +
Only used by drivers/of/fdt.c, so should not be in a header file.
include/linux/of_fdt.h extern void early_init_dt_add_memory_arch(u64 base, u64 size); · line 89
Quoted 10 lines
include/linux/of_fdt.h +3
-0/* TBD: Temporary export of fdt globals - remove when code fully merged */ extern int __initdata dt_root_addr_cells;extern int __initdata dt_root_size_cells;@@ -82,6 +84,9 @@ extern void early_init_dt_add_memory_arch(u64 base, u64 size);extern u64 early_init_dt_alloc_memory_arch (u64 size,u64 align);extern u64 dt_mem_next_cell (int s,__be32 **cellp); +extern char *of_get_dtb_compatible_string (void ); +extern void *of_find_compatible_dtb (char *name); +
As commented above, I don't think either of these need to be visible outside of fdt.c
g.
Re: [PATCH 2/2] of/fdt: add kernel command line option for dtb_compat string
In reply to a message not in the archiveQuoted 11 lines · Grant Likely
Quoted 7 lines · On Mon, Nov 15, 2010 at 08:01:21PM -0800…
From: Dirk Brandewie<[email protected]>
Add support for specifying a "compatible" string from the kernel command line and functions for the platform to find the compatible blob present in the kernel image if any.
Signed-off-by Dirk Brandewie<[email protected]>Hi Dirk,
Quoted 8 lines
a couple of general comments:
A lot of the information in the cover letter should really be here in the actual patch description. Use the cover letter to provide context for the entire series, but put the specifics with each patch. Version changelog history should also appear in patch description, not the cover letter.
OK
Quoted 7 lines
For the next version, please cc: linux-kernel-u79uwXL29TaiAVqoAR/[email protected] This series should have a wider review audience, particularly because
it touches the linker sections and the kernel parameters. You should
also cc: linuxppc-dev-uLR06cmDAlY/[email protected] and microblaze-uclinux-rVRm/[email protected] for the patch that adds the common rules because it will affect both of those architectures directly.
Will do
Quoted 12 lines
More comments below.
Quoted 1 line
+#ifndef MODULE
fdt.ccannot be compiled as a module. Is this necessary?Quoted 1 line
+#ifdef
CONFIG_OF_FLATTREEUnnecessary #ifdef.
fdt.cis only compiled whenCONFIG_OF_FLATTREEis set.
Both #ifdef's removed
Quoted 15 lines
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 622
Quoted 11 lines
drivers/of/fdt.c +11
-0+char dtb_compat_name[MAX_DTB_COMPAT_STR ] ="" ; + +char __init *of_get_dtb_compatible_string (void ) +{ +return dtb_compat_name; +} + + +extern uint8_t __dtb_start[]; +extern uint8_t __dtb_end[]; +void *of_find_compatible_dtb (char *name)Please rename
of_flat_dt_find_compatible_dtb()to match the naming conventions that I'm working to establish in this file.
Quoted 2 lines
Also, it should have an
__initannotation.
done
Quoted 8 lines
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 627
Quoted 5 lines
drivers/of/fdt.c +5
-0+{ +void *rc =NULL ; +unsigned long root, size; +struct boot_param_header *orig_initial_boot_params; +uint8_t *blob;blob should be a void* here. It is never used as a uint8.
I used uint8_t prevent compiler warning when blob is compared to __dtb_end
Quoted 10 lines
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 633
Quoted 6 lines
drivers/of/fdt.c +6
-0+ + orig_initial_boot_params = initial_boot_params; + blob = __dtb_start; + initial_boot_params = (struct boot_param_header *)blob; + + do {Start the loop with "while (blob<
__dtb_end) {" to protect against the possibility that__dtb_start==__dtb_end(no dtbs linked in).
Done
Quoted 6 lines
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 634
Quoted 1 line
drivers/of/fdt.c +1
-0+ root =of_get_flat_dt_root ();Just to be defencive, should check the value of
initial_boot_params->magicbefore dereferencing the rest of the structure or trying to parse nodes.
Added as a condition to while loop
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (of_flat_dt_is_compatible(root, name)> 0) { + rc = (void *) blob;Unnecessary cast (regardless of whether blob is a void* or a uint8_t*).
done
Quoted 9 lines
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 642
Quoted 6 lines
drivers/of/fdt.c +6
-0+break ; + } + + size =be32_to_cpu (initial_boot_params->totalsize); + blob = (uint8_t *)ALIGN (((unsigned long )blob + size), +DTB_ALIGNMENT );I believe
PTR_ALIGN()can be used and the casting removed.
done
Quoted 4 lines
Quoted 4 lines
drivers/of/fdt.c +4
-0+ initial_boot_params = (struct boot_param_header *)blob; + }while (blob< __dtb_end); + +if (rc ==NULL )
Quoted 9 lines
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 652
Quoted 6 lines
drivers/of/fdt.c +6
-0+ initial_boot_params = orig_initial_boot_params; +return rc; +} + + +static int __init dtb_compat_setup (char *line)Please rename
of_flat_dt_compat_setup()
done
Quoted 12 lines
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 656
Quoted 4 lines
drivers/of/fdt.c +4
-0+{ +strncpy (dtb_compat_name, line,MAX_DTB_COMPAT_STR ); +return 1 ; +}I don't remember getting a response about whether or not
of_find_compatible_dtbcan be called directly fromdtb_compat_setup. Doing so would eliminate the arbitraryMAX_DTB_COMPAT_STRbecause there would be no need to keep around a copy ofdtb_compat_name. It also means thatof_find_compatible_dtb()can be restricted to the file scope.
Quoted 3 lines
Is there a use-case for calling
of_find_compatible_dtb()anywhere other than indtb_compat_setup?
The use case for having these functions exposed is allowing the platfrom code decide the policy for which dtb will be used in the case where a dtb might have been passed in by the boot loader. These functions can be used as a fallback if a dtb was not passed in or to override of the passed in dtb by the platform code.
Quoted 12 lines
Quoted 12 lines
drivers/of/fdt.c +5
-0+ +early_param ("dtb_compat" , dtb_compat_setup); +#endif +#endif +include/linux/of_fdt.h +0
-0@@ -58,6 +58,8 @@ struct boot_param_header { };
Quoted 6 lines
include/linux/of_fdt.h struct boot_param_header { · line 62
Quoted 3 lines
include/linux/of_fdt.h +2
-0#if defined(CONFIG_OF_FLATTREE ) +#define MAX_DTB_COMPAT_STR 64 +Only used by
drivers/of/fdt.c, so should not be in a header file.
removed
Quoted 15 lines
include/linux/of_fdt.h extern void early_init_dt_add_memory_arch(u64 base, u64 size); · line 89
Quoted 10 lines
include/linux/of_fdt.h +3
-0/* TBD: Temporary export of fdt globals - remove when code fully merged */ extern int __initdata dt_root_addr_cells;extern int __initdata dt_root_size_cells;@@ -82,6 +84,9 @@ extern void early_init_dt_add_memory_arch(u64 base, u64 size);extern u64 early_init_dt_alloc_memory_arch (u64 size,u64 align);extern u64 dt_mem_next_cell (int s,__be32 **cellp); +extern char *of_get_dtb_compatible_string (void ); +extern void *of_find_compatible_dtb (char *name); +As commented above, I don't think either of these need to be visible outside of
fdt.cg.
Re: [PATCH 2/2] of/fdt: add kernel command line option for dtb_compat string
In reply to a message not in the archiveQuoted 9 lines · Dirk Brandewie
Quoted 8 lines · Grant Likely
Quoted 5 lines · On Mon, Nov 15, 2010 at 08:01:21PM -0800…
+{
+ void *rc = NULL;
+ unsigned long root, size;
+ structboot_param_header*orig_initial_boot_params;
+uint8_t*blob;
Quoted 5 lines
Quoted 2 lines
blob should be a void* here. It is never used as a uint8.
I used
uint8_tprevent compiler warning when blob is compared to__dtb_end
okay
Quoted 16 lines
Quoted 12 lines
drivers/of/fdt.c void __init unflatten_device_tree(void) · line 656
Quoted 4 lines
drivers/of/fdt.c +4
-0+{ + strncpy(dtb_compat_name, line, MAX_DTB_COMPAT_STR); + return 1; +}I don't remember getting a response about whether or not
of_find_compatible_dtbcan be called directly fromdtb_compat_setup. Doing so would eliminate the arbitraryMAX_DTB_COMPAT_STRbecause there would be no need to keep around a copy ofdtb_compat_name. It also means thatof_find_compatible_dtb()can be restricted to the file scope.Quoted 3 lines
Is there a use-case for calling
of_find_compatible_dtb()anywhere other than indtb_compat_setup?
Quoted 5 lines
The use case for having these functions exposed is allowing the platfrom code decide the policy for which dtb will be used in the case where a dtb might have been passed in by the boot loader. These functions can be used as a fallback if a dtb was not passed in or to override of the passed in dtb by the platform code.
Still this all looks very generic, even across architectures. I say don't export the functions for now, and change it later if a use case shows up that requires it. I'd really rather not let platform code muck about with it directly if there isn't a use case for it.
However, thinking about it further. You also need to make sure this code is excluded for the powerpc and microblaze architectures because the kernel command line is passed via the device tree blob in those cases. By that time it gets called, it is too late to switch the device tree pointer.
g.
Re: [PATCH 2/2] of/fdt: add kernel command line option for dtb_compat string
In reply to a message not in the archiveQuoted 41 lines · Grant Likely
Quoted 9 lines · Dirk Brandewie
Quoted 8 lines · Grant Likely
Quoted 5 lines · On Mon, Nov 15, 2010 at 08:01:21PM -0800…
(quoted diff) +5
-0+{ + void *rc = NULL; + unsigned long root, size; + struct boot_param_header *orig_initial_boot_params; + uint8_t *blob;Quoted 5 lines
Quoted 2 lines
blob should be a void* here. It is never used as a uint8.
I used
uint8_tprevent compiler warning when blob is compared to__dtb_endokay
Quoted 16 lines
Quoted 12 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+{ + strncpy(dtb_compat_name, line, MAX_DTB_COMPAT_STR); + return 1; +}I don't remember getting a response about whether or not
of_find_compatible_dtbcan be called directly fromdtb_compat_setup. Doing so would eliminate the arbitraryMAX_DTB_COMPAT_STRbecause there would be no need to keep around a copy ofdtb_compat_name. It also means thatof_find_compatible_dtb()can be restricted to the file scope.Quoted 3 lines
Is there a use-case for calling
of_find_compatible_dtb()anywhere other than indtb_compat_setup?Quoted 5 lines
The use case for having these functions exposed is allowing the platfrom code decide the policy for which dtb will be used in the case where a dtb might have been passed in by the boot loader. These functions can be used as a fallback if a dtb was not passed in or to override of the passed in dtb by the platform code.
Quoted 4 lines
Still this all looks very generic, even across architectures. I say don't export the functions for now, and change it later if a use case shows up that requires it. I'd really rather not let platform code muck about with it directly if there isn't a use case for it.
I have the use case for it in my platform. There will two ways that the kernel can get the DTB.
1. The blob is linked in and I go find the one for my platform. This is the path that uses the two new functions.
2. The a pointer blob passed in (physical address) from the bootloader. The blob is relocated/copied to keep the bootloader from having to know the kernel memory layout.
One method will be able to override the other. I am not sure what the precedence between the methods will be ATM.
Quoted 7 lines
However, thinking about it further. You also need to make sure this code is excluded for the powerpc and microblaze architectures because the kernel command line is passed via the device tree blob in those cases. By that time it gets called, it is too late to switch the device tree pointer.
if a "wrapped" kernel is booted doesn't it know exactly which dtb it should be using? These platforms would never go looking for the command line value even it it was passed in.
Quoted 1 line
g.
Re: [PATCH 2/2] of/fdt: add kernel command line option for dtb_compat string
In reply to a message not in the archiveQuoted 59 lines · Dirk Brandewie
Quoted 48 lines · Grant Likely
Quoted 12 lines · Dirk Brandewie
Quoted 10 lines · Grant Likely
Quoted 6 lines · On Mon, Nov 15, 2010 at 08:01:21PM -0800…
+{
+ void *rc = NULL;
+ unsigned long root, size;
+ structboot_param_header*orig_initial_boot_params;
+uint8_t*blob;Quoted 6 lines
Quoted 2 lines
blob should be a void* here. It is never used as a uint8.
I used
uint8_tprevent compiler warning when blob is compared to__dtb_endokay
Quoted 16 lines
Quoted 12 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+{ + strncpy(dtb_compat_name, line, MAX_DTB_COMPAT_STR); + return 1; +}I don't remember getting a response about whether or not
of_find_compatible_dtbcan be called directly fromdtb_compat_setup. Doing so would eliminate the arbitraryMAX_DTB_COMPAT_STRbecause there would be no need to keep around a copy ofdtb_compat_name. It also means thatof_find_compatible_dtb()can be restricted to the file scope.Quoted 3 lines
Is there a use-case for calling
of_find_compatible_dtb()anywhere other than indtb_compat_setup?Quoted 7 lines
The use case for having these functions exposed is allowing the platfrom code decide the policy for which dtb will be used in the case where a dtb might have been passed in by the boot loader. These functions can be used as
a fallback if a dtb was not passed in or to override of the passed in dtb by
the platform code.Quoted 4 lines
Still this all looks very generic, even across architectures. I say don't export the functions for now, and change it later if a use case shows up that requires it. I'd really rather not let platform code muck about with it directly if there isn't a use case for it.
I have the use case for it in my platform. There will two ways that the kernel can get the DTB.
1. The blob is linked in and I go find the one for my platform. This is the path that uses the two new functions.
Quoted 6 lines
2. The a pointer blob passed in (physical address) from the bootloader. The blob is relocated/copied to keep the bootloader from having to know the kernel memory layout.
One method will be able to override the other. I am not sure what the precedence between the methods will be ATM.
ATM, let's assume that all platforms will use the same precedence rules. I really don't want to see arbitrary differences between platforms in this regard. Encode the behaviour fully into fdt.c. If the precedence rules end up being wrong, then it can be changed. If it turns out that different platforms really do need to have different rules, then it can be exported at that time.
g.
Quoted 8 lines
Quoted 6 lines
However, thinking about it further. You also need to make sure this code is excluded for the powerpc and microblaze architectures because the kernel command line is passed via the device tree blob in those cases. By that time it gets called, it is too late to switch the device tree pointer.
if a "wrapped" kernel is booted doesn't it know exactly which dtb it should be using?
Yes. All of the current powerpc dt-wrappers only carry 1 dtb image per wrapper, so the question of which dtb is moot. However, powerpc wrappers are firmware-interface specific, and their entire purpose in life is to translate data from the firmware-specific interface into the dtb representation. Powerpc history has a number of oddball firmware interfaces with no way to detect which one is being used. Therefore, the wrapper has to be hand chosen for each legacy platform.
Quoted 2 lines
These platforms would never go looking for the command line value even it it was passed in.
Correct. On PowerPC the vmlinux entry point *requires* passing in a device tree, so the command line value isn't useful.
g.
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.