* Re: [sodaville] [RFC] [PATCH V3 0/2] Adding DTB to architecture independent vmlinux
[not found] ` <cover.1289411770.git.dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2010-11-10 18:46 ` H. Peter Anvin
[not found] ` <4CDAE874.1000707-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2010-11-10 18:52 ` [PATCH 1/3] of: Add support for linking device tree blobs into vmlinux dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
2010-11-10 18:52 ` [PATCH 2/3] x86/of: Support building device tree blob(s) into image dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
2 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2010-11-10 18:46 UTC (permalink / raw)
To: dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
Cc: sodaville-hfZtesqFncYOwBW4kG4KsQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
arjan-VuQAYsv1563Yd54FQh9/CA
On 11/10/2010 10:52 AM, dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>
> The DTB's have been moved into the .init.data section.
>
Writeable? (As opposed to .init.rodata)?
-hpa
^ permalink raw reply [flat|nested] 8+ messages in thread
* [RFC] [PATCH V3 0/2] Adding DTB to architecture independent vmlinux
@ 2010-11-10 18:52 dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
[not found] ` <cover.1289411770.git.dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w @ 2010-11-10 18:52 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
sodaville-hfZtesqFncYOwBW4kG4KsQ
Cc: arjan-VuQAYsv1563Yd54FQh9/CA
From: Dirk Brandewie <dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
These patches add support for linking device tree blob(s) into
vmlinux.
The changes since V2:
patch has been split into architecture independent and x86 specific
parts.
The DTB's have been moved into the .init.data section.
The DTB's linked into vmlinux is controlled by kernel config
variables. Specifying the DTB on the make command line is gone.
Linking multiple DTB's into image is supported. (suggested by David
VomLehn and refined with the help of HPA and Grant Likely)
Specific issues I would like feed back on:
Is the padding added on the dtc invocation needed since the paltform
code will have to copy the tree out of the init section?
Setting $(dtstree) in the arch specific makefile is required is there
a better write the cmd_dtc in Makefile.lib?
Things on the TODO list:
[generic]
Pass DTB name/compatible string on the kernel command line.
Add funciton to find "compatible" root node in the set of DTB's linked
in.
[x86]
Add function to relocate DTB whose address is passed in via setup_data
ala init_rd.
Comments/Suggestions?
Dirk Brandewie (2):
of: Add support for linking device tree blobs into vmlinux
x86/of: Support building device tree blob(s) into image.
arch/x86/Kconfig | 6 +++++-
arch/x86/boot/dts/Kconfig | 8 ++++++++
arch/x86/kernel/Makefile | 11 +++++++++++
include/asm-generic/vmlinux.lds.h | 12 ++++++++++++
init/Kconfig | 7 +++++++
scripts/Makefile.lib | 14 ++++++++++++++
6 files changed, 57 insertions(+), 1 deletions(-)
create mode 100644 arch/x86/boot/dts/Kconfig
--
1.7.2.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] of: Add support for linking device tree blobs into vmlinux
[not found] ` <cover.1289411770.git.dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-11-10 18:46 ` [sodaville] " H. Peter Anvin
@ 2010-11-10 18:52 ` dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
2010-11-10 18:52 ` [PATCH 2/3] x86/of: Support building device tree blob(s) into image dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
2 siblings, 0 replies; 8+ messages in thread
From: dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w @ 2010-11-10 18:52 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
sodaville-hfZtesqFncYOwBW4kG4KsQ
Cc: arjan-VuQAYsv1563Yd54FQh9/CA
From: Dirk Brandewie <dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
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 <dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
include/asm-generic/vmlinux.lds.h | 12 ++++++++++++
init/Kconfig | 7 +++++++
scripts/Makefile.lib | 14 ++++++++++++++
3 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index bd69d79..a36dab5 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -146,6 +146,17 @@
#define TRACE_SYSCALLS()
#endif
+#ifdef CONFIG_KERNEL_DTB
+#define KERNEL_DTB \
+ . = ALIGN(4); \
+ VMLINUX_SYMBOL(__dtb_start) = .; \
+ *(.dtb) \
+ VMLINUX_SYMBOL(__dtb_end) = .;
+
+#else
+#define KERNEL_DTB
+#endif
+
/* .data section */
#define DATA_DATA \
*(.data) \
@@ -772,6 +783,7 @@
CON_INITCALL \
SECURITY_INITCALL \
INIT_RAM_FS \
+ KERNEL_DTB \
}
#define BSS_SECTION(sbss_align, bss_align, stop_align) \
diff --git a/init/Kconfig b/init/Kconfig
index 88c1046..fddfc0f 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1083,6 +1083,13 @@ config PCI_QUIRKS
bugs/quirks. Disable this only if your target machine is
unaffected by PCI quirks.
+config KERNEL_DTB
+ bool "Support linking a device tree blob into vmlinux"
+ default n
+ help
+ This option provides support for adding a device tree blob(s)
+ directly to vmlinux
+
config SLUB_DEBUG
default y
bool "Enable SLUB debugging support" if EMBEDDED
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 4c72c11..6481f27 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -200,6 +200,20 @@ quiet_cmd_gzip = GZIP $@
cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \
(rm -f $@ ; false)
+# DTC
+# ---------------------------------------------------------------------------
+$(obj)/%.dtb.S: $(obj)/%.dtb
+ @echo '.section .dtb,"a"' > $@
+ @echo '.global __$(*F)_dtb_begin' >> $@
+ @echo '__$(*F)_dtb_begin:' >> $@
+ @echo '.incbin "$<" ' >> $@
+ @echo '.global __$(*F)_dtb_end' >> $@
+ @echo '__$(*F)_dtb_end:' >> $@
+
+DTC = $(objtree)/scripts/dtc/dtc
+
+quiet_cmd_dtc = DTC $@
+ cmd_dtc = $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 -p 1024 $(dtstree)/$*.dts
# Bzip2
# ---------------------------------------------------------------------------
--
1.7.2.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] x86/of: Support building device tree blob(s) into image.
[not found] ` <cover.1289411770.git.dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-11-10 18:46 ` [sodaville] " H. Peter Anvin
2010-11-10 18:52 ` [PATCH 1/3] of: Add support for linking device tree blobs into vmlinux dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
@ 2010-11-10 18:52 ` dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
2 siblings, 0 replies; 8+ messages in thread
From: dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w @ 2010-11-10 18:52 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
sodaville-hfZtesqFncYOwBW4kG4KsQ
Cc: arjan-VuQAYsv1563Yd54FQh9/CA
From: Dirk Brandewie <dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
This patch adds support for linking device tree blobs into vmlinux.
The blobs linked into the image is controlled via kernel config
variables
Signed-off-by: Dirk Brandewie <dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
arch/x86/Kconfig | 6 +++++-
arch/x86/boot/dts/Kconfig | 8 ++++++++
arch/x86/kernel/Makefile | 11 +++++++++++
3 files changed, 24 insertions(+), 1 deletions(-)
create mode 100644 arch/x86/boot/dts/Kconfig
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5904f38..62c195d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -299,13 +299,17 @@ config X86_BIGSMP
---help---
This option is needed for the systems that have more than 8 CPUs
-config X86_OF
+menuconfig X86_OF
bool "Support for device tree"
select OF
select OF_FLATTREE
---help---
Device tree support on X86.
+if X86_OF
+source "arch/x86/boot/dts/Kconfig
+endif
+
if X86_32
config X86_EXTENDED_PLATFORM
bool "Support for extended (non-PC) x86 platforms"
diff --git a/arch/x86/boot/dts/Kconfig b/arch/x86/boot/dts/Kconfig
new file mode 100644
index 0000000..5380b6b
--- /dev/null
+++ b/arch/x86/boot/dts/Kconfig
@@ -0,0 +1,8 @@
+config CE4100_DTB
+ bool "Intel CE4100"
+ depends on X86_OF && KERNEL_DTB
+
+config TEST_DTB
+ bool "Test DTS"
+ depends on X86_OF && KERNEL_DTB
+
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 586df14..cf15e8c 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -113,6 +113,17 @@ obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o
obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
obj-$(CONFIG_X86_OF) += prom.o
+ifeq ($(CONFIG_KERNEL_DTB),y)
+obj-$(CONFIG_CE4100_DTB) += ce4100.dtb.o
+obj-$(CONFIG_TEST_DTB) += test.dtb.o
+endif
+
+dtstree := $(srctree)/arch/x86/boot/dts
+
+$(obj)/%.dtb: $(dtstree)/%.dts
+ $(call if_changed,dtc)
+
+
###
# 64 bit specific files
ifeq ($(CONFIG_X86_64),y)
--
1.7.2.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [sodaville] [RFC] [PATCH V3 0/2] Adding DTB to architecture independent vmlinux
[not found] ` <4CDAED3C.6010304-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2010-11-10 18:53 ` H. Peter Anvin
[not found] ` <4CDAEA26.6040206-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2010-11-10 18:53 UTC (permalink / raw)
To: Dirk Brandewie
Cc: sodaville-hfZtesqFncYOwBW4kG4KsQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
arjan-VuQAYsv1563Yd54FQh9/CA
On 11/10/2010 11:06 AM, Dirk Brandewie wrote:
> On 11/10/2010 10:46 AM, H. Peter Anvin wrote:
>> On 11/10/2010 10:52 AM, dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>>>
>>> The DTB's have been moved into the .init.data section.
>>
>> Writeable? (As opposed to .init.rodata)?
>>
>
> That is what I remember from the conversation with Grant but I could be
> mistaken. It is simple enough to move as long as the interested parties agree :-)
>
Obviously. I'd like to see it readonly unless there is an explicit
reason not to, of course.
-hpa
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [sodaville] [RFC] [PATCH V3 0/2] Adding DTB to architecture independent vmlinux
[not found] ` <4CDAEA26.6040206-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2010-11-10 18:55 ` Grant Likely
[not found] ` <AANLkTimgLO0vAQiF4uwHkHnz7SHxiq+KD2iUYV_Y8-Fk-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Grant Likely @ 2010-11-10 18:55 UTC (permalink / raw)
To: H. Peter Anvin
Cc: sodaville-hfZtesqFncYOwBW4kG4KsQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
arjan-VuQAYsv1563Yd54FQh9/CA
On Wed, Nov 10, 2010 at 11:53 AM, H. Peter Anvin <hpa-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> wrote:
> On 11/10/2010 11:06 AM, Dirk Brandewie wrote:
>> On 11/10/2010 10:46 AM, H. Peter Anvin wrote:
>>> On 11/10/2010 10:52 AM, dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>>>>
>>>> The DTB's have been moved into the .init.data section.
>>>
>>> Writeable? (As opposed to .init.rodata)?
>>>
>>
>> That is what I remember from the conversation with Grant but I could be
>> mistaken. It is simple enough to move as long as the interested parties agree :-)
>>
>
> Obviously. I'd like to see it readonly unless there is an explicit
> reason not to, of course.
Definitely it should be ro
g.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [sodaville] [RFC] [PATCH V3 0/2] Adding DTB to architecture independent vmlinux
[not found] ` <4CDAE874.1000707-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2010-11-10 19:06 ` Dirk Brandewie
[not found] ` <4CDAED3C.6010304-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Dirk Brandewie @ 2010-11-10 19:06 UTC (permalink / raw)
To: H. Peter Anvin
Cc: sodaville-hfZtesqFncYOwBW4kG4KsQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
arjan-VuQAYsv1563Yd54FQh9/CA
On 11/10/2010 10:46 AM, H. Peter Anvin wrote:
> On 11/10/2010 10:52 AM, dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>>
>> The DTB's have been moved into the .init.data section.
>>
>
> Writeable? (As opposed to .init.rodata)?
>
That is what I remember from the conversation with Grant but I could be
mistaken. It is simple enough to move as long as the interested parties agree :-)
--Dirk
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [sodaville] [RFC] [PATCH V3 0/2] Adding DTB to architecture independent vmlinux
[not found] ` <AANLkTimgLO0vAQiF4uwHkHnz7SHxiq+KD2iUYV_Y8-Fk-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-11-10 21:33 ` Dirk Brandewie
0 siblings, 0 replies; 8+ messages in thread
From: Dirk Brandewie @ 2010-11-10 21:33 UTC (permalink / raw)
To: Grant Likely
Cc: sodaville-hfZtesqFncYOwBW4kG4KsQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, H. Peter Anvin,
arjan-VuQAYsv1563Yd54FQh9/CA
On 11/10/2010 10:55 AM, Grant Likely wrote:
> On Wed, Nov 10, 2010 at 11:53 AM, H. Peter Anvin<hpa-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> wrote:
>> On 11/10/2010 11:06 AM, Dirk Brandewie wrote:
>>> On 11/10/2010 10:46 AM, H. Peter Anvin wrote:
>>>> On 11/10/2010 10:52 AM, dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>>>>>
>>>>> The DTB's have been moved into the .init.data section.
>>>>
>>>> Writeable? (As opposed to .init.rodata)?
>>>>
>>>
>>> That is what I remember from the conversation with Grant but I could be
>>> mistaken. It is simple enough to move as long as the interested parties agree :-)
>>>
>>
>> Obviously. I'd like to see it readonly unless there is an explicit
>> reason not to, of course.
>
> Definitely it should be ro
>
So I am a little confused (no big surprise :-)
objdump -h vmlinux shows in part:
3 .rodata 000d61b8 c1358000 01358000 00359000 2**5
CONTENTS, ALLOC, LOAD, READONLY, DATA
10 __init_rodata 00003a90 c1450be0 01450be0 00451be0 2**5
CONTENTS, ALLOC, LOAD, READONLY, DATA
13 .init.text 0002b297 c1488000 01488000 00489000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
14 .init.data 0001e5e0 c14b32a0 014b32a0 004b42a0 2**5
CONTENTS, ALLOC, LOAD, DATA
There is no .init.rodata section that I can find.
It seems like correct place to park the DTB with the other init data in
.init.data. section by adding the KERNEL_DTB macro to the INIT_DATA macro in
vmlinux.lds.h. This picks up the largest number of architectures that use
vmlinux.lds.h. INIT_DATA gets picked up by
#define INIT_DATA_SECTION(initsetup_align) \
.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
INIT_DATA \
INIT_SETUP(initsetup_align) \
INIT_CALLS \
CON_INITCALL \
SECURITY_INITCALL \
INIT_RAM_FS \
}
We could go into the INIT_TEXT macro to get the blobs into a RO section but that
seems kind of wrong.
IMHO if someone starts modifying things in .init.data and expect the changes to
stick they deserve what they get.
Comments/Suggestions?
--Dirk
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-11-10 21:33 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-10 18:52 [RFC] [PATCH V3 0/2] Adding DTB to architecture independent vmlinux dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
[not found] ` <cover.1289411770.git.dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-11-10 18:46 ` [sodaville] " H. Peter Anvin
[not found] ` <4CDAE874.1000707-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2010-11-10 19:06 ` Dirk Brandewie
[not found] ` <4CDAED3C.6010304-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-11-10 18:53 ` H. Peter Anvin
[not found] ` <4CDAEA26.6040206-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2010-11-10 18:55 ` Grant Likely
[not found] ` <AANLkTimgLO0vAQiF4uwHkHnz7SHxiq+KD2iUYV_Y8-Fk-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-10 21:33 ` Dirk Brandewie
2010-11-10 18:52 ` [PATCH 1/3] of: Add support for linking device tree blobs into vmlinux dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
2010-11-10 18:52 ` [PATCH 2/3] x86/of: Support building device tree blob(s) into image dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).