ARM: split out ATAGS parsing
PATCH 1/2 ARM: split out ATAGS parsing
Make ATAGS parsing into a source file of its own, namely atags_parse.c. Also rename compat.c to atags_compat.c to make it clearer what it is about. Same for atags.c which is now atags_proc.c. Gather all the atags function declarations into a common atags.h.
---
arch/arm/kernel/Makefile | 6 +-
arch/arm/kernel/atags.h | 3 +
arch/arm/kernel/{compat.c => atags_compat.c} | 4 +-
arch/arm/kernel/atags_parse.c | 238 +++++++++++++++++++++++++++
arch/arm/kernel/{atags.c => atags_proc.c} | 0
arch/arm/kernel/compat.h | 11 --
arch/arm/kernel/setup.c | 236 +-------------------------
7 files changed, 247 insertions(+), 251 deletions(-)
rename arch/arm/kernel/{compat.c => atags_compat.c} (99%)
create mode 100644 arch/arm/kernel/atags_parse.c
rename arch/arm/kernel/{atags.c => atags_proc.c} (100%)
delete mode 100644 arch/arm/kernel/compat.harch/arm/kernel/Makefile +3 -3
@@ -15,11 +15,11 @@ CFLAGS_REMOVE_return_address.o = -pg # Object file lists. -obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \ +obj-y := atags_parse.o elf.o entry-armv.o entry-common.o irq.o opcodes.o \ process.o ptrace.o return_address.o sched_clock.o \ setup.o signal.o stacktrace.o sys_arm.o time.o traps.o -obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o +obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o obj-$(CONFIG_LEDS) += leds.o obj-$(CONFIG_OC_ETM) += etm.o
@@ -52,7 +52,7 @@ test-kprobes-objs += kprobes-test-thumb.o else test-kprobes-objs += kprobes-test-arm.o endif -obj-$(CONFIG_ATAGS_PROC) += atags.o +obj-$(CONFIG_ATAGS_PROC) += atags_proc.o obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o obj-$(CONFIG_ARM_THUMBEE) += thumbee.o obj-$(CONFIG_KGDB) += kgdb.o
arch/arm/kernel/atags.h +3 -0
@@ -3,3 +3,6 @@ extern void save_atags(struct tag *tags);#else static inline void save_atags (struct tag *tags) { }#endif + +void convert_to_tag_list (struct tag *tags); +struct machine_desc *setup_machine_tags (phys_addr_t __atags_pointer,unsigned int machine_nr);
arch/arm/kernel/atags_compat.c renamed from arch/arm/kernel/compat.c +2 -2
@@ -1,5 +1,5 @@/* -* linux/arch/arm/kernel/compat.c +* linux/arch/arm/kernel/atags_compat.c * * Copyright (C) 2001 Russell King *
@@ -26,7 +26,7 @@#include <asm/mach/arch.h> -#include "compat.h" +#include "atags.h" /* * Usage:
arch/arm/kernel/atags_parse.c new file +238 -0
238 lines not on this page · raw message
arch/arm/kernel/atags_proc.c renamed from arch/arm/kernel/atags.c +0 -0
arch/arm/kernel/compat.h deleted +0 -11
@@ -1,11 +0,0 @@ -/* -* linux/arch/arm/kernel/compat.h -* -* Copyright (C) 2001 Russell King -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -*/ - -extern void convert_to_tag_list (struct tag *tags);
arch/arm/kernel/setup.c +1 -235
292 lines not on this page · raw message
Signature · 1 line
1.7.12.84.gefa6462
PATCH 2/2 ARM: allow for ATAGS to be configured out when DT support is selected
Now that ATAGS support is well contained, we can easily remove it from the kernel build if so desired. It has to explicitly be disabled, and only when DT support is selected.
Note: disabling kernel ATAGS support does not prevent the usage of CONFIG_ARM_ATAG_DTB_COMPAT.
--- arch/arm/Kconfig | 26 +++++++++++++++++++------- arch/arm/kernel/Makefile | 5 +++-- arch/arm/kernel/atags.h | 11 +++++++++++ 3 files changed, 33 insertions(+), 9 deletions(-)
arch/arm/Kconfig +19 -7
@@ -1891,12 +1891,6 @@ config CC_STACKPROTECTOR neutralized via a kernel panic. This feature requires gcc version 4.2 or above. -config DEPRECATED_PARAM_STRUCT - bool "Provide old way to pass kernel parameters" - help - This was deprecated in 2001 and announced to live on for 5 years. - Some old boot loaders still use this way. - endmenu menu "Boot options"
@@ -1909,6 +1903,23 @@ config USE_OF help Include support for flattened device tree machine descriptions. +config ATAGS + bool "Support for the traditional ATAGS boot data passing" if USE_OF + default y + help + This is the traditional way of passing data to the kernel at boot + time. If you are solely relying on the flattened device tree (or + the ARM_ATAG_DTB_COMPAT option) then you may unselect this option + to remove ATAGS support from your kernel binary. If unsure, + leave this to y. + +config DEPRECATED_PARAM_STRUCT + bool "Provide old way to pass kernel parameters" + depends on ATAGS + help + This was deprecated in 2001 and announced to live on for 5 years. + Some old boot loaders still use this way. + # Compressed boot loader in ROM. Yes, we really want to ask about # TEXT and BSS so we preserve their values in the config files. config ZBOOT_ROM_TEXT
@@ -2035,6 +2046,7 @@ config CMDLINE choice prompt "Kernel command line type" if CMDLINE != "" default CMDLINE_FROM_BOOTLOADER + depends on ATAGS config CMDLINE_FROM_BOOTLOADER bool "Use bootloader kernel arguments if available"
@@ -2104,7 +2116,7 @@ config KEXEC config ATAGS_PROC bool "Export atags in procfs" - depends on KEXEC + depends on ATAGS && KEXEC default y help Should the atags used to boot the kernel be exported in an "atags"
arch/arm/kernel/Makefile +3 -2
@@ -15,10 +15,12 @@ CFLAGS_REMOVE_return_address.o = -pg # Object file lists. -obj-y := atags_parse.o elf.o entry-armv.o entry-common.o irq.o opcodes.o \ +obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \ process.o ptrace.o return_address.o sched_clock.o \ setup.o signal.o stacktrace.o sys_arm.o time.o traps.o +obj-$(CONFIG_ATAGS) += atags_parse.o +obj-$(CONFIG_ATAGS_PROC) += atags_proc.o obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o obj-$(CONFIG_LEDS) += leds.o
@@ -52,7 +54,6 @@ test-kprobes-objs += kprobes-test-thumb.o else test-kprobes-objs += kprobes-test-arm.o endif -obj-$(CONFIG_ATAGS_PROC) += atags_proc.o obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o obj-$(CONFIG_ARM_THUMBEE) += thumbee.o obj-$(CONFIG_KGDB) += kgdb.o
arch/arm/kernel/atags.h +11 -0
@@ -5,4 +5,15 @@ static inline void save_atags(struct tag *tags) { }#endif void convert_to_tag_list (struct tag *tags); + +#ifdef CONFIG_ATAGS struct machine_desc *setup_machine_tags (phys_addr_t __atags_pointer,unsigned int machine_nr); +#else +static inline struct machine_desc * +setup_machine_tags (phys_addr_t __atags_pointer,unsigned int machine_nr) +{ +early_print ("no ATAGS support: can't continue\n" ); +while (true); +unreachable (); +} +#endif
Signature · 1 line
1.7.12.84.gefa6462
PATCH 2/2 ARM: allow for ATAGS to be configured out when DT support is selected
Quoted 3 lines · Nicolas Pitre
Now that ATAGS support is well contained, we can easily remove it from the kernel build if so desired. It has to explicitly be disabled, and only when DT support is selected.
I patched this on top of my Integrator patch stack and disabled the ATAGS, it just works.
I'd suggest you to put this into Russells tracker then?
Yours,
Linus Walleij
PATCH 2/2 ARM: allow for ATAGS to be configured out when DT support is selected
Quoted 11 lines · Linus Walleij
Quoted 3 lines · Nicolas Pitre
Now that ATAGS support is well contained, we can easily remove it from the kernel build if so desired. It has to explicitly be disabled, and only when DT support is selected.
I patched this on top of my Integrator patch stack and disabled the ATAGS, it just works.
Tested-by Linus Walleij <[email protected]>
Thanks.
Quoted 1 line
I'd suggest you to put this into Russells tracker then?
Certainly. I just wanted someone else than myself to test it / look at it before I do so.
Nicolas
PATCH 2/2 ARM: allow for ATAGS to be configured out when DT support is selected
In reply to Nicolas PitreQuoted 9 lines · Nicolas Pitre
Now that ATAGS support is well contained, we can easily remove it from the kernel build if so desired. It has to explicitly be disabled, and only when DT support is selected.
Note: disabling kernel ATAGS support does not prevent the usage of
CONFIG_ARM_ATAG_DTB_COMPAT....
arch/arm/Kconfig config USE_OF · line 1914
Quoted 9 lines
arch/arm/Kconfig +9
-0+config ATAGS + bool "Support for the traditional ATAGS boot data passing" if USE_OF + default y + help + This is the traditional way of passing data to the kernel at boot + time. If you are solely relying on the flattened device tree (or + the ARM_ATAG_DTB_COMPAT option) then you may unselect this option + to remove ATAGS support from your kernel binary. If unsure, + leave this to y.
That's a clever way of implementing it, I had not though of making it an optional default-y symbol.
Should we do patches to the individual platforms bsaed on this to disable the ATAG based board files when CONFIG_ATAG is disabled?
Arnd
PATCH 2/2 ARM: allow for ATAGS to be configured out when DT support is selected
Quoted 23 lines · Arnd Bergmann
Quoted 9 lines · Nicolas Pitre
Now that ATAGS support is well contained, we can easily remove it from the kernel build if so desired. It has to explicitly be disabled, and only when DT support is selected.
Note: disabling kernel ATAGS support does not prevent the usage of
CONFIG_ARM_ATAG_DTB_COMPAT....
arch/arm/Kconfig config USE_OF · line 1914
Quoted 9 lines
arch/arm/Kconfig +9
-0+config ATAGS + bool "Support for the traditional ATAGS boot data passing" if USE_OF + default y + help + This is the traditional way of passing data to the kernel at boot + time. If you are solely relying on the flattened device tree (or + the ARM_ATAG_DTB_COMPAT option) then you may unselect this option + to remove ATAGS support from your kernel binary. If unsure, + leave this to y.That's a clever way of implementing it, I had not though of making it an optional default-y symbol.
Quoted 1 line
Acked-by Arnd Bergmann <[email protected]>
Thanks.
Quoted 2 lines
Should we do patches to the individual platforms bsaed on this to disable the ATAG based board files when
CONFIG_ATAGis disabled?
Well... that could be a good thing to make them depend on ATAGS indeed. But that can be done incrementally in later patches.
Nicolas
PATCH 2/2 ARM: allow for ATAGS to be configured out when DT support is selected
In reply to Nicolas PitreQuoted 19 lines · Nicolas Pitre
Now that ATAGS support is well contained, we can easily remove it from the kernel build if so desired. It has to explicitly be disabled, and only when DT support is selected.
Note: disabling kernel ATAGS support does not prevent the usage of
CONFIG_ARM_ATAG_DTB_COMPAT.Signed-off-by Nicolas Pitre <[email protected]>--- arch/arm/Kconfig | 26 +++++++++++++++++++------- arch/arm/kernel/Makefile | 5 +++-- arch/arm/kernel/atags.h | 11 +++++++++++ 3 files changed, 33 insertions(+), 9 deletions(-)arch/arm/Kconfig +0
-0
arch/arm/Kconfig config CC_STACKPROTECTOR · line 1894
Quoted 10 lines
arch/arm/Kconfig +0
-6@@ -1891,12 +1891,6 @@ config CC_STACKPROTECTOR neutralized via a kernel panic. This feature requires gcc version 4.2 or above. -config DEPRECATED_PARAM_STRUCT - bool "Provide old way to pass kernel parameters" - help - This was deprecated in 2001 and announced to live on for 5 years. - Some old boot loaders still use this way. - endmenu
Since you're in this area, do we need to carry this forward? If somebody is using it then obviously we have to keep it but it might be worth asking around.
Back on topic, this looks good to me:
Will
PATCH 2/2 ARM: allow for ATAGS to be configured out when DT support is selected
Quoted 23 lines · Will Deacon
Quoted 22 lines · Nicolas Pitre
Now that ATAGS support is well contained, we can easily remove it from the kernel build if so desired. It has to explicitly be disabled, and only when DT support is selected.
Note: disabling kernel ATAGS support does not prevent the usage of
CONFIG_ARM_ATAG_DTB_COMPAT.Signed-off-by Nicolas Pitre <[email protected]>--- arch/arm/Kconfig | 26 +++++++++++++++++++------- arch/arm/kernel/Makefile | 5 +++-- arch/arm/kernel/atags.h | 11 +++++++++++ 3 files changed, 33 insertions(+), 9 deletions(-)arch/arm/Kconfig +0
-0@@ -1891,12 +1891,6 @@ config CC_STACKPROTECTOR neutralized via a kernel panic. This feature requires gcc version 4.2 or above.
Quoted 11 lines
arch/arm/Kconfig config CC_STACKPROTECTOR · line 1894
Quoted 7 lines
arch/arm/Kconfig +0
-6-config DEPRECATED_PARAM_STRUCT - bool "Provide old way to pass kernel parameters" - help - This was deprecated in 2001 and announced to live on for 5 years. - Some old boot loaders still use this way. - endmenuSince you're in this area, do we need to carry this forward? If somebody is using it then obviously we have to keep it but it might be worth asking around.
That should be a separate patch if that has to be dropped. Right now that code is already in a file of its own and not getting in the way of anything else, and I didn't want to change any behavior on legacy platforms.
Quoted 3 lines
Back on topic, this looks good to me:
Acked-by Will Deacon <[email protected]>
Thanks.
Nicolas
PATCH 2/2 ARM: allow for ATAGS to be configured out when DT support is selected
In reply to Nicolas PitreQuoted 8 lines · Nicolas Pitre
Now that ATAGS support is well contained, we can easily remove it from the kernel build if so desired. It has to explicitly be disabled, and only when DT support is selected.
Note: disabling kernel ATAGS support does not prevent the usage of
CONFIG_ARM_ATAG_DTB_COMPAT.Signed-off-by Nicolas Pitre <[email protected]>
Nice!
-Olof