Patchwork [U-Boot,v2,03/10] x86: Allow excluding reset vector code from u-boot

login
register
mail settings
Submitter Simon Glass
Date Oct. 10, 2012, 11:12 p.m.
Message ID <1349910781-32088-4-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/190816/
State Superseded, archived
Delegated to: Simon Glass
Headers show

Comments

Simon Glass - Oct. 10, 2012, 11:12 p.m.
From: Gabe Black <gabeblack@chromium.org>

When running from coreboot we don't want this code.

This version works by ifdef-ing out all of the code that would go
into those sections and all the code that refers to it. The sections are
then empty, and the linker will either leave them empty for the loader
to ignore or remove them entirely.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Put CONFIG_NO_RESET_CODE into Makefile instead of source files

 Makefile                |    7 +++++--
 arch/x86/cpu/Makefile   |    5 ++++-
 arch/x86/cpu/u-boot.lds |    3 +++
 3 files changed, 12 insertions(+), 3 deletions(-)
Wolfgang Denk - Nov. 20, 2012, 6:56 a.m.
Dear Simon Glass,

In message <1349910781-32088-4-git-send-email-sjg@chromium.org> you wrote:
> From: Gabe Black <gabeblack@chromium.org>
> 
> When running from coreboot we don't want this code.
> 
> This version works by ifdef-ing out all of the code that would go
> into those sections and all the code that refers to it. The sections are
> then empty, and the linker will either leave them empty for the loader
> to ignore or remove them entirely.
> 
> Signed-off-by: Gabe Black <gabeblack@chromium.org>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> Changes in v2:
> - Put CONFIG_NO_RESET_CODE into Makefile instead of source files

What exactly is CONFIG_NO_RESET_CODE ?

There is no documentation anywhere for such a config option as is
mandatory when introducing it, nor is there any comment why it would
be needed, nor are there any users for it.


>  Makefile                |    7 +++++--
>  arch/x86/cpu/Makefile   |    5 ++++-
>  arch/x86/cpu/u-boot.lds |    3 +++
>  3 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 34d9075..6c2f357 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -212,9 +212,12 @@ endif
>  # U-Boot objects....order is important (i.e. start must be first)
>  
>  OBJS  = $(CPUDIR)/start.o
> +OBJS  = $(CPUDIR)/start.o
>  ifeq ($(CPU),x86)
> -OBJS += $(CPUDIR)/start16.o
> -OBJS += $(CPUDIR)/resetvec.o
> +	ifneq ($(CONFIG_NO_RESET_CODE),y)
> +		OBJS += $(CPUDIR)/start16.o
> +		OBJS += $(CPUDIR)/resetvec.o
> +	endif

NAK. Bad indentation, and please do without 'if's or the like.

> --- a/arch/x86/cpu/Makefile
> +++ b/arch/x86/cpu/Makefile
> @@ -28,7 +28,10 @@ include $(TOPDIR)/config.mk
>  
>  LIB	= $(obj)lib$(CPU).o
>  
> -START	= start.o start16.o resetvec.o
> +START	= start.o
> +ifneq ($(CONFIG_NO_RESET_CODE),y)
> +START	+= resetvec.o start16.o
> +endif

Ditto.

> --- a/arch/x86/cpu/u-boot.lds
> +++ b/arch/x86/cpu/u-boot.lds
> @@ -85,6 +85,8 @@ SECTIONS
>  	__bios_start = LOADADDR(.bios);
>  	__bios_size = SIZEOF(.bios);
>  
> +#ifndef CONFIG_NO_RESET_CODE

Undocumented.


Best regards,

Wolfgang Denk
Simon Glass - Nov. 26, 2012, 6:03 a.m.
Hi Wolfgang,

On Mon, Nov 19, 2012 at 10:56 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Simon Glass,
>
> In message <1349910781-32088-4-git-send-email-sjg@chromium.org> you wrote:
>> From: Gabe Black <gabeblack@chromium.org>
>>
>> When running from coreboot we don't want this code.
>>
>> This version works by ifdef-ing out all of the code that would go
>> into those sections and all the code that refers to it. The sections are
>> then empty, and the linker will either leave them empty for the loader
>> to ignore or remove them entirely.
>>
>> Signed-off-by: Gabe Black <gabeblack@chromium.org>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>> Changes in v2:
>> - Put CONFIG_NO_RESET_CODE into Makefile instead of source files
>
> What exactly is CONFIG_NO_RESET_CODE ?
>
> There is no documentation anywhere for such a config option as is
> mandatory when introducing it, nor is there any comment why it would
> be needed, nor are there any users for it.
>

Based on your comments I will come up with another way of doing this
and send a new patch.

>
>>  Makefile                |    7 +++++--
>>  arch/x86/cpu/Makefile   |    5 ++++-
>>  arch/x86/cpu/u-boot.lds |    3 +++
>>  3 files changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 34d9075..6c2f357 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -212,9 +212,12 @@ endif
>>  # U-Boot objects....order is important (i.e. start must be first)
>>
>>  OBJS  = $(CPUDIR)/start.o
>> +OBJS  = $(CPUDIR)/start.o
>>  ifeq ($(CPU),x86)
>> -OBJS += $(CPUDIR)/start16.o
>> -OBJS += $(CPUDIR)/resetvec.o
>> +     ifneq ($(CONFIG_NO_RESET_CODE),y)
>> +             OBJS += $(CPUDIR)/start16.o
>> +             OBJS += $(CPUDIR)/resetvec.o
>> +     endif
>
> NAK. Bad indentation, and please do without 'if's or the like.
>
>> --- a/arch/x86/cpu/Makefile
>> +++ b/arch/x86/cpu/Makefile
>> @@ -28,7 +28,10 @@ include $(TOPDIR)/config.mk
>>
>>  LIB  = $(obj)lib$(CPU).o
>>
>> -START        = start.o start16.o resetvec.o
>> +START        = start.o
>> +ifneq ($(CONFIG_NO_RESET_CODE),y)
>> +START        += resetvec.o start16.o
>> +endif
>
> Ditto.
>
>> --- a/arch/x86/cpu/u-boot.lds
>> +++ b/arch/x86/cpu/u-boot.lds
>> @@ -85,6 +85,8 @@ SECTIONS
>>       __bios_start = LOADADDR(.bios);
>>       __bios_size = SIZEOF(.bios);
>>
>> +#ifndef CONFIG_NO_RESET_CODE
>
> Undocumented.
>
>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
> If I can have honesty, it's easier to overlook mistakes.
>         -- Kirk, "Space Seed", stardate 3141.9

Regards,
Simon

Patch

diff --git a/Makefile b/Makefile
index 34d9075..6c2f357 100644
--- a/Makefile
+++ b/Makefile
@@ -212,9 +212,12 @@  endif
 # U-Boot objects....order is important (i.e. start must be first)
 
 OBJS  = $(CPUDIR)/start.o
+OBJS  = $(CPUDIR)/start.o
 ifeq ($(CPU),x86)
-OBJS += $(CPUDIR)/start16.o
-OBJS += $(CPUDIR)/resetvec.o
+	ifneq ($(CONFIG_NO_RESET_CODE),y)
+		OBJS += $(CPUDIR)/start16.o
+		OBJS += $(CPUDIR)/resetvec.o
+	endif
 endif
 ifeq ($(CPU),ppc4xx)
 OBJS += $(CPUDIR)/resetvec.o
diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile
index 7f1fc18..1eb70a7 100644
--- a/arch/x86/cpu/Makefile
+++ b/arch/x86/cpu/Makefile
@@ -28,7 +28,10 @@  include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(CPU).o
 
-START	= start.o start16.o resetvec.o
+START	= start.o
+ifneq ($(CONFIG_NO_RESET_CODE),y)
+START	+= resetvec.o start16.o
+endif
 COBJS	= interrupts.o cpu.o
 
 SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds
index fe28030..2a90a01 100644
--- a/arch/x86/cpu/u-boot.lds
+++ b/arch/x86/cpu/u-boot.lds
@@ -85,6 +85,8 @@  SECTIONS
 	__bios_start = LOADADDR(.bios);
 	__bios_size = SIZEOF(.bios);
 
+#ifndef CONFIG_NO_RESET_CODE
+
 	/*
 	 * The following expressions place the 16-bit Real-Mode code and
 	 * Reset Vector at the end of the Flash ROM
@@ -94,4 +96,5 @@  SECTIONS
 
 	. = RESET_VEC_LOC;
 	.resetvec : AT (CONFIG_SYS_TEXT_BASE + (CONFIG_SYS_MONITOR_LEN - RESET_SEG_SIZE + RESET_VEC_LOC)) { KEEP(*(.resetvec)); }
+#endif
 }