From patchwork Sat Dec 4 13:29:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: luigi.mantellini@idf-hit.com X-Patchwork-Id: 74267 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 7CD4CB6F1E for ; Sun, 5 Dec 2010 00:30:43 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1A82228215; Sat, 4 Dec 2010 14:30:05 +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 e+074OHKJL51; Sat, 4 Dec 2010 14:30:04 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3B9272821C; Sat, 4 Dec 2010 14:29:43 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 298AD281F0 for ; Sat, 4 Dec 2010 14:29:31 +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 HFBMwC6yBuJW for ; Sat, 4 Dec 2010 14:29:30 +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 mx102.fabbricadigitale.it (mx2.fabbricadigitale.it [217.169.111.37]) by theia.denx.de (Postfix) with ESMTPS id 8983F281DA for ; Sat, 4 Dec 2010 14:29:25 +0100 (CET) Received: from localhost (mx102.fabbricadigitale.it [127.0.0.1]) by mx102.fabbricadigitale.it (MM4Csmtpd) with ESMTP id 204A7E000210 for ; Sat, 4 Dec 2010 14:29:25 +0100 (CET) X-Virus-Scanned: amavisd-new at fabbricadigitale.it Received: from mx102.fabbricadigitale.it ([127.0.0.1]) by localhost (mx102.fabbricadigitale.it [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zR2BzkgB57zv for ; Sat, 4 Dec 2010 14:29:25 +0100 (CET) Received: from EX02MailShare.fdmsha.local (unknown [172.16.26.10]) by mx102.fabbricadigitale.it (MM4Csmtpd) with ESMTPS id 03DFBE00010A for ; Sat, 4 Dec 2010 14:29:25 +0100 (CET) Received: from abel.dialface.net (85.40.213.226) by EX02MailShare.fdmsha.local (172.16.26.10) with Microsoft SMTP Server id 8.1.340.0; Sat, 4 Dec 2010 14:29:22 +0100 From: Luigi 'Comio' Mantellini To: Date: Sat, 4 Dec 2010 14:29:18 +0100 Message-ID: <1291469358-25023-7-git-send-email-luigi.mantellini@idf-hit.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1291469358-25023-1-git-send-email-luigi.mantellini@idf-hit.com> References: <1291469358-25023-1-git-send-email-luigi.mantellini@idf-hit.com> MIME-Version: 1.0 Cc: Luigi 'Comio' Mantellini Subject: [U-Boot] [PATCH 6/6 v2] Enable bootstrap code for QEMU-MIPS board. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Luigi 'Comio' Mantellini --- board/qemu-mips/Makefile | 15 ++++++- board/qemu-mips/config.mk | 7 ++- board/qemu-mips/qemu-mips_bootstrap.c | 48 +++++++++++++++++++++ board/qemu-mips/u-boot-bootstrap.lds | 73 +++++++++++++++++++++++++++++++++ include/configs/qemu-mips.h | 15 ++++++- 5 files changed, 154 insertions(+), 4 deletions(-) create mode 100644 board/qemu-mips/qemu-mips_bootstrap.c create mode 100644 board/qemu-mips/u-boot-bootstrap.lds diff --git a/board/qemu-mips/Makefile b/board/qemu-mips/Makefile index 6251bb8..bcb6fd5 100644 --- a/board/qemu-mips/Makefile +++ b/board/qemu-mips/Makefile @@ -24,17 +24,30 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o +BOOTSTRAP_LIB = $(obj)lib$(BOARD)_bootstrap.o + +BOOTSTRAP_LIB-$(CONFIG_BOOTSTRAP) = $(BOOTSTRAP_LIB) COBJS = $(BOARD).o SOBJS = lowlevel_init.o -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) = $(BOARD)_bootstrap.o +BOOTSTRAP_SOBJS-$(CONFIG_BOOTSTRAP) = lowlevel_init.o + +BOOTSTRAP_SRCS := $(BOOTSTRAP_SOBJS-y:.o=.S) $(BOOTSTRAP_COBJS-y:.o=.c) +BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_COBJS-y)) +BOOTSTRAP_SOBJS := $(addprefix $(obj),$(BOOTSTRAP_SOBJS-y)) + +SRCS := $(sort $(SOBJS:.o=.S) $(COBJS:.o=.c) $(BOOTSTRAP_SOBJS)) OBJS := $(addprefix $(obj),$(COBJS)) SOBJS := $(addprefix $(obj),$(SOBJS)) $(LIB): $(OBJS) $(SOBJS) $(call cmd_link_o_target, $(OBJS) $(SOBJS)) +$(BOOTSTRAP_LIB): $(BOOTSTRAP_OBJS) $(BOOTSTRAP_SOBJS) + $(call cmd_link_o_target, $(BOOTSTRAP_OBJS) $(BOOTSTRAP_SOBJS)) + ######################################################################### # defines $(obj).depend target diff --git a/board/qemu-mips/config.mk b/board/qemu-mips/config.mk index 27cd34a..50276ff 100644 --- a/board/qemu-mips/config.mk +++ b/board/qemu-mips/config.mk @@ -3,8 +3,11 @@ # See http://fabrice.bellard.free.fr/qemu # +ifeq ($(CONFIG_BOOTSTRAP),) # ROM version CONFIG_SYS_TEXT_BASE = 0xbfc00000 - +else # RAM version -#CONFIG_SYS_TEXT_BASE = 0x80001000 +CONFIG_SYS_TEXT_BASE = 0x80001000 +CONFIG_BOOTSTRAP_TEXT_BASE = 0xbfc00000 +endif \ No newline at end of file diff --git a/board/qemu-mips/qemu-mips_bootstrap.c b/board/qemu-mips/qemu-mips_bootstrap.c new file mode 100644 index 0000000..e139d67 --- /dev/null +++ b/board/qemu-mips/qemu-mips_bootstrap.c @@ -0,0 +1,48 @@ +/* + * (C) Copyright 2010 Industrie Dial Face S.p.A. + * Luigi 'Comio' Mantellini, luigi.mantellini@idf-hit.com + * + * (C) Copyright 2007 + * Vlad Lungu vlad.lungu@windriver.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include +#include +#include + +phys_size_t bootstrap_initdram(int board_type) +{ + /* Sdram is setup by assembler code */ + /* If memory could be changed, we should return the true value here */ + return MEM_SIZE*1024*1024; +} + +int bootstrap_checkboard(void) +{ + return 0; +} + +int bootstrap_misc_init_r(void) +{ + set_io_port_base(0); + return 0; +} diff --git a/board/qemu-mips/u-boot-bootstrap.lds b/board/qemu-mips/u-boot-bootstrap.lds new file mode 100644 index 0000000..0e74580 --- /dev/null +++ b/board/qemu-mips/u-boot-bootstrap.lds @@ -0,0 +1,73 @@ +/* + * (C) Copyright 2010 Industrie Dial Face S.p.A. + * Luigi 'Comio' Mantellini, luigi.mantellini@idf-hit.com + * + * (C) Copyright 2003 + * Wolfgang Denk Engineering, + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +/* +OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips") +*/ +OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips") +OUTPUT_ARCH(mips) +ENTRY(_start) +SECTIONS +{ + . = 0x00000000; + + . = ALIGN(4); + .text : + { + *(.text) + } + + . = ALIGN(4); + .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + + . = ALIGN(4); + .data : { *(.data) } + + . = .; + _gp = ALIGN(16) +0x7ff0; + + .got : { + __got_start = .; + *(.got) + __got_end = .; + } + + . = ALIGN(4); + .sdata : { *(.sdata) } + + . = .; + . = ALIGN(4); + .payload : { *(.payload) } + . = ALIGN(4); + + uboot_end_data = .; + num_got_entries = (__got_end - __got_start) >> 2; + + . = ALIGN(4); + .sbss : { *(.sbss) } + .bss : { *(.bss) . = ALIGN(4); } + uboot_end = .; +} diff --git a/include/configs/qemu-mips.h b/include/configs/qemu-mips.h index fb697d5..2337a32 100644 --- a/include/configs/qemu-mips.h +++ b/include/configs/qemu-mips.h @@ -114,7 +114,7 @@ #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */ #define CONFIG_SYS_MAXARGS 16 /* max number of command args */ -#define CONFIG_SYS_MALLOC_LEN 128*1024 +#define CONFIG_SYS_MALLOC_LEN 4*1024*1024 #define CONFIG_SYS_BOOTPARAMS_LEN 128*1024 @@ -172,4 +172,17 @@ #define CONFIG_SYS_ICACHE_SIZE 16384 #define CONFIG_SYS_CACHELINE_SIZE 32 +/* Support for compressed u-boot image */ +#define CONFIG_BOOTSTRAP +#ifdef CONFIG_BOOTSTRAP +#define CONFIG_BOOTSTRAP_BASE CONFIG_BOOTSTRAP_TEXT_BASE +#define CONFIG_BOOTSTRAP_BAUDRATE CONFIG_BAUDRATE +#define CONFIG_SKIP_LOWLEVEL_INIT +// #define CONFIG_BOOTSTRAP_BZIP2 /* Use BZIP2 payload */ +// #define CONFIG_BOOTSTRAP_GZIP /* Use GZIP payload */ +// #define CONFIG_BOOTSTRAP_LZMA /* Use LZMA payload */ +// #define CONFIG_BOOTSTRAP_LZO /* Use LZO payload */ +#define CONFIG_BOOTSTRAP_XZ /* Use XZ payload */ +#endif + #endif /* __CONFIG_H */