Add support for bootstrap stage and compressed U-Boot image
Subsystems (3)
cover Add support for bootstrap stage and compressed U-Boot image
From: Luigi 'Comio' Mantellini <[email protected]>
Hi All,
The following patches introduce the bootstrap support that enable to have a compressed U-Boot image. The bootstrap code supports the uncompressed as well as compressed payloads, using LZMA, GZIP, BZIP2 and LZO.
Actually I developed just the mips version (using qemu-mips board)...
Please see the Patch #1 for the required defines to enable the required features.
Of course, any suggestion is welcome.
ciao
luigi
Luigi 'Comio' Mantellini (2):
Add support for bootstrap stage that allows to have a compressed
U-Boot image. The final image will named "u-boot-bootstrap".
Add support for bootstrap stage to QEMU-MIPS board.
.gitignore | 24 ++- Makefile | 172 ++++++++++++- arch/mips/config.mk | 2 +- arch/mips/cpu/Makefile | 28 ++- arch/mips/cpu/cpu.c | 12 - arch/mips/cpu/reset.c | 39 +++ arch/mips/cpu/reset_bootstrap.c | 39 +++ arch/mips/cpu/start_bootstrap.S | 452 +++++++++++++++++++++++++++++++++ arch/mips/lib/Makefile | 15 +- arch/mips/lib/board_bootstrap.c | 261 +++++++++++++++++++ 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 ++++++ common/Makefile | 15 +- common/console_bootstrap.c | 85 ++++++ config.mk | 19 ++- include/common.h | 21 ++ include/configs/qemu-mips.h | 14 +- lib/Makefile | 28 ++- lib/bootstrap.c | 89 +++++++ lib/lzma/Makefile | 4 +- lib/lzo/Makefile | 4 +- 23 files changed, 1434 insertions(+), 32 deletions(-) create mode 100644 arch/mips/cpu/reset.c create mode 100644 arch/mips/cpu/reset_bootstrap.c create mode 100644 arch/mips/cpu/start_bootstrap.S create mode 100644 arch/mips/lib/board_bootstrap.c create mode 100644 board/qemu-mips/qemu-mips_bootstrap.c create mode 100644 board/qemu-mips/u-boot-bootstrap.lds create mode 100644 common/console_bootstrap.c create mode 100644 lib/bootstrap.c
Signature · 1 line
1.7.3
RFC 1/2 Add support for bootstrap stage that allows to have a compressed U-Boot image. The final image will named "u-boot-bootstrap".
From: Luigi 'Comio' Mantellini <[email protected]>
The following symbols are allowed:
CONFIG_BOOTSTRAP
Enable the bootstrap stage. A minimal code is added to uncompress or copy the payload (a full U-Boot image).
CONFIG_BOOTSTRAP_TEXT_BASE
TEXT_BASE of the bootstrap code.
CONFIG_BOOTSTRAP_SKIP_LOWLEVEL_INIT
Skip the lowlevel initialization.
CONFIG_BOOTSTRAP_BAUDRATE
Initial and hardcoded serial boudrate
CONFIG_BOOTSTRAP_BZIP2
Enable BZIP2 compression of the U-Boot image.
CONFIG_BOOTSTRAP_GZIP
Enable GZIP compression of the U-Boot image.
CONFIG_BOOTSTRAP_LZMA
Enable LZMA compression of the U-Boot image.
CONFIG_BOOTSTRAP_LZO
Enable LZO compression of the U-Boot image.
The board should define the following functions:
phys_size_t bootstrap_initdram(int board_type); int bootstrap_checkboard(void); int bootstrap_misc_init_r(void); void lowlevel_init(void);
--- .gitignore | 24 ++- Makefile | 172 +++++++++++++++- arch/mips/config.mk | 2 +- arch/mips/cpu/Makefile | 28 ++- arch/mips/cpu/cpu.c | 12 - arch/mips/cpu/reset.c | 39 ++++ arch/mips/cpu/reset_bootstrap.c | 39 ++++ arch/mips/cpu/start_bootstrap.S | 452 +++++++++++++++++++++++++++++++++++++++ arch/mips/lib/Makefile | 15 ++- arch/mips/lib/board_bootstrap.c | 261 ++++++++++++++++++++++ common/Makefile | 15 ++- common/console_bootstrap.c | 85 ++++++++ config.mk | 19 ++- include/common.h | 21 ++ lib/Makefile | 28 +++- lib/bootstrap.c | 89 ++++++++ lib/lzma/Makefile | 4 +- lib/lzo/Makefile | 4 +- 18 files changed, 1281 insertions(+), 28 deletions(-) create mode 100644 arch/mips/cpu/reset.c create mode 100644 arch/mips/cpu/reset_bootstrap.c create mode 100644 arch/mips/cpu/start_bootstrap.S create mode 100644 arch/mips/lib/board_bootstrap.c create mode 100644 common/console_bootstrap.c create mode 100644 lib/bootstrap.c
.gitignore +23 -1
@@ -23,6 +23,11 @@ /u-boot.hex /u-boot.map /u-boot.bin +/u-boot.bin.bz2 +/u-boot.bin.gz +/u-boot.bin.lzma +/u-boot.bin.lzo +/u-boot.dis /u-boot.srec /u-boot.ldr /u-boot.ldr.hex
@@ -30,6 +35,20 @@ /u-boot.lds /u-boot-onenand.bin /u-boot-flexonenand.bin +/u-boot-bootstrap +/u-boot-bootstrap.hex +/u-boot-bootstrap.map +/u-boot-bootstrap.bin +/u-boot-bootstrap.bin.bz2 +/u-boot-bootstrap.bin.gz +/u-boot-bootstrap.bin.lzma +/u-boot-bootstrap.bin.lzo +/u-boot-bootstrap.dis +/u-boot-bootstrap.srec +/u-boot-bootstrap.ldr +/u-boot-bootstrap.ldr.hex +/u-boot-bootstrap.ldr.srec +/u-boot-bootstrap.lds # # Generated files
@@ -39,7 +58,7 @@ /LOG /errlog /reloc_off - +/.payload.s /include/generated/ /lib/asm-offsets.s
@@ -66,3 +85,6 @@ cscope.* /onenand_ipl/onenand-ipl* /onenand_ipl/board/*/onenand* /onenand_ipl/board/*/*.S +examples/standalone/ + +setvars
Makefile +169 -3
247 lines not on this page · raw message
arch/mips/config.mk +1 -1
@@ -47,6 +47,6 @@ PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__ # On the other hand, we want PIC in the U-Boot code to relocate it from ROM # to RAM. $28 is always used as gp. # -PLATFORM_CPPFLAGS += -G 0 -mabicalls -fpic +PLATFORM_CPPFLAGS += -G 0 -mabicalls -fpic -g PLATFORM_CPPFLAGS += -msoft-float PLATFORM_LDFLAGS += -G 0 -static -n -nostdlib
arch/mips/cpu/Makefile +24 -4
@@ -24,25 +24,45 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).o +BOOTSTRAP_LIB = $(obj)lib$(CPU)_bootstrap.o + +BOOTSTRAP_LIB-$(CONFIG_BOOTSTRAP) = $(BOOTSTRAP_LIB) START = start.o SOBJS-y = cache.o -COBJS-y = cpu.o interrupts.o +COBJS-y = cpu.o reset.o interrupts.o SOBJS-$(CONFIG_INCA_IP) += incaip_wdt.o COBJS-$(CONFIG_INCA_IP) += asc_serial.o incaip_clock.o +COBJS-$(CONFIG_IFX_ASC) += ifx_asc.o COBJS-$(CONFIG_PURPLE) += asc_serial.o COBJS-$(CONFIG_SOC_AU1X00) += au1x00_eth.o au1x00_serial.o au1x00_usb_ohci.o -SRCS := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) +BOOTSTRAP_START = start_bootstrap.o +BOOTSTRAP_START-$(CONFIG_BOOTSTRAP) += $(BOOTSTRAP_START) +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += cpu.o interrupts.o reset_bootstrap.o +BOOTSTRAP_SOBJS-$(CONFIG_BOOTSTRAP) += cache.o +BOOTSTRAP_COBJS-$(CONFIG_IFX_ASC) += ifx_asc.o + +BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_SOBJS-y) $(BOOTSTRAP_COBJS-y)) +BOOTSTRAP_START := $(addprefix $(obj),$(BOOTSTRAP_START-y)) + +SRCS := $(sort $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) $(BOOTSTRAP_START-y:.o=.S) $(BOOTSTRAP_SOBJS-y:.o=.S) $(BOOTSTRAP_COBJS-y:.o=.c)) OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) START := $(addprefix $(obj),$(START)) -all: $(obj).depend $(START) $(LIB) +all: $(START) $(LIB) $(BOOTSTRAP_START-y) $(BOOTSTRAP_LIB-y) -$(LIB): $(OBJS) +$(START): $(obj).depend + +$(LIB): $(obj).depend $(OBJS) $(call cmd_link_o_target, $(OBJS)) +$(BOOTSTRAP_START): $(obj).depend + +$(BOOTSTRAP_LIB): $(obj).depend $(BOOTSTRAP_OBJS) + $(call cmd_link_o_target, $(BOOTSTRAP_OBJS)) + ######################################################################### # defines $(obj).depend target
arch/mips/cpu/cpu.c +0 -12
@@ -38,18 +38,6 @@ : \ : "i" (op), "R" (*(unsigned char *)(addr))) -void __attribute__((weak))_machine_restart (void ) -{ -} - -int do_reset (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) -{ -_machine_restart (); - -fprintf (stderr,"*** reset failed ***\n" ); -return 0 ; -} -void flush_cache (ulong start_addr,ulong size) {unsigned long lsize =CONFIG_SYS_CACHELINE_SIZE ;
arch/mips/cpu/reset.c new file +39 -0
@@ -0,0 +1,39 @@ +/* +* (C) Copyright 2003 +* Wolfgang Denk, DENX Software Engineering, <[email protected]> +* +* 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/reboot.h> + +void __attribute__((weak))_machine_restart (void ) +{ +} + +int __attribute__((weak))do_reset (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +_machine_restart (); + +fprintf (stderr,"*** reset failed ***\n" ); +return 0 ; +}
arch/mips/cpu/reset_bootstrap.c new file +39 -0
@@ -0,0 +1,39 @@ +/* +* (C) Copyright 2003 +* Wolfgang Denk, DENX Software Engineering, <[email protected]> +* +* 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/reboot.h> + +void __attribute__((weak))_machine_restart (void ) +{ +} + +int __attribute__((weak))do_reset (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +_machine_restart (); + +printf ("*** reset failed ***\n" ); +return 0 ; +}
arch/mips/cpu/start_bootstrap.S new file +452 -0
452 lines not on this page · raw message
arch/mips/lib/Makefile +14 -1
@@ -24,6 +24,9 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(ARCH).o +BOOTSTRAP_LIB = $(obj)lib$(ARCH)_bootstrap.o + +BOOTSTRAP_LIB-$(CONFIG_BOOTSTRAP) = $(BOOTSTRAP_LIB) SOBJS-y +=
@@ -35,12 +38,22 @@ COBJS-y += bootm.o endif COBJS-y += time.o -SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += board_bootstrap.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += time.o + +BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_SOBJS-y) $(BOOTSTRAP_COBJS-y)) + +SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) $(BOOTSTRAP_SOBJS-y:.o=.S) $(BOOTSTRAP_COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) +all: $(LIB) $(BOOTSTRAP_LIB-y) + $(LIB): $(obj).depend $(OBJS) $(call cmd_link_o_target, $(OBJS)) +$(BOOTSTRAP_LIB): $(obj).depend $(BOOTSTRAP_OBJS) + $(call cmd_link_o_target, $(BOOTSTRAP_OBJS)) + ######################################################################### # defines $(obj).depend target
arch/mips/lib/board_bootstrap.c new file +261 -0
261 lines not on this page · raw message
common/Makefile +13 -2
@@ -24,6 +24,9 @@ include $(TOPDIR)/config.mk LIB = $(obj)libcommon.o +BOOTSTRAP_LIB = $(obj)libcommon_bootstrap.o + +BOOTSTRAP_LIB-$(CONFIG_BOOTSTRAP) = $(BOOTSTRAP_LIB) # core COBJS-y += main.o
@@ -165,20 +168,28 @@ COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o COBJS-$(CONFIG_UPDATE_TFTP) += update.o COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += dlmalloc.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += console_bootstrap.o + +BOOTSTRAP_COBJS := $(sort $(BOOTSTRAP_COBJS-y)) +BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_COBJS)) COBJS := $(sort $(COBJS-y)) XCOBJS := $(sort $(XCOBJS-y)) -SRCS := $(COBJS:.o=.c) $(XCOBJS:.o=.c) +SRCS := $(sort $(COBJS:.o=.c) $(XCOBJS:.o=.c) $(BOOTSTRAP_COBJS:.o=.c)) OBJS := $(addprefix $(obj),$(COBJS)) XOBJS := $(addprefix $(obj),$(XCOBJS)) CPPFLAGS += -I.. -all: $(LIB) $(XOBJS) +all: $(LIB) $(BOOTSTRAP_LIB-y) $(XOBJS) $(LIB): $(obj).depend $(OBJS) $(call cmd_link_o_target, $(OBJS)) +$(BOOTSTRAP_LIB): $(obj).depend $(BOOTSTRAP_OBJS) + $(call cmd_link_o_target, $(BOOTSTRAP_OBJS)) + $(obj)env_embedded.o: $(src)env_embedded.c $(obj)../tools/envcrc $(CC) $(AFLAGS) -Wa,--no-warn \ -DENV_CRC=$(shell $(obj)../tools/envcrc) \
common/console_bootstrap.c new file +85 -0
85 lines not on this page · raw message
config.mk +18 -1
@@ -150,7 +150,7 @@ else ARFLAGS = crv endif RELFLAGS= $(PLATFORM_RELFLAGS) -DBGFLAGS= -g # -DDEBUG +DBGFLAGS= -g OPTFLAGS= -Os #-fomit-frame-pointer ifndef LDSCRIPT #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
@@ -160,6 +160,11 @@ else LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds endif endif +ifeq ($(CONFIG_BOOTSTRAP),y) +ifndef BOOTSTRAP_LDSCRIPT +BOOTSTRAP_LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-bootstrap.lds +endif +endif OBJCFLAGS += --gap-fill=0xff gccincdir := $(shell $(CC) -print-file-name=include)
@@ -170,6 +175,10 @@ ifneq ($(CONFIG_SYS_TEXT_BASE),) CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) endif +ifneq ($(CONFIG_BOOTSTRAP_TEXT_BASE),) +CPPFLAGS += -DCONFIG_BOOTSTRAP_TEXT_BASE=$(CONFIG_BOOTSTRAP_TEXT_BASE) +endif + ifneq ($(RESET_VECTOR_ADDRESS),) CPPFLAGS += -DRESET_VECTOR_ADDRESS=$(RESET_VECTOR_ADDRESS) endif
@@ -190,6 +199,7 @@ CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes endif CFLAGS += $(call cc-option,-fno-stack-protector) +CFLAGS += $(call cc-option,-ffunction-sections) # $(CPPFLAGS) sets -g, which causes gcc to pass a suitable -g<format> # option to the assembler.
@@ -209,6 +219,13 @@ ifneq ($(CONFIG_SYS_TEXT_BASE),) LDFLAGS += -Ttext $(CONFIG_SYS_TEXT_BASE) endif +ifeq ($(CONFIG_BOOTSTRAP),y) +BOOTSTRAP_LDFLAGS += -Bstatic -T $(obj)u-boot-bootstrap.lds $(PLATFORM_LDFLAGS) +ifneq ($(CONFIG_BOOTSTRAP_TEXT_BASE),) +BOOTSTRAP_LDFLAGS += -Ttext $(CONFIG_BOOTSTRAP_TEXT_BASE) +endif +endif + # Location of a usable BFD library, where we define "usable" as # "built for ${HOST}, supports ${TARGET}". Sensible values are # - When cross-compiling: the root of the cross-environment
include/common.h +21 -0
@@ -723,6 +723,27 @@ int cpu_disable(int nr);int cpu_release (int nr,int argc,char *const argv[]);#endif +/* Bootstrap specific code */ +#ifdef CONFIG_BOOTSTRAP +void bootstrap_hang (void ) __attribute__ ((noreturn)); +void bootstrap_board_init_f (ulong ) __attribute__ ((noreturn)); +void bootstrap_board_init_r (gd_t *,ulong ) __attribute__ ((noreturn)); +int bootstrap_checkboard (void ); + +int bootstrap_serial_init (void ); +void bootstrap_serial_exit (void ); +void bootstrap_serial_setbrg (void ); +void bootstrap_serial_putc (const char ); +void bootstrap_serial_putc_raw (const char ); +void bootstrap_serial_puts (const char *); +int bootstrap_serial_getc (void ); +int bootstrap_serial_tstc (void ); + +phys_size_t bootstrap_initdram (int ); + +int copy_uboot (void *dst,size_t unc_size,void *src,size_t size); +#endif +#endif /* __ASSEMBLY__ */ /* Put only stuff here that the assembler can digest */
lib/Makefile +27 -1
@@ -24,6 +24,9 @@ include $(TOPDIR)/config.mk LIB = $(obj)libgeneric.o +BOOTSTRAP_LIB = $(obj)libgeneric_bootstrap.o + +BOOTSTRAP_LIB-$(CONFIG_BOOTSTRAP) = $(BOOTSTRAP_LIB) COBJS-$(CONFIG_ADDR_MAP) += addr_map.o COBJS-$(CONFIG_BZIP2) += bzlib.o
@@ -54,13 +57,36 @@ COBJS-y += vsprintf.o COBJS-$(CONFIG_ZLIB) += zlib.o COBJS-$(CONFIG_RBTREE) += rbtree.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += string.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += vsprintf.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += div64.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += ctype.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += time.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += bootstrap.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_GZIP) += zlib.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_GZIP) += gunzip.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_GZIP) += crc32.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_BZIP2) += bzlib.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_BZIP2) += bzlib_crctable.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_BZIP2) += bzlib_decompress.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_BZIP2) += bzlib_randtable.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_BZIP2) += bzlib_huffman.o + +BOOTSTRAP_COBJS := $(BOOTSTRAP_COBJS-y) +BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_COBJS)) + COBJS := $(COBJS-y) -SRCS := $(COBJS:.o=.c) +SRCS := $(COBJS:.o=.c) $(BOOTSTRAP_COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) +all: $(LIB) $(BOOTSTRAP_LIB-y) + $(LIB): $(obj).depend $(OBJS) $(call cmd_link_o_target, $(OBJS)) +$(BOOTSTRAP_LIB): $(obj).depend $(BOOTSTRAP_OBJS) + $(call cmd_link_o_target, $(BOOTSTRAP_OBJS)) + ######################################################################### # defines $(obj).depend target
lib/bootstrap.c new file +89 -0
90 lines not on this page · raw message
lib/lzma/Makefile +3 -1
@@ -32,7 +32,9 @@ SOBJS = CFLAGS += -D_LZMA_PROB32 -COBJS-$(CONFIG_LZMA) += LzmaDec.o LzmaTools.o +COBJS-$(CONFIG_LZMA)$(CONFIG_BOOTSTRAP_LZMA) += LzmaDec.o LzmaTools.o + +COBJS-y += $(COBJS-yy) COBJS = $(COBJS-y) SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
lib/lzo/Makefile +3 -1
@@ -27,7 +27,9 @@ LIB = $(obj)liblzo.o SOBJS = -COBJS-$(CONFIG_LZO) += lzo1x_decompress.o +COBJS-$(CONFIG_LZO)$(CONFIG_BOOTSTRAP_LZO) += lzo1x_decompress.o + +COBJS-y += $(OBJS-yy) COBJS = $(COBJS-y) SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
Signature · 1 line
1.7.3
RFC 1/2 Add support for bootstrap stage that allows to have a compressed U-Boot image. The final image will named "u-boot-bootstrap".
.gitignore line 29
Quoted 5 lines · On Tuesday, November 30, 2010 05:30:47 luigi.mantellini at idf-hit.com wrote:
/u-boot.bin
.gitignore +4
-0+/u-boot.bin.bz2 +/u-boot.bin.gz +/u-boot.bin.lzma +/u-boot.bin.lzo
better to have just one i think:
/u-boot.bin*
Quoted 4 lines
.gitignore +4
-0+/u-boot-bootstrap +/u-boot-bootstrap.hex +/u-boot-bootstrap.map +/u-boot-bootstrap.bin
.gitignore line 51
Quoted 10 lines
.gitignore +10
-0+/u-boot-bootstrap.bin.bz2 +/u-boot-bootstrap.bin.gz +/u-boot-bootstrap.bin.lzma +/u-boot-bootstrap.bin.lzo +/u-boot-bootstrap.dis +/u-boot-bootstrap.srec +/u-boot-bootstrap.ldr +/u-boot-bootstrap.ldr.hex +/u-boot-bootstrap.ldr.srec +/u-boot-bootstrap.lds
same here:
/u-boot-bootstrap*
lib/lzo/Makefile LIB = $(obj)liblzo.o · line 32
Quoted 4 lines
lib/lzo/Makefile +3
-1-COBJS-$(CONFIG_LZO) += lzo1x_decompress.o +COBJS-$(CONFIG_LZO)$(CONFIG_BOOTSTRAP_LZO) += lzo1x_decompress.o + +COBJS-y += $(OBJS-yy)
you sure this works when both config symbols are set ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101203/238fe17e/attachment.pgp
RFC 2/2 Add support for bootstrap stage to QEMU-MIPS board.
In reply to luigi.mantellini at idf-hit.comFrom: Luigi 'Comio' Mantellini <[email protected]>
--- 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 | 14 ++++++- 5 files changed, 153 insertions(+), 4 deletions(-) create mode 100644 board/qemu-mips/qemu-mips_bootstrap.c create mode 100644 board/qemu-mips/u-boot-bootstrap.lds
board/qemu-mips/Makefile +14 -1
@@ -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
board/qemu-mips/config.mk +5 -2
@@ -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
board/qemu-mips/qemu-mips_bootstrap.c new file +48 -0
48 lines not on this page · raw message
board/qemu-mips/u-boot-bootstrap.lds new file +73 -0
73 lines not on this page · raw message
include/configs/qemu-mips.h +13 -1
@@ -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,16 @@#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 */ +#endif +#endif /* __CONFIG_H */
Signature · 1 line
1.7.3
cover Add support for bootstrap stage and compressed U-Boot image
In reply to luigi.mantellini at idf-hit.comLook the following benchmark (qemu-mips board):
U-Boot Vanilla
179600 bytes u-boot.bin
Bootstrap code w/o compresion (memcpy)
189224 bytes u-boot-bootstrap.bin
--> size 105%
Bootstrap code using BZIP2 compression
114388 bytes u-boot-bootstrap.bin
-->size 64%
Bootstrap code using GZIP compression
114204 bytes u-boot-bootstrap.bin
-->size 64%
Bootstrap code using LZMA compression
89456 bytes u-boot-bootstrap.bin
-->size 50% <-- BEST
Bootstrap code using LZO compression
104388 bytes u-boot-bootstrap.bin
-->size 58%
ciao ciao
luigi
marted? 30 novembre 2010 11:30 luigi.mantellini at idf-hit.com ha scritto:
Quoted 57 lines
From: Luigi 'Comio' Mantellini <[email protected]>
Hi All,
The following patches introduce the bootstrap support that enable to have a compressed U-Boot image. The bootstrap code supports the uncompressed as well as compressed payloads, using LZMA, GZIP, BZIP2 and LZO.
Actually I developed just the mips version (using qemu-mips board)...
Please see the Patch #1 for the required defines to enable the required features.
Of course, any suggestion is welcome.
ciao
luigi
Luigi 'Comio' Mantellini (2):
Add support for bootstrap stage that allows to have a compressed
U-Boot image. The final image will named "u-boot-bootstrap".
Add support for bootstrap stage to QEMU-MIPS board..gitignore | 24 ++- Makefile | 172 ++++++++++++- arch/mips/config.mk | 2 +- arch/mips/cpu/Makefile | 28 ++- arch/mips/cpu/cpu.c | 12 - arch/mips/cpu/reset.c | 39 +++ arch/mips/cpu/reset_bootstrap.c | 39 +++ arch/mips/cpu/start_bootstrap.S | 452 +++++++++++++++++++++++++++++++++ arch/mips/lib/Makefile | 15 +- arch/mips/lib/board_bootstrap.c | 261 +++++++++++++++++++ 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 ++++++ common/Makefile | 15 +- common/console_bootstrap.c | 85 ++++++ config.mk | 19 ++- include/common.h | 21 ++ include/configs/qemu-mips.h | 14 +- lib/Makefile | 28 ++- lib/bootstrap.c | 89 +++++++ lib/lzma/Makefile | 4 +- lib/lzo/Makefile | 4 +- 23 files changed, 1434 insertions(+), 32 deletions(-) create mode 100644 arch/mips/cpu/reset.c create mode 100644 arch/mips/cpu/reset_bootstrap.c create mode 100644 arch/mips/cpu/start_bootstrap.S create mode 100644 arch/mips/lib/board_bootstrap.c create mode 100644 board/qemu-mips/qemu-mips_bootstrap.c create mode 100644 board/qemu-mips/u-boot-bootstrap.lds create mode 100644 common/console_bootstrap.c create mode 100644 lib/bootstrap.c
Signature · 43 lines
Luigi 'Comio' Mantellini R&D - Software Industrie Dial Face S.p.A. Via Canzo, 4 20068 Peschiera Borromeo (MI) Italy Tel.: +39 02 5167 2813 Fax: +39 02 5167 2459 E-mail: luigi.mantellini at idf-hit.com Website: http://www.idf-hit.com Questo messaggio e i suoi allegati sono indirizzati esclusivamente alle persone indicate. La diffusione, copia o qualsiasi altra azione derivante dalla conoscenza di queste informazioni sono rigorosamente vietate. Qualora abbiate ricevuto questo documento per errore siete cortesemente pregati di darne immediata comunicazione al mittente e di provvedere alla sua distruzione, Grazie. Rispetta l'ambiente. Non stampare questa mail se non ? realmente necessario. This e-mail and any attachments is confidential and may contain privileged information intended for the addressee(s) only. Dissemination, copying, printing or use by anybody else is unauthorized. If you are not the intended recipient, please delete this message and any attachments and advise the sender by return e-mail, Thanks. Help the environment. Please do not print this email unless it is absolutely necessary. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 8938 bytes Desc: not available Url : http://lists.denx.de/pipermail/u-boot/attachments/20101130/099b9c81/attachment.png -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20101130/099b9c81/attachment.pgp
cover Add support for bootstrap stage and compressed U-Boot image
Hi,
Quoted 17 lines · Luigi 'Comio' Mantellini
Look the following benchmark (qemu-mips board):
U-Boot Vanilla
179600 bytes u-boot.binBootstrap code w/o compresion (memcpy)
189224 bytes u-boot-bootstrap.bin
--> size 105%Bootstrap code using BZIP2 compression
114388 bytes u-boot-bootstrap.bin
-->size 64%Bootstrap code using GZIP compression
114204 bytes u-boot-bootstrap.bin
-->size 64%
Quoted 7 lines
Bootstrap code using LZMA compression
89456 bytes u-boot-bootstrap.bin
-->size 50% <-- BESTBootstrap code using LZO compression
104388 bytes u-boot-bootstrap.bin
-->size 58%
Personally, I don't much care about the size of U-Boot bin itself (179kB or 104kB), but it depends. And I'd like to see how much boot time of U-Boot improved on your environment.
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
The following patches introduce the bootstrap support that enable to have a
compressed U-Boot image. The bootstrap code supports the uncompressed as well as compressed payloads, using LZMA, GZIP, BZIP2 and LZO.
Actually I developed just the mips version (using qemu-mips board)...
Please see the Patch #1 for the required defines to enable the required features.
Not having a closer look at the patch yet, some general comments:
* Two patches posted, but contains multiple logical changes:
- CONFIG_BOOTSTRAP* build infrastructure (main body)
- common: Introduce console_bootstrap
- MIPS: Separate _machine_restart() and do_reset() into reset.c
- MIPS: config.mk: Append -g debug option to PLATFORM_CPPFLAGS,
which is already provided by $(TOPDIR)/config.mk.
- MIPS: qemu_mips: bootstrap support enablement (experimental)
Please break into logical changes, please.
* '_bootstrap' suffixed files are almost identical to the original ones:
- arch/mips/cpu/reset{,_bootstrap}.c
- arch/mips/cpu/start{,_bootstrap}.S
- board/qemu-mips/u-boot{,_bootstrap}.lds
Is there any way not to duplicate them? Do we really need to have _bootstrap files separated?
Once this bootstrap feature approved as general U-Boot feature, I'd like to take MIPS-related changes.
Thanks,
Ralf
cover Add support for bootstrap stage and compressed U-Boot image
Quoted 6 lines · Shinya Kuribayashi
Once this bootstrap feature approved as general U-Boot feature, I'd like to take MIPS-related changes.
Thanks,
Ralf
Not Ralf! Needs two cups of coffee to wake up...
Shinya
cover Add support for bootstrap stage and compressed U-Boot image
In reply to Shinya KuribayashiHi Shunya,
Quoted 5 lines · Shinya Kuribayashi
Hi,
Quoted 2 lines · Luigi 'Comio' Mantellini
Look the following benchmark (qemu-mips board):
...
Quoted 4 lines
Quoted 4 lines
Bootstrap code using LZMA compression
89456 bytes u-boot-bootstrap.bin
-->size 50% <-- BEST
...
Quoted 5 lines
Personally, I don't much care about the size of U-Boot bin itself (179kB or 104kB), but it depends. ?And I'd like to see how much boot time of U-Boot improved on your environment.
My target is to have a full-featured u-boot with size less than flash sector (128K on my dev board).
In the best case (LZMA, but I also tried with XZ) I have just 16K/17K of boot code and a payload u-boot image less than half of the original size.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
The following patches introduce the bootstrap support that enable to have a
compressed U-Boot image. The bootstrap code supports the uncompressed as well as compressed payloads, using LZMA, GZIP, BZIP2 and LZO.
Actually I developed just the mips version (using qemu-mips board)...
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Please see the Patch #1 for the required defines to enable the required features.
Not having a closer look at the patch yet, some general comments:
* Two patches posted, but contains multiple logical changes:
?- CONFIG_BOOTSTRAP* build infrastructure (main body)
I will separate into a (1) Generic bootstrap code, (2) and MIPS support. I will send ASAP a new patchset that inclues also XZ format support (aka LZMA2)
Quoted 11 lines
?- common: Introduce
console_bootstrap
?- MIPS: Separate_machine_restart()anddo_reset()intoreset.c?- MIPS: config.mk: Append -g debug option toPLATFORM_CPPFLAGS, ? ?which is already provided by $(TOPDIR)/config.mk. ?- MIPS:qemu_mips: bootstrap support enablement (experimental)?Please break into logical changes, please.
* '
_bootstrap' suffixed files are almost identical to the original ?ones:
?-arch/mips/cpu/reset{,_bootstrap}.c
I removed the "fprintf" from reset_bootstrap.c because the bootstrap code haven't the generic dev io infrastructure. I would avoid also to compile twice the same files in order to produce different .o files (changing, for example, a define value).
Quoted 2 lines
?-
arch/mips/cpu/start{,_bootstrap}.S
?-board/qemu-mips/u-boot{,_bootstrap}.lds
some here.
Quoted 3 lines
?Is there any way not to duplicate them? ?Do we really need to have ?_bootstrap files separated?
An Idea, that I don't like, should be to compile changing the CFLAGS in order to produce different object files. Considering that bootstrap code should be very small and stable I don't see big issues to have different files.
Quoted 3 lines
Once this bootstrap feature approved as general U-Boot feature, I'd like to take MIPS-related changes.
ok.
Thanks for your review.
luigi
Quoted 9 lines
Thanks,
?Ralf
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 10 lines
Luigi 'Comio' Mantellini R&D - Software Industrie Dial Face S.p.A. Via Canzo, 4 20068 Peschiera Borromeo (MI), Italy Tel.: +39 02 5167 2813 Fax: +39 02 5167 2459 web: www.idf-hit.com mail: luigi.mantellini at idf-hit.com