Support for Bootstrap Code
Subsystems (4)
v2 cover Support for Bootstrap Code
From: Luigi 'Comio' Mantellini <[email protected]>
The following patch set add the support for Bootstrap code. This permits to have a compressed full featured U-Boot binary.
See README file in the U-Boot root.
The patchset includes also the XZ format support and a fix to LZMA code.
Luigi 'Comio' Mantellini (6):
Add support for XZ decompression algorithm.
LZMA: Avoid free on null pointer
Enable garbage collelction of unused input sections. Add support for Bootstrap infrastructure. Enable bootstrap support for MIPS architecture. Enable bootstrap code for QEMU-MIPS board.
.gitignore | 25 +- Makefile | 175 +++++- README | 56 ++ 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 | 455 +++++++++++++ arch/mips/lib/Makefile | 15 +- arch/mips/lib/board_bootstrap.c | 331 +++++++++ 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 | 16 +- common/cmd_bootm.c | 27 +- common/console_bootstrap.c | 85 +++ common/image.c | 1 + config.mk | 29 + include/bootstrap.h | 59 ++ include/common.h | 21 + include/configs/qemu-mips.h | 15 +- include/image.h | 1 + include/unxz.h | 16 + include/xz.h | 237 +++++++ lib/Makefile | 29 +- lib/bootstrap.c | 97 +++ lib/lzma/LzmaDec.c | 4 +- lib/lzma/Makefile | 4 +- lib/lzo/Makefile | 4 +- lib/xz/Makefile | 53 ++ lib/xz/decompress_unxz.c | 231 +++++++ lib/xz/xz_dec_bcj.c | 564 ++++++++++++++++ lib/xz/xz_dec_lzma2.c | 1175 +++++++++++++++++++++++++++++++++ lib/xz/xz_dec_stream.c | 823 +++++++++++++++++++++++ lib/xz/xz_lzma2.h | 204 ++++++ lib/xz/xz_private.h | 154 +++++ lib/xz/xz_stream.h | 50 ++ tools/xz_wrap.sh | 45 ++ 40 files changed, 5232 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 include/bootstrap.h create mode 100644 include/unxz.h create mode 100644 include/xz.h create mode 100644 lib/bootstrap.c create mode 100644 lib/xz/Makefile create mode 100644 lib/xz/decompress_unxz.c create mode 100644 lib/xz/xz_dec_bcj.c create mode 100644 lib/xz/xz_dec_lzma2.c create mode 100644 lib/xz/xz_dec_stream.c create mode 100644 lib/xz/xz_lzma2.h create mode 100644 lib/xz/xz_private.h create mode 100644 lib/xz/xz_stream.h create mode 100755 tools/xz_wrap.sh
Signature · 1 line
1.7.3
PATCH v2 1/6 Add support for XZ decompression algorithm.
From: Luigi 'Comio' Mantellini <[email protected]>
The code is a cut-down version of XZ Embedded (2010/07/02) and supports only single-call API.
--- Makefile | 1 + README | 9 + common/cmd_bootm.c | 27 +- common/image.c | 1 + include/image.h | 1 + include/unxz.h | 16 + include/xz.h | 237 ++++++++++ lib/xz/Makefile | 51 ++ lib/xz/decompress_unxz.c | 231 +++++++++ lib/xz/xz_dec_bcj.c | 564 ++++++++++++++++++++++ lib/xz/xz_dec_lzma2.c | 1175 ++++++++++++++++++++++++++++++++++++++++++++++ lib/xz/xz_dec_stream.c | 823 ++++++++++++++++++++++++++++++++ lib/xz/xz_lzma2.h | 204 ++++++++ lib/xz/xz_private.h | 154 ++++++ lib/xz/xz_stream.h | 50 ++ 15 files changed, 3542 insertions(+), 2 deletions(-) create mode 100644 include/unxz.h create mode 100644 include/xz.h create mode 100644 lib/xz/Makefile create mode 100644 lib/xz/decompress_unxz.c create mode 100644 lib/xz/xz_dec_bcj.c create mode 100644 lib/xz/xz_dec_lzma2.c create mode 100644 lib/xz/xz_dec_stream.c create mode 100644 lib/xz/xz_lzma2.h create mode 100644 lib/xz/xz_private.h create mode 100644 lib/xz/xz_stream.h
Makefile +1 -0
@@ -183,6 +183,7 @@ OBJS := $(addprefix $(obj),$(OBJS)) LIBS = lib/libgeneric.o LIBS += lib/lzma/liblzma.o LIBS += lib/lzo/liblzo.o +LIBS += lib/xz/libxz.o LIBS += $(shell if [ -f board/$(VENDOR)/common/Makefile ]; then echo \ "board/$(VENDOR)/common/lib$(VENDOR).o"; fi) ifdef CONFIG_FSL_DIU_FB
README +9 -0
@@ -220,6 +220,7 @@ Directory Hierarchy: /libfdt Library files to support flattened device trees /lzma Library files to support LZMA decompression /lzo Library files to support LZO decompression + /xz Library files to support XZ/LZMA2 decompression /net Networking code /post Power On Self Test /rtc Real Time Clock drivers
@@ -1178,6 +1179,14 @@ The following options need to be configured: then calculate the amount of needed dynamic memory (ensuring the appropriate CONFIG_SYS_MALLOC_LEN value). + CONFIG_XZ + + If this option is set, support for xz compresed + images is included. + + XZ format is the next version of LZMA format. See also + the CONFIG_LZMA + - MII/PHY support: CONFIG_PHY_ADDR
common/cmd_bootm.c +25 -2
@@ -61,6 +61,10 @@#include <linux/lzo.h> #endif /* CONFIG_LZO */ +#ifdef CONFIG_XZ +#include <unxz.h> +#endif /* CONFIG_XZ */ +DECLARE_GLOBAL_DATA_PTR ;#ifndef CONFIG_SYS_BOOTM_LEN
@@ -338,9 +342,9 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)ulong image_start = os.image_start;ulong image_len = os.image_len;uint unc_len =CONFIG_SYS_BOOTM_LEN ; -#if defined(CONFIG_LZMA ) || defined(CONFIG_LZO ) +#if defined(CONFIG_LZMA ) || defined(CONFIG_LZO ) || defined(CONFIG_XZ )int ret; -#endif /* defined(CONFIG_LZMA) || defined(CONFIG_LZO) */ +#endif /* defined(CONFIG_LZMA) || defined(CONFIG_LZO) || defined(CONFIG_XZ) */ const char *type_name =genimg_get_type_name (os.type);
@@ -430,6 +434,25 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress) *load_end = load + unc_len;break ;#endif /* CONFIG_LZO */ +#ifdef CONFIG_XZ +case IH_COMP_XZ : { +int in_used = unc_len; +printf (" Uncompressing %s ... " , type_name); + ret =unxz ( + (unsigned char *)image_start, image_len, + (unsigned char *)load, &in_used); + unc_len = in_used; +if (ret !=0 ) { +printf ("XZ: uncompress or overwrite error %d " +"- must RESET board to recover\n" , ret); +show_boot_progress (-6 ); +return BOOTM_ERR_RESET ; + } + *load_end = load + unc_len; +break ; + } +break ; +#endif /* CONFIG_XZ */ default :printf ("Unimplemented compression type %d\n" , comp);return BOOTM_ERR_UNIMPLEMENTED ;
common/image.c +1 -0
@@ -150,6 +150,7 @@ static table_entry_t uimage_comp[] = { { IH_COMP_GZIP, "gzip", "gzip compressed", }, { IH_COMP_LZMA, "lzma", "lzma compressed", }, { IH_COMP_LZO, "lzo", "lzo compressed", }, + { IH_COMP_XZ, "xz", "xz compressed", }, { -1, "", "", }, };
include/image.h +1 -0
@@ -166,6 +166,7 @@#define IH_COMP_BZIP2 2/* bzip2 Compression Used */ #define IH_COMP_LZMA 3/* lzma Compression Used */ #define IH_COMP_LZO 4/* lzo Compression Used */ +#define IH_COMP_XZ 5/* xz Compression Used */ #define IH_MAGIC 0x27051956/* Image Magic Number */ #define IH_NMLEN 32/* Image Name Length */
include/unxz.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* Wrapper for XZ decompressor to make it usable for kernel and initramfs +* decompression +* +* Author: Lasse Collin <[email protected]> +* +* This file has been put into the public domain. +* You can do whatever you want with this file. +*/ + +#ifndef DECOMPRESS_UNXZ_H +#define DECOMPRESS_UNXZ_H + +int unxz (unsigned char *in,int in_size,unsigned char *out,int *in_used); + +#endif
include/xz.h new file +237 -0
237 lines not on this page · raw message
lib/xz/Makefile new file +51 -0
51 lines not on this page · raw message
lib/xz/decompress_unxz.c new file +231 -0
231 lines not on this page · raw message
lib/xz/xz_dec_bcj.c new file +564 -0
564 lines not on this page · raw message
lib/xz/xz_dec_lzma2.c new file +1175 -0
1,175 lines not on this page · raw message
lib/xz/xz_dec_stream.c new file +823 -0
638 lines not on this page · raw message
lib/xz/xz_lzma2.h new file +204 -0
204 lines not on this page · raw message
lib/xz/xz_private.h new file +154 -0
154 lines not on this page · raw message
lib/xz/xz_stream.h new file +50 -0
50 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.3
Part of the diff is not shown here. View the raw message.
PATCH v2 1/6 Add support for XZ decompression algorithm.
Dear Luigi 'Comio' Mantellini,
Quoted 6 lines · In message <[email protected]>…
From: Luigi 'Comio' Mantellini <[email protected]>
The code is a cut-down version of XZ Embedded (2010/07/02) and supports only single-call API.
Signed-off-by Luigi 'Comio' Mantellini <[email protected]>---
Please read http://www.denx.de/wiki/U-Boot/Patches and especially
http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions
When reposting, please always describe what has been changed!!
So why are you reposting, and what did you change?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I used to be indecisive, now I'm not sure.
PATCH v2 2/6 LZMA: Avoid free on null pointer
In reply to Luigi 'Comio' MantelliniFrom: Luigi 'Comio' Mantellini <[email protected]>
--- lib/lzma/LzmaDec.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
lib/lzma/LzmaDec.c +3 -1
@@ -913,7 +913,9 @@ SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *srvoid LzmaDec_FreeProbs (CLzmaDec *p,ISzAlloc *alloc) { - alloc->Free (alloc, p->probs); +if (p->probs) { + alloc->Free (alloc, p->probs); + } p->probs =0 ; }
Signature · 1 line
1.7.3
PATCH v2 4/6 Add support for Bootstrap infrastructure.
In reply to Luigi 'Comio' MantelliniFrom: Luigi 'Comio' Mantellini <[email protected]>
See README file for details regarding ho bootstrap code works.
--- .gitignore | 25 ++++++- Makefile | 174 +++++++++++++++++++++++++++++++++++++++++++- README | 47 ++++++++++++ common/Makefile | 16 ++++- common/console_bootstrap.c | 85 +++++++++++++++++++++ config.mk | 16 ++++ include/bootstrap.h | 59 +++++++++++++++ include/common.h | 21 +++++ lib/Makefile | 29 +++++++- lib/bootstrap.c | 97 ++++++++++++++++++++++++ lib/lzma/Makefile | 4 +- lib/lzo/Makefile | 4 +- lib/xz/Makefile | 4 +- tools/xz_wrap.sh | 45 +++++++++++ 14 files changed, 618 insertions(+), 8 deletions(-) create mode 100644 common/console_bootstrap.c create mode 100644 include/bootstrap.h create mode 100644 lib/bootstrap.c create mode 100755 tools/xz_wrap.sh
.gitignore +24 -1
@@ -23,6 +23,12 @@ /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.bin.xz +/u-boot.dis /u-boot.srec /u-boot.ldr /u-boot.ldr.hex
@@ -30,6 +36,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 +59,7 @@ /LOG /errlog /reloc_off - +/.payload.s /include/generated/ /lib/asm-offsets.s
@@ -66,3 +86,6 @@ cscope.* /onenand_ipl/onenand-ipl* /onenand_ipl/board/*/onenand* /onenand_ipl/board/*/*.S +examples/standalone/ + +setvars
Makefile +173 -1
240 lines not on this page · raw message
README +47 -0
53 lines not on this page · raw message
common/Makefile +14 -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,29 @@ COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o COBJS-$(CONFIG_UPDATE_TFTP) += update.o COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_GZIP) += dlmalloc.o +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_BZIP2) += 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 +16 -0
@@ -166,6 +166,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)
@@ -176,6 +181,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
@@ -222,6 +231,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/bootstrap.h new file +59 -0
59 lines not on this page · raw message
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 +28 -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,37 @@ 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-$(CONFIG_BOOTSTRAP_XZ) += crc32.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 +97 -0
98 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)
lib/xz/Makefile +3 -1
@@ -32,7 +32,9 @@ SOBJS = CFLAGS += -COBJS-$(CONFIG_XZ) += decompress_unxz.o +COBJS-$(CONFIG_XZ)$(CONFIG_BOOTSTRAP_XZ) += decompress_unxz.o + +COBJS-y += $(COBJS-yy) COBJS = $(COBJS-y) SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
tools/xz_wrap.sh new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
1.7.3
PATCH v2 5/6 Enable bootstrap support for MIPS architecture.
In reply to Luigi 'Comio' MantelliniFrom: Luigi 'Comio' Mantellini <[email protected]>
--- 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 | 455 +++++++++++++++++++++++++++++++++++++++ arch/mips/lib/Makefile | 15 ++- arch/mips/lib/board_bootstrap.c | 331 ++++++++++++++++++++++++++++ 8 files changed, 903 insertions(+), 18 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
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 +455 -0
455 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 +331 -0
331 lines not on this page · raw message
Signature · 1 line
1.7.3
v2 cover Support for Bootstrap Code
In reply to Luigi 'Comio' MantelliniPlease ignore double post. My apologies.
The patch 1/6 is ~104K and awaits moderator approval. Sorry also for this.
ciao
luigi
Quoted 87 lines · Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini <[email protected]>
The following patch set add the support for Bootstrap code. This permits to have a compressed full featured U-Boot binary.
See README file in the U-Boot root.
The patchset includes also the XZ format support and a fix to LZMA code.
Luigi 'Comio' Mantellini (6):
?Add support for XZ decompression algorithm. ?LZMA: Avoid free on null pointer
?Enable garbage collelction of unused input sections. ?Add support for Bootstrap infrastructure. ?Enable bootstrap support for MIPS architecture. ?Enable bootstrap code for QEMU-MIPS board.?.gitignore ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? 25 +- ?Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ?175 +++++- ?README ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? 56 ++ ?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 ? ? ? | ?455 +++++++++++++ ?arch/mips/lib/Makefile ? ? ? ? ? ? ? ?| ? 15 +- ?arch/mips/lib/board_bootstrap.c ? ? ? | ?331 +++++++++ ?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 ? ? ? ? ? ? ? ? ? ? ? | ? 16 +- ?common/cmd_bootm.c ? ? ? ? ? ? ? ? ? ?| ? 27 +- ?common/console_bootstrap.c ? ? ? ? ? ?| ? 85 +++ ?common/image.c ? ? ? ? ? ? ? ? ? ? ? ?| ? ?1 + ?config.mk ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 29 + ?include/bootstrap.h ? ? ? ? ? ? ? ? ? | ? 59 ++ ?include/common.h ? ? ? ? ? ? ? ? ? ? ?| ? 21 + ?include/configs/qemu-mips.h ? ? ? ? ? | ? 15 +- ?include/image.h ? ? ? ? ? ? ? ? ? ? ? | ? ?1 + ?include/unxz.h ? ? ? ? ? ? ? ? ? ? ? ?| ? 16 + ?include/xz.h ? ? ? ? ? ? ? ? ? ? ? ? ?| ?237 +++++++ ?lib/Makefile ? ? ? ? ? ? ? ? ? ? ? ? ?| ? 29 +- ?lib/bootstrap.c ? ? ? ? ? ? ? ? ? ? ? | ? 97 +++ ?lib/lzma/LzmaDec.c ? ? ? ? ? ? ? ? ? ?| ? ?4 +- ?lib/lzma/Makefile ? ? ? ? ? ? ? ? ? ? | ? ?4 +- ?lib/lzo/Makefile ? ? ? ? ? ? ? ? ? ? ?| ? ?4 +- ?lib/xz/Makefile ? ? ? ? ? ? ? ? ? ? ? | ? 53 ++ ?lib/xz/decompress_unxz.c ? ? ? ? ? ? ?| ?231 +++++++ ?lib/xz/xz_dec_bcj.c ? ? ? ? ? ? ? ? ? | ?564 ++++++++++++++++ ?lib/xz/xz_dec_lzma2.c ? ? ? ? ? ? ? ? | 1175 +++++++++++++++++++++++++++++++++ ?lib/xz/xz_dec_stream.c ? ? ? ? ? ? ? ?| ?823 +++++++++++++++++++++++ ?lib/xz/xz_lzma2.h ? ? ? ? ? ? ? ? ? ? | ?204 ++++++ ?lib/xz/xz_private.h ? ? ? ? ? ? ? ? ? | ?154 +++++ ?lib/xz/xz_stream.h ? ? ? ? ? ? ? ? ? ?| ? 50 ++ ?tools/xz_wrap.sh ? ? ? ? ? ? ? ? ? ? ?| ? 45 ++?40 files changed, 5232 insertions(+), 32 deletions(-) ?create mode 100644
arch/mips/cpu/reset.c?create mode 100644arch/mips/cpu/reset_bootstrap.c?create mode 100644arch/mips/cpu/start_bootstrap.S?create mode 100644arch/mips/lib/board_bootstrap.c?create mode 100644board/qemu-mips/qemu-mips_bootstrap.c?create mode 100644board/qemu-mips/u-boot-bootstrap.lds?create mode 100644common/console_bootstrap.c?create mode 100644include/bootstrap.h
?create mode 100644include/unxz.h
?create mode 100644include/xz.h
?create mode 100644lib/bootstrap.c
?create mode 100644lib/xz/Makefile
?create mode 100644lib/xz/decompress_unxz.c?create mode 100644lib/xz/xz_dec_bcj.c
?create mode 100644lib/xz/xz_dec_lzma2.c?create mode 100644lib/xz/xz_dec_stream.c?create mode 100644lib/xz/xz_lzma2.h
?create mode 100644lib/xz/xz_private.h
?create mode 100644lib/xz/xz_stream.h
?create mode 100755tools/xz_wrap.sh--
1.7.3_______________________________________________
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