From patchwork Mon Nov 26 20:33:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 202029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id A38572C007C for ; Tue, 27 Nov 2012 07:33:50 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EC0C94A18F; Mon, 26 Nov 2012 21:33:43 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4Pwnov1gQ6RB; Mon, 26 Nov 2012 21:33:43 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4E96D4A14B; Mon, 26 Nov 2012 21:33:41 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9E76A4A14B for ; Mon, 26 Nov 2012 21:33:38 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4lQpz-BOgXVA for ; Mon, 26 Nov 2012 21:33:36 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-wg0-f74.google.com (mail-wg0-f74.google.com [74.125.82.74]) by theia.denx.de (Postfix) with ESMTPS id 8EE484A149 for ; Mon, 26 Nov 2012 21:33:32 +0100 (CET) Received: by mail-wg0-f74.google.com with SMTP id dt14so832822wgb.3 for ; Mon, 26 Nov 2012 12:33:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=NQAsnPE+sYa8SpaVlIB04XN89ttxFCbEwyJc9IKbjcQ=; b=mFjisnwUCDtR1/k6tktEDipSoMJNA+007b4GlALHa1jLkhKsggwxFMpowqRH8nusoV sXPfnorbgI0LpKPHuWf4lmxzHul24dD2G3fKTVXNvguwMNFm3qg9lH1Tmttb1VpUji0z vZa+AXoPeW/Xbpphpr7uewZbvHhZa9Im4KPdDlKFMm1NiJKKF+pwZu2xibKeLKkOgV/6 j1EW50EMsCz+hfzr7PiKO2ut7UPoQLIm0SiOSWN/gw6n0f2Rn1iLqHeroKy0IsUX+zVy iW7J7hAZfOKt8H26eQu1fXuIz7QOLBgB/taETqboE3hbzGjEPHMq0GGpjfNF0r0+mGh5 FitQ== Received: by 10.14.216.7 with SMTP id f7mr15522576eep.4.1353962008240; Mon, 26 Nov 2012 12:33:28 -0800 (PST) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id u8si3977366een.1.2012.11.26.12.33.28 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 26 Nov 2012 12:33:28 -0800 (PST) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 9F72020004E; Mon, 26 Nov 2012 12:33:27 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id E6067160795; Mon, 26 Nov 2012 12:33:26 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Mon, 26 Nov 2012 12:33:10 -0800 Message-Id: <1353961997-32762-3-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 X-Gm-Message-State: ALoCoQnjYQBmEAdPAocbuv+vC/H9SVM41YkT1GCqfONH2ytvTTFUc0nHrzUJ86hoPEEk4IxON9onjrPMwsgGC2P91wlZ3zsppZvCQhPR9Keby5JB9FZPlcMClhrDFTbfGKR1TnAQbLZFHgcMcuV052B4gZC1DiPiLpf1xGv41hs5xih0AwdrrTKabSAox8hLHeFo7aZH1/WS Subject: [U-Boot] [PATCH v5 2/9] x86: Allow excluding reset vector code from u-boot X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Gabe Black 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 Signed-off-by: Simon Glass --- Changes in v5: - Use CONFIG_NO_RESET_CODE again (as v3), check it in arch config.h Changes in v4: - Use CONFIG_SYS_X86_RESET_VECTOR instead CONFIG_NO_RESET_CODE - Add note about CONFIG_SYS_X86_RESET_VECTOR to README Changes in v3: - Fix incorrect repeated line in Makefile Changes in v2: - Put CONFIG_NO_RESET_CODE into Makefile instead of source files Makefile | 8 +++----- README | 4 ++++ arch/x86/cpu/Makefile | 5 +++-- arch/x86/cpu/u-boot.lds | 3 +++ arch/x86/include/asm/config.h | 5 +++++ 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 1a17be9..dcd3a0c 100644 --- a/Makefile +++ b/Makefile @@ -230,10 +230,8 @@ endif # U-Boot objects....order is important (i.e. start must be first) OBJS = $(CPUDIR)/start.o -ifeq ($(CPU),x86) -OBJS += $(CPUDIR)/start16.o -OBJS += $(CPUDIR)/resetvec.o -endif +OBJS-$(CONFIG_SYS_X86_RESET_VECTOR) += $(CPUDIR)/start16.o +OBJS-$(CONFIG_SYS_X86_RESET_VECTOR) += $(CPUDIR)/resetvec.o ifeq ($(CPU),ppc4xx) OBJS += $(CPUDIR)/resetvec.o endif @@ -241,7 +239,7 @@ ifeq ($(CPU),mpc85xx) OBJS += $(CPUDIR)/resetvec.o endif -OBJS := $(addprefix $(obj),$(OBJS)) +OBJS := $(addprefix $(obj),$(OBJS) $(OBJS-y)) HAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n) diff --git a/README b/README index 2dc0984..dd7fb9d 100644 --- a/README +++ b/README @@ -3621,6 +3621,10 @@ Low Level (hardware related) configuration options: be used if available. These functions may be faster under some conditions but may increase the binary size. +- CONFIG_NO_RESET_CODE + If defined, the x86 reset vector code is excluded. You will need + to do this when U-Boot is running from Coreboot. + Freescale QE/FMAN Firmware Support: ----------------------------------- diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile index 7f1fc18..b0c350c 100644 --- a/arch/x86/cpu/Makefile +++ b/arch/x86/cpu/Makefile @@ -28,12 +28,13 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).o -START = start.o start16.o resetvec.o +START-y = start.o +START-$(CONFIG_SYS_X86_RESET_VECTOR) += resetvec.o start16.o COBJS = interrupts.o cpu.o SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) -START := $(addprefix $(obj),$(START)) +START := $(addprefix $(obj),$(START-y)) all: $(obj).depend $(START) $(LIB) diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds index a1ecefa..de6dfdc 100644 --- a/arch/x86/cpu/u-boot.lds +++ b/arch/x86/cpu/u-boot.lds @@ -86,6 +86,8 @@ SECTIONS __bios_start = LOADADDR(.bios); __bios_size = SIZEOF(.bios); +#ifdef CONFIG_SYS_X86_RESET_VECTOR + /* * The following expressions place the 16-bit Real-Mode code and * Reset Vector at the end of the Flash ROM @@ -95,4 +97,5 @@ SECTIONS . = RESET_VEC_LOC; .resetvec : AT (CONFIG_SYS_TEXT_BASE + (CONFIG_SYS_MONITOR_LEN - RESET_SEG_SIZE + RESET_VEC_LOC)) { KEEP(*(.resetvec)); } +#endif } diff --git a/arch/x86/include/asm/config.h b/arch/x86/include/asm/config.h index 049c44e..e3cae0b 100644 --- a/arch/x86/include/asm/config.h +++ b/arch/x86/include/asm/config.h @@ -21,4 +21,9 @@ #ifndef _ASM_CONFIG_H_ #define _ASM_CONFIG_H_ +/* Include the reset fector code unless the board configure doesn't want it */ +#ifndef CONFIG_NO_RESET_CODE +#define CONFIG_SYS_X86_RESET_VECTOR +#endif + #endif