[U-Boot] [PATCH 6/6 v2] Enable bootstrap code for QEMU-MIPS board.

Luigi 'Comio' Mantellini luigi.mantellini at idf-hit.com
Sat Dec 4 14:29:18 CET 2010


Signed-off-by: Luigi 'Comio' Mantellini <luigi.mantellini at idf-hit.com>
---
 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 at idf-hit.com
+ *
+ * (C) Copyright 2007
+ * Vlad Lungu vlad.lungu at 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 <common.h>
+#include <command.h>
+#include <asm/mipsregs.h>
+#include <asm/io.h>
+
+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 at idf-hit.com
+ *
+ * (C) Copyright 2003
+ * Wolfgang Denk Engineering, <wd at denx.de>
+ *
+ * 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 */
-- 
1.7.3



More information about the U-Boot mailing list