diff mbox

[2/2] ARM: allow for ATAGS to be configured out when DT support is selected

Message ID 1346361008-7320-2-git-send-email-nicolas.pitre@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Nicolas Pitre Aug. 30, 2012, 9:10 p.m. UTC
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 <nico@linaro.org>
---
 arch/arm/Kconfig         | 26 +++++++++++++++++++-------
 arch/arm/kernel/Makefile |  5 +++--
 arch/arm/kernel/atags.h  | 11 +++++++++++
 3 files changed, 33 insertions(+), 9 deletions(-)

Comments

Linus Walleij Sept. 1, 2012, 12:23 a.m. UTC | #1
On Thu, Aug 30, 2012 at 11:10 PM, Nicolas Pitre
<nicolas.pitre@linaro.org> wrote:

> 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 <linus.walleij@linaro.org>

I'd suggest you to put this into Russells tracker then?

Yours,
Linus Walleij
Nicolas Pitre Sept. 1, 2012, 1:48 a.m. UTC | #2
On Sat, 1 Sep 2012, Linus Walleij wrote:

> On Thu, Aug 30, 2012 at 11:10 PM, Nicolas Pitre
> <nicolas.pitre@linaro.org> wrote:
> 
> > 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 <linus.walleij@linaro.org>

Thanks.

> 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
Arnd Bergmann Sept. 1, 2012, 8:25 p.m. UTC | #3
On Thursday 30 August 2012, Nicolas Pitre wrote:
> 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.

> ...

> +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.

Acked-by: Arnd Bergmann <arnd@arndb.de>

Should we do patches to the individual platforms bsaed on this to disable
the ATAG based board files when CONFIG_ATAG is disabled?

	Arnd
Will Deacon Sept. 2, 2012, 3:54 p.m. UTC | #4
On Thu, Aug 30, 2012 at 10:10:08PM +0100, Nicolas Pitre wrote:
> 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 <nico@linaro.org>
> ---
>  arch/arm/Kconfig         | 26 +++++++++++++++++++-------
>  arch/arm/kernel/Makefile |  5 +++--
>  arch/arm/kernel/atags.h  | 11 +++++++++++
>  3 files changed, 33 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index c5f9ae5dbd..5c7302e208 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -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:

Acked-by: Will Deacon <will.deacon@arm.com>

Will
Nicolas Pitre Sept. 4, 2012, 2:47 a.m. UTC | #5
On Sun, 2 Sep 2012, Will Deacon wrote:

> On Thu, Aug 30, 2012 at 10:10:08PM +0100, Nicolas Pitre wrote:
> > 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 <nico@linaro.org>
> > ---
> >  arch/arm/Kconfig         | 26 +++++++++++++++++++-------
> >  arch/arm/kernel/Makefile |  5 +++--
> >  arch/arm/kernel/atags.h  | 11 +++++++++++
> >  3 files changed, 33 insertions(+), 9 deletions(-)
> > 
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index c5f9ae5dbd..5c7302e208 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -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.

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.

> Back on topic, this looks good to me:
> 
> Acked-by: Will Deacon <will.deacon@arm.com>

Thanks.


Nicolas
Nicolas Pitre Sept. 4, 2012, 2:56 a.m. UTC | #6
On Sat, 1 Sep 2012, Arnd Bergmann wrote:

> On Thursday 30 August 2012, Nicolas Pitre wrote:
> > 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.
> 
> > ...
> 
> > +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.
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>

Thanks.

> Should we do patches to the individual platforms bsaed on this to disable
> the ATAG based board files when CONFIG_ATAG is 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
Olof Johansson Sept. 5, 2012, 5:24 a.m. UTC | #7
On Thu, Aug 30, 2012 at 05:10:08PM -0400, Nicolas Pitre wrote:
> 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 <nico@linaro.org>

Nice!

Acked-by: Olof Johansson <olof@lixom.net>


-Olof
diff mbox

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c5f9ae5dbd..5c7302e208 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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"
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 086c9d3bc3..79e346a5d7 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -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
diff --git a/arch/arm/kernel/atags.h b/arch/arm/kernel/atags.h
index a888fdd381..9edc969233 100644
--- a/arch/arm/kernel/atags.h
+++ b/arch/arm/kernel/atags.h
@@ -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