[U-Boot] [PATCH v2 01/12] x86: Allow compiling out realmode/bios code

Graeme Russ graeme.russ at gmail.com
Fri Nov 30 03:09:50 CET 2012


Hi Simon,

On Fri, Nov 30, 2012 at 12:57 PM, Simon Glass <sjg at chromium.org> wrote:
> From: Gabe Black <gabeblack at chromium.org>
>
> We don't want this for coreboot, so provide a way of compiling it out.
>
> Signed-off-by: Gabe Black <gabeblack at chromium.org>
> Signed-off-by: Stefan Reinauer <reinauer at chromium.org>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> Changes in v2:
> - Rename real mode option to CONFIG_X86_NO_REAL_MODE
>
>  README                |    6 ++++++
>  arch/x86/lib/Makefile |    9 ++++++---
>  arch/x86/lib/video.c  |    2 ++
>  3 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/README b/README
> index b9a3685..ed7d270 100644
> --- a/README
> +++ b/README
> @@ -3668,6 +3668,12 @@ Low Level (hardware related) configuration options:
>                 If defined, the x86 reset vector code is excluded. You will need
>                 to do this when U-Boot is running from Coreboot.
>
> +- CONFIG_X86_NO_REAL_MODE
> +               If defined, x86 real mode code is omitted. This assumes a
> +               32-bit environment where such code is not needed. You will
> +               need to do this when U-Boot is running from Coreboot.
> +
> +
>  Freescale QE/FMAN Firmware Support:
>  -----------------------------------
>
> diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
> index 51836da..4325b25 100644
> --- a/arch/x86/lib/Makefile
> +++ b/arch/x86/lib/Makefile
> @@ -25,11 +25,16 @@ include $(TOPDIR)/config.mk
>
>  LIB    = $(obj)lib$(ARCH).o
>
> +ifeq ($(CONFIG_X86_NO_REAL_MODE),)
>  SOBJS-$(CONFIG_SYS_PC_BIOS)    += bios.o
>  SOBJS-$(CONFIG_SYS_PCI_BIOS)   += bios_pci.o
> -SOBJS-$(CONFIG_SYS_X86_REALMODE)       += realmode_switch.o
> +COBJS-y        += realmode.o
> +SOBJS-y        += realmode_switch.o
>
>  COBJS-$(CONFIG_SYS_PC_BIOS)    += bios_setup.o
> +COBJS-$(CONFIG_VIDEO)  += video_bios.o
> +endif
> +
>  COBJS-y        += board.o
>  COBJS-y        += bootm.o
>  COBJS-y        += cmd_boot.o
> @@ -41,11 +46,9 @@ COBJS-$(CONFIG_SYS_PCAT_INTERRUPTS) += pcat_interrupts.o
>  COBJS-$(CONFIG_SYS_GENERIC_TIMER) += pcat_timer.o
>  COBJS-$(CONFIG_PCI) += pci.o
>  COBJS-$(CONFIG_PCI) += pci_type1.o
> -COBJS-$(CONFIG_SYS_X86_REALMODE)       += realmode.o
>  COBJS-y        += relocate.o
>  COBJS-y        += string.o
>  COBJS-$(CONFIG_SYS_X86_ISR_TIMER)      += timer.o
> -COBJS-$(CONFIG_VIDEO)  += video_bios.o
>  COBJS-$(CONFIG_VIDEO)  += video.o
>  COBJS-$(CONFIG_CMD_ZBOOT)      += zimage.o
>
> diff --git a/arch/x86/lib/video.c b/arch/x86/lib/video.c
> index 3d6b24d..20e2416 100644
> --- a/arch/x86/lib/video.c
> +++ b/arch/x86/lib/video.c
> @@ -222,8 +222,10 @@ int video_init(void)
>
>  int drv_video_init(void)
>  {
> +#ifndef CONFIG_X86_NO_REAL_MODE
>         if (video_bios_init())
>                 return 1;
> +#endif
>
>         return video_init();
>  }


Hmm, what to do about boot_zimage() in arch/x86/lib/zimage.c. If you
define CONFIG_X86_NO_REAL_MODE but don't define CONFIG_ZBOOT_32 you
will get a linker failure. Maybe change:

#if defined CONFIG_ZBOOT_32 to

#if (defined CONFIG_ZBOOT_32 or defined CONFIG_X86_NO_REAL_MODE)

Don't forget the end goal is to surgically remove all 16-bit support
(apart from the reset vector for non-coreboot boards)

Regards,

Graeme


More information about the U-Boot mailing list