Add Pre-Bootloader support
Subsystems (6)
cover Add Pre-Bootloader support
Hi,
please pull
The following changes since commit 9ab50e0b9cb6400a4442acd36c3d4b315685fa6a:
Merge branch 'for-next/tqma53' into next (2012-07-27 10:05:03 +0200)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git tags/pbl
for you to fetch changes up to e373b3c53902c1d6da4289db9467ad50e209d0c7:
at91: add lowlevel init to the pbl (2012-07-28 02:19:09 +0800)
----------------------------------------------------------------
Add pre-bootloader (pbl) image support
This allows for creating a pre-bootloader binary for
- nand boot
- mmc boot
- compressed image
Currently on the compressed image is implemented the boot really on current lowlevel init support. In a second step this could be move to the pbl c code with generic framework.
The pbl will be incharge of the lowlevel init if needed. The barebox will skip it.
The decompressor support lzo and gzip and allow to add easly more.
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (9):
kbuild: Init all relevant variables used in kbuild files so
kbuild: add pre-bootloader (pbl) target
Add pre-bootloader (pbl) image support
pbl: discard unwind symbol if enable in barebox
decompress_unlzo: define decompress_unlzo as decompress
decompressor: import malloc/free implementation for linux 3.4
ARM: add early malloc support needed by the decompressor compressed image: add gzip support
at91: add lowlevel init to the pbl
Sascha Hauer (3):
Add compressed image support
only compress default env in uncompressed images
ARM: Separate assembler functions into their own section
Makefile | 11 ++++-- arch/arm/Kconfig | 2 ++ arch/arm/Makefile | 8 +++++ arch/arm/cpu/Makefile | 1 + arch/arm/cpu/start.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- arch/arm/lib/Makefile | 4 +++ arch/arm/lib/barebox.lds.S | 3 +- arch/arm/lib/findbit.S | 9 +++++ arch/arm/mach-at91/Makefile | 2 ++ arch/arm/pbl/Makefile | 38 +++++++++++++++++++++ arch/arm/pbl/piggy.gzip.S | 6 ++++ arch/arm/pbl/piggy.lzo.S | 6 ++++ arch/arm/pbl/zbarebox.lds.S | 74 ++++++++++++++++++++++++++++++++++++++++ common/Kconfig | 34 +++++++++++++++++++ include/asm-generic/memory_layout.h | 1 + include/linux/decompress/mm.h | 68 +++++++++++++++++++++++++++++++++++++ lib/decompress_inflate.c | 1 + lib/decompress_unlzo.c | 1 + pbl/Makefile | 5 +++ pbl/misc.c | 14 ++++++++ pbl/string.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/Makefile.build | 73 +++++++++++++++++++++++++++++++++++++--- scripts/Makefile.lib | 14 ++++++++ 23 files changed, 604 insertions(+), 11 deletions(-) create mode 100644 arch/arm/pbl/Makefile create mode 100644 arch/arm/pbl/piggy.gzip.S create mode 100644 arch/arm/pbl/piggy.lzo.S create mode 100644 arch/arm/pbl/zbarebox.lds.S create mode 100644 include/linux/decompress/mm.h create mode 100644 pbl/Makefile create mode 100644 pbl/misc.c create mode 100644 pbl/string.c
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/12 kbuild: Init all relevant variables used in kbuild files so
import from linux 3.5-rc5
--- scripts/Makefile.build | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
scripts/Makefile.build +24 -1
@@ -7,7 +7,30 @@ src := $(obj) PHONY := __build __build: -# Read .config if it exist, otherwise ignore +# Init all relevant variables used in kbuild files so +# 1) they have correct type +# 2) they do not inherit any value from the environment +obj-y := +obj-m := +lib-y := +lib-m := +always := +targets := +subdir-y := +subdir-m := +EXTRA_AFLAGS := +EXTRA_CFLAGS := +EXTRA_CPPFLAGS := +EXTRA_LDFLAGS := +asflags-y := +ccflags-y := +cppflags-y := +ldflags-y := + +subdir-asflags-y := +subdir-ccflags-y := + +# Read auto.conf if it exists, otherwise ignore -include include/config/auto.conf include scripts/Kbuild.include
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/12 kbuild: add pre-bootloader (pbl) target
This will allow to link compiled object to the built-in-pbl.o across the source tree that will be finally link to the pbl.
Now we compile the source %.c in pbl-%.o and provide -D__PBL__ so we can known in the source when it's compile for barebox or the pbl.
--- Makefile | 5 ++++- scripts/Makefile.build | 48 +++++++++++++++++++++++++++++++++++++++++++++--- scripts/Makefile.lib | 14 ++++++++++++++ 3 files changed, 63 insertions(+), 4 deletions(-)
Makefile +4 -1
@@ -481,6 +481,7 @@ barebox-alldirs := $(sort $(barebox-dirs) $(patsubst %/,%,$(filter %/, \ $(core-n) $(core-) $(drivers-n) $(drivers-) \ $(net-n) $(net-) $(libs-n) $(libs-)))) +pbl-common-y := $(patsubst %/, %/built-in-pbl.o, $(common-y)) common-y := $(patsubst %/, %/built-in.o, $(common-y)) # Build barebox
@@ -510,6 +511,8 @@ common-y := $(patsubst %/, %/built-in.o, $(common-y)) # System.map is generated to document addresses of all kernel symbols barebox-common := $(common-y) +barebox-pbl-common := $(pbl-common-y) +export barebox-pbl-common barebox-all := $(barebox-common) barebox-lds := $(lds-y)
@@ -714,7 +717,7 @@ barebox.srec: barebox # The actual objects are generated when descending, # make sure no implicit rule kicks in -$(sort $(barebox-head) $(barebox-common) ) $(barebox-lds): $(barebox-dirs) ; +$(sort $(barebox-head) $(barebox-common) ) $(barebox-lds) $(barebox-pbl-common): $(barebox-dirs) ; # Handle descending into subdirectories listed in $(barebox-dirs) # Preset locale variables to speed up the build process. Limit locale
scripts/Makefile.build +45 -3
97 lines not on this page · raw message
scripts/Makefile.lib +14 -0
@@ -21,6 +21,17 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) # o if we encounter foo/ in $(obj-m), remove it from $(obj-m) # and add the directory to the list of dirs to descend into: $(subdir-m) +# for non dirs add pbl- prefix to the target +# so we recompile the source with custom flags and custom quiet +__pbl-y := $(notdir $(pbl-y)) +pbl-y := $(patsubst %.o,pbl-%.o,$(__pbl-y)) +# add subdir from $(obj-y) too so we do not need to have the dir define in +# both $(obj-y) and $(pbl-y) +__pbl-y := $(filter-out $(pbl-y), $(filter %/, $(obj-y))) +pbl-y += $(__pbl-y) + +pbl-y := $(sort $(patsubst %/, %/built-in-pbl.o, $(pbl-y))) + __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) subdir-y += $(__subdir-y) __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
@@ -46,7 +57,9 @@ multi-objs := $(multi-objs-y) $(multi-objs-m) # $(subdir-obj-y) is the list of objects in $(obj-y) which do not live # in the local directory +__subdir-obj-y := $(foreach o,$(pbl-y),$(if $(filter-out $(o),$(notdir $(o))),$(o))) subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o))) +subdir-obj-y += $(__subdir-obj-y) # $(obj-dirs) is a list of directories that contain object files obj-dirs := $(dir $(multi-objs) $(subdir-obj-y))
@@ -63,6 +76,7 @@ targets := $(addprefix $(obj)/,$(targets)) obj-y := $(addprefix $(obj)/,$(obj-y)) obj-m := $(addprefix $(obj)/,$(obj-m)) lib-y := $(addprefix $(obj)/,$(lib-y)) +pbl-y := $(addprefix $(obj)/,$(pbl-y)) subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) real-objs-y := $(addprefix $(obj)/,$(real-objs-y)) real-objs-m := $(addprefix $(obj)/,$(real-objs-m))
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/12 Add pre-bootloader (pbl) image support
In reply to Jean-Christophe PLAGNIOL-VILLARDThis allows for creating a pre-bootloader binary for
- nand boot
- mmc boot
- compressed image
The pbl will be incharge of the lowlevel init if needed. The barebox will skip it.
Import string functions from linux 3.4 (arch/arm/boot/compressed/string.c) and implement a dummy panic.
For now on introduce dummy zbarebox* targets and c code that will contain later the decompressor. This only implemeted on ARM.
This patch is based on Sascha Hauer <[email protected]> Add compressed image support patch
---
Makefile | 6 +-
arch/arm/Kconfig | 1 +
arch/arm/Makefile | 4 +
arch/arm/cpu/Makefile | 1 +
arch/arm/cpu/start.c | 43 ++++++-
arch/arm/lib/Makefile | 4 +
arch/arm/lib/barebox.lds.S | 3 +-
arch/arm/pbl/Makefile | 25 ++++
arch/arm/{lib/barebox.lds.S => pbl/zbarebox.lds.S} | 53 ++------
common/Kconfig | 30 +++++
include/asm-generic/memory_layout.h | 1 +
pbl/Makefile | 5 +
pbl/misc.c | 14 +++
pbl/string.c | 127 ++++++++++++++++++++
14 files changed, 269 insertions(+), 48 deletions(-)
create mode 100644 arch/arm/pbl/Makefile
copy arch/arm/{lib/barebox.lds.S => pbl/zbarebox.lds.S} (60%)
create mode 100644 pbl/Makefile
create mode 100644 pbl/misc.c
create mode 100644 pbl/string.cMakefile +5 -1
@@ -474,6 +474,8 @@ CFLAGS += $(call cc-option,-Wno-pointer-sign,) # this default value export KBUILD_IMAGE ?= barebox +common-$(CONFIG_PBL_IMAGE) += pbl/ + barebox-dirs := $(patsubst %/,%,$(filter %/, $(common-y))) barebox-alldirs := $(sort $(barebox-dirs) $(patsubst %/,%,$(filter %/, \
@@ -520,7 +522,7 @@ barebox-lds := $(lds-y) # May be overridden by arch/$(ARCH)/Makefile quiet_cmd_barebox__ ?= LD $@ cmd_barebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_barebox) -o $@ \ - -T $(barebox-lds) $(barebox-head) \ + -T $(barebox-lds) \ --start-group $(barebox-common) --end-group \ $(filter-out $(barebox-lds) $(barebox-common) FORCE ,$^)
@@ -674,7 +676,9 @@ OBJCOPYFLAGS_barebox.bin = -O binary barebox.bin: barebox FORCE $(call if_changed,objcopy) +ifndef CONFIG_PBL_IMAGE $(call cmd,check_file_size,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE)) +endif ifdef CONFIG_X86 barebox.S: barebox
arch/arm/Kconfig +1 -0
@@ -4,6 +4,7 @@ config ARM select HAS_MODULES select HAVE_CONFIGURABLE_MEMORY_LAYOUT select HAVE_CONFIGURABLE_TEXT_BASE + select HAVE_PBL_IMAGE default y config ARM_AMBA
arch/arm/Makefile +4 -0
@@ -194,6 +194,10 @@ ifeq ($(CONFIG_ARCH_DAVINCI),y) KBUILD_IMAGE := barebox.ubl endif +pbl := arch/arm/pbl +zbarebox.S zbarebox.bin zbarebox: barebox.bin + $(Q)$(MAKE) $(build)=$(pbl) $(pbl)/$@ + all: $(KBUILD_IMAGE) archprepare: maketools
arch/arm/cpu/Makefile +1 -0
@@ -15,3 +15,4 @@ obj-$(CONFIG_CPU_32v6) += cache-armv6.o obj-$(CONFIG_CPU_32v7) += cache-armv7.o obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o +pbl-y += start.o
arch/arm/cpu/start.c +39 -4
63 lines not on this page · raw message
arch/arm/lib/Makefile +4 -0
@@ -21,3 +21,7 @@ obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS) += memset.o obj-$(CONFIG_ARM_UNWIND) += unwind.o obj-$(CONFIG_MODULES) += module.o extra-y += barebox.lds + +pbl-y += lib1funcs.o +pbl-y += ashldi3.o +pbl-y += div0.o
arch/arm/lib/barebox.lds.S +2 -1
@@ -31,8 +31,9 @@ SECTIONS { . = TEXT_BASE; +#ifndef CONFIG_PBL_IMAGE PRE_IMAGE - +#endif . = ALIGN(4); .text : {
arch/arm/pbl/Makefile new file +25 -0
@@ -0,0 +1,25 @@ + +OBJCOPYFLAGS_zbarebox.bin = -O binary + +targets := zbarebox.lds zbarebox zbarebox.bin zbarebox.S + +$(obj)/zbarebox.bin: $(obj)/zbarebox FORCE + $(call if_changed,objcopy) + $(call cmd,check_file_size,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE)) + @echo ' Barebox: $@ is ready' + +$(obj)/zbarebox.S: $(obj)/zbarebox FORCE + $(call if_changed,disasm) + +LDFLAGS_zbarebox := -Map zbarebox.map +zbarebox-common := $(barebox-pbl-common) +zbarebox-lds := $(obj)/zbarebox.lds + +quiet_cmd_zbarebox__ ?= LD $@ + cmd_zbarebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_zbarebox) -o $@ \ + -T $(zbarebox-lds) \ + --start-group $(zbarebox-common) --end-group \ + $(filter-out $(zbarebox-lds) $(zbarebox-common) FORCE ,$^) + +$(obj)/zbarebox: $(zbarebox-lds) $(zbarebox-common) FORCE + $(call if_changed,zbarebox__)
arch/arm/pbl/zbarebox.lds.S renamed from arch/arm/lib/barebox.lds.S +11 -42
93 lines not on this page · raw message
common/Kconfig +30 -0
@@ -101,6 +101,36 @@ config ENVIRONMENT_VARIABLES menu "memory layout " +config HAVE_PBL_IMAGE + bool + +config HAVE_IMAGE_COMPRESSION + bool + +config PBL_IMAGE + bool "Pre-Bootloader image" + depends on HAVE_PBL_IMAGE + +if PBL_IMAGE + +config IMAGE_COMPRESSION + bool "Compressed image" + depends on HAVE_IMAGE_COMPRESSION + +if IMAGE_COMPRESSION + +choice + prompt "Compression" + +config IMAGE_COMPRESSION_LZO + bool "lzo" + +endchoice + +endif + +endif + config MMU bool "Enable MMU" help
include/asm-generic/memory_layout.h +1 -0
@@ -13,6 +13,7 @@#endif +#define HEAD_TEXT_BASE MALLOC_BASE#define MALLOC_SIZE CONFIG_MALLOC_SIZE#define STACK_SIZE CONFIG_STACK_SIZE
pbl/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# only unsed by the pbl +# +pbl-y += misc.o +pbl-y += string.o
pbl/misc.c new file +14 -0
@@ -0,0 +1,14 @@ +#include <common.h> +#include <init.h> +#include <linux/types.h> +#include <linux/string.h> +#include <linux/ctype.h> + +void __noreturn panic (const char *fmt, ...) +{ +while (1 ); +} + +void start_barebox (void ) +{ +}
pbl/string.c new file +127 -0
127 lines not on this page · raw message
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/12 pbl: discard unwind symbol if enable in barebox
In reply to Jean-Christophe PLAGNIOL-VILLARD--- arch/arm/pbl/zbarebox.lds.S | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/pbl/zbarebox.lds.S +4 -0
@@ -46,6 +46,10 @@ SECTIONS __bare_init_end = .; *(.text*) } + + /* Discard unwind if enable in barebox */ + /DISCARD/ : { *(.ARM.ex*) } + BAREBOX_BARE_INIT_SIZE . = ALIGN(4);
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/12 Add compressed image support
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
This allows for creating a lzo compressed binary unsing the pbl.
re-integrate it in the new pbl target.
--- arch/arm/Kconfig | 1 + arch/arm/Makefile | 4 ++++ arch/arm/cpu/start.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++ arch/arm/pbl/Makefile | 16 +++++++++++-- arch/arm/pbl/piggy.lzo.S | 6 +++++ 5 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 arch/arm/pbl/piggy.lzo.S
arch/arm/Kconfig +1 -0
@@ -5,6 +5,7 @@ config ARM select HAVE_CONFIGURABLE_MEMORY_LAYOUT select HAVE_CONFIGURABLE_TEXT_BASE select HAVE_PBL_IMAGE + select HAVE_IMAGE_COMPRESSION default y config ARM_AMBA
arch/arm/Makefile +4 -0
@@ -194,6 +194,10 @@ ifeq ($(CONFIG_ARCH_DAVINCI),y) KBUILD_IMAGE := barebox.ubl endif +ifdef CONFIG_IMAGE_COMPRESSION +KBUILD_IMAGE := zbarebox.bin +endif + pbl := arch/arm/pbl zbarebox.S zbarebox.bin zbarebox: barebox.bin $(Q)$(MAKE) $(build)=$(pbl) $(pbl)/$@
arch/arm/cpu/start.c +59 -0
67 lines not on this page · raw message
arch/arm/pbl/Makefile +14 -2
@@ -1,7 +1,14 @@ +suffix_$(CONFIG_IMAGE_COMPRESSION_LZO) = lzo + OBJCOPYFLAGS_zbarebox.bin = -O binary +piggy_o := piggy.$(suffix_y).o + +targets := zbarebox.lds zbarebox zbarebox.bin zbarebox.S \ + $(piggy_o) piggy.$(suffix_y) -targets := zbarebox.lds zbarebox zbarebox.bin zbarebox.S +# Make sure files are removed during clean +extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern $(obj)/zbarebox.bin: $(obj)/zbarebox FORCE $(call if_changed,objcopy)
@@ -12,7 +19,7 @@ $(obj)/zbarebox.S: $(obj)/zbarebox FORCE $(call if_changed,disasm) LDFLAGS_zbarebox := -Map zbarebox.map -zbarebox-common := $(barebox-pbl-common) +zbarebox-common := $(barebox-pbl-common) $(obj)/$(piggy_o) zbarebox-lds := $(obj)/zbarebox.lds quiet_cmd_zbarebox__ ?= LD $@
@@ -23,3 +30,8 @@ quiet_cmd_zbarebox__ ?= LD $@ $(obj)/zbarebox: $(zbarebox-lds) $(zbarebox-common) FORCE $(call if_changed,zbarebox__) + +$(obj)/piggy.$(suffix_y): $(obj)/../../../barebox.bin FORCE + $(call if_changed,$(suffix_y)) + +$(obj)/$(piggy_o): $(obj)/piggy.$(suffix_y) FORCE
arch/arm/pbl/piggy.lzo.S new file +6 -0
@@ -0,0 +1,6 @@ + .section .piggydata,#alloc + .globl input_data +input_data: + .incbin "arch/arm/compressed/piggy.lzo" + .globl input_data_end +input_data_end:
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 6/12 only compress default env in uncompressed images
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
--- common/Kconfig | 1 + 1 file changed, 1 insertion(+)
common/Kconfig +1 -0
@@ -511,6 +511,7 @@ config DEFAULT_ENVIRONMENT config DEFAULT_ENVIRONMENT_COMPRESSED bool depends on DEFAULT_ENVIRONMENT + depends on !IMAGE_COMPRESSION_LZO default y if ZLIB default y if BZLIB default y if LZO_DECOMPRESS
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 7/12 ARM: Separate assembler functions into their own section
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Sascha Hauer <[email protected]>
To let the linker remove unused functions.
--- arch/arm/lib/findbit.S | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/lib/findbit.S +9 -0
@@ -22,6 +22,7 @@ * Purpose : Find a 'zero' bit * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); */ +.section .text._find_first_zero_bit_le ENTRY(_find_first_zero_bit_le) teq r1, #0 beq 3f
@@ -43,6 +44,7 @@ ENDPROC(_find_first_zero_bit_le) * Purpose : Find next 'zero' bit * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) */ +.section .text._find_next_zero_bit_le ENTRY(_find_next_zero_bit_le) teq r1, #0 beq 3b
@@ -63,6 +65,7 @@ ENDPROC(_find_next_zero_bit_le) * Purpose : Find a 'one' bit * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); */ +.section .text._find_first_bit_le ENTRY(_find_first_bit_le) teq r1, #0 beq 3f
@@ -84,6 +87,7 @@ ENDPROC(_find_first_bit_le) * Purpose : Find next 'one' bit * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) */ +.section .text._find_next_bit_le ENTRY(_find_next_bit_le) teq r1, #0 beq 3b
@@ -101,6 +105,7 @@ ENDPROC(_find_next_bit_le) #ifdef __ARMEB__ +.section .text._find_first_zero_bit_be ENTRY(_find_first_zero_bit_be) teq r1, #0 beq 3f
@@ -118,6 +123,7 @@ ENTRY(_find_first_zero_bit_be) mov pc, lr ENDPROC(_find_first_zero_bit_be) +.section .text._find_next_zero_bit_be ENTRY(_find_next_zero_bit_be) teq r1, #0 beq 3b
@@ -135,6 +141,7 @@ ENTRY(_find_next_zero_bit_be) b 2b @ loop for next bit ENDPROC(_find_next_zero_bit_be) +.section .text._find_first_bit_be ENTRY(_find_first_bit_be) teq r1, #0 beq 3f
@@ -152,6 +159,7 @@ ENTRY(_find_first_bit_be) mov pc, lr ENDPROC(_find_first_bit_be) +.section .text._find_next_bit_be ENTRY(_find_next_bit_be) teq r1, #0 beq 3b
@@ -173,6 +181,7 @@ ENDPROC(_find_next_bit_be) /* * One or more bits in the LSB of r3 are assumed to be set. */ +.section .text.L_found .L_found: #if __LINUX_ARM_ARCH__ >= 5 rsb r0, r3, #0
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 07/12] ARM: Separate assembler functions into their own section
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
From: Sascha Hauer <[email protected]>
To let the linker remove unused functions.
This patch contains the hunks I intentionally removed from the second version of this patch because they are wrong. Please drop this patch.
Sascha
Quoted 86 lines
Signed-off-by Sascha Hauer <[email protected]>--- arch/arm/lib/findbit.S | 9 +++++++++ 1 file changed, 9 insertions(+)arch/arm/lib/findbit.S +9
-0@@ -22,6 +22,7 @@ * Purpose : Find a 'zero' bit * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit); */ +.section .text._find_first_zero_bit_le ENTRY(_find_first_zero_bit_le) teq r1, #0 beq 3f@@ -43,6 +44,7 @@ ENDPROC(_find_first_zero_bit_le) * Purpose : Find next 'zero' bit * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) */ +.section .text._find_next_zero_bit_le ENTRY(_find_next_zero_bit_le) teq r1, #0 beq 3b@@ -63,6 +65,7 @@ ENDPROC(_find_next_zero_bit_le) * Purpose : Find a 'one' bit * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit); */ +.section .text._find_first_bit_le ENTRY(_find_first_bit_le) teq r1, #0 beq 3f@@ -84,6 +87,7 @@ ENDPROC(_find_first_bit_le) * Purpose : Find next 'one' bit * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) */ +.section .text._find_next_bit_le ENTRY(_find_next_bit_le) teq r1, #0 beq 3b@@ -101,6 +105,7 @@ ENDPROC(_find_next_bit_le) #ifdef __ARMEB__ +.section .text._find_first_zero_bit_be ENTRY(_find_first_zero_bit_be) teq r1, #0 beq 3f@@ -118,6 +123,7 @@ ENTRY(_find_first_zero_bit_be) mov pc, lr ENDPROC(_find_first_zero_bit_be) +.section .text._find_next_zero_bit_be ENTRY(_find_next_zero_bit_be) teq r1, #0 beq 3b@@ -135,6 +141,7 @@ ENTRY(_find_next_zero_bit_be) b 2b @ loop for next bit ENDPROC(_find_next_zero_bit_be) +.section .text._find_first_bit_be ENTRY(_find_first_bit_be) teq r1, #0 beq 3f@@ -152,6 +159,7 @@ ENTRY(_find_first_bit_be) mov pc, lr ENDPROC(_find_first_bit_be) +.section .text._find_next_bit_be ENTRY(_find_next_bit_be) teq r1, #0 beq 3b@@ -173,6 +181,7 @@ ENDPROC(_find_next_bit_be) /* * One or more bits in the LSB of r3 are assumed to be set. */ +.section .text.L_found .L_found: #if __LINUX_ARM_ARCH__ >= 5 rsb r0, r3, #0Signature · 1 line
1.7.10.4
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 07/12] ARM: Separate assembler functions into their own section
Quoted 7 lines · Sascha Hauer
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
From: Sascha Hauer <[email protected]>
To let the linker remove unused functions.
This patch contains the hunks I intentionally removed from the second version of this patch because they are wrong. Please drop this patch.
ok I drop it
I put decompress_unlzo: define decompress_unlzo as decompress first
and update the tag
The following changes since commit d8ddfd069f99428244aff34e2ccebe9ed6a6a7a3:
decompress_unlzo: define decompress_unlzo as decompress (2012-07-30 16:23:54 +0800)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git tags/pbl
for you to fetch changes up to 096ff89b5bcc3466f12b7b40b9b0938bb850ca9c:
arm: always enable the garbage collector for pbl (2012-07-30 16:24:26 +0800)
----------------------------------------------------------------
Add pre-bootloader (pbl) image support
This allows for creating a pre-bootloader binary for
- nand boot
- mmc boot
- compressed image
Currently on the compressed image is implemented the boot really on current lowlevel init support. In a second step this could be move to the pbl c code with generic framework.
The pbl will be incharge of the lowlevel init if needed. The barebox will skip it.
The decompressor support lzo and gzip and allow to add easly more.
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (10):
kbuild: Init all relevant variables used in kbuild files so
kbuild: add pre-bootloader (pbl) target
Add pre-bootloader (pbl) image support
pbl: discard unwind symbol if enable in barebox
decompressor: import malloc/free implementation for linux 3.4
ARM: add early malloc support needed by the decompressor compressed image: add gzip support
at91: add lowlevel init to the pbl
kbuild: allow to have custom cppflags for pbl
arm: always enable the garbage collector for pbl
Sascha Hauer (2):
Add compressed image support
only compress default env in uncompressed images
Makefile | 11 +++++++++-- arch/arm/Kconfig | 2 ++ arch/arm/Makefile | 8 ++++++++ arch/arm/cpu/Makefile | 1 + arch/arm/cpu/start.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- arch/arm/lib/Makefile | 4 ++++ arch/arm/lib/barebox.lds.S | 3 ++- arch/arm/mach-at91/Makefile | 2 ++ arch/arm/pbl/Makefile | 40 +++++++++++++++++++++++++++++++++++++++ arch/arm/pbl/piggy.gzip.S | 6 ++++++ arch/arm/pbl/piggy.lzo.S | 6 ++++++ arch/arm/pbl/zbarebox.lds.S | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/Kconfig | 34 +++++++++++++++++++++++++++++++++ include/asm-generic/memory_layout.h | 1 + include/linux/decompress/mm.h | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/decompress_inflate.c | 1 + pbl/Makefile | 5 +++++ pbl/misc.c | 14 ++++++++++++++ pbl/string.c | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/Makefile.build | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- scripts/Makefile.lib | 14 ++++++++++++++ 21 files changed, 597 insertions(+), 12 deletions(-) create mode 100644 arch/arm/pbl/Makefile create mode 100644 arch/arm/pbl/piggy.gzip.S create mode 100644 arch/arm/pbl/piggy.lzo.S create mode 100644 arch/arm/pbl/zbarebox.lds.S create mode 100644 include/linux/decompress/mm.h create mode 100644 pbl/Makefile create mode 100644 pbl/misc.c create mode 100644 pbl/string.c
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 8/12 decompress_unlzo: define decompress_unlzo as decompress
In reply to Jean-Christophe PLAGNIOL-VILLARDso we can use decompress in the decompressor
this will simplify multi decompress support
--- lib/decompress_unlzo.c | 1 + 1 file changed, 1 insertion(+)
lib/decompress_unlzo.c +1 -0
@@ -289,3 +289,4 @@ exit_1: exit:return ret; } +#define decompress decompress_unlzo
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 08/12] decompress_unlzo: define decompress_unlzo as decompress
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
so we can use decompress in the decompressor
this will simplify multi decompress supportSigned-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- lib/decompress_unlzo.c | 1 + 1 file changed, 1 insertion(+)lib/decompress_unlzo.c +0
-0
lib/decompress_unlzo.c exit_1: · line 292
Quoted 4 lines
lib/decompress_unlzo.c +1
-0@@ -289,3 +289,4 @@ exit_1: exit:return ret; } +#define decompress decompress_unlzo
Shouldn't this be before 5/12?
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 08/12] decompress_unlzo: define decompress_unlzo as decompress
Quoted 9 lines · Sascha Hauer
Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
so we can use decompress in the decompressor
this will simplify multi decompress supportSigned-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- lib/decompress_unlzo.c | 1 + 1 file changed, 1 insertion(+)
Quoted 11 lines
lib/decompress_unlzo.c exit_1: · line 292
Quoted 9 lines
lib/decompress_unlzo.c +1
-0@@ -289,3 +289,4 @@ exit_1: exit:return ret; } +#define decompress decompress_unlzoShouldn't this be before 5/12?
Ok, applied this one into my for-next/compressed-prepare branch, so it will be in master when we apply this series later.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 9/12 decompressor: import malloc/free implementation for linux 3.4
In reply to Jean-Christophe PLAGNIOL-VILLARDThis is need for gunzip support
--- include/linux/decompress/mm.h | 68 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 include/linux/decompress/mm.h
include/linux/decompress/mm.h new file +68 -0
@@ -0,0 +1,68 @@ +/* +* linux/compr_mm.h +* +* Memory management for pre-boot and ramdisk uncompressors +* +* Authors: Alain Knaff <[email protected]> +* +*/ + +#ifndef DECOMPR_MM_H +#define DECOMPR_MM_H + +#ifdef STATIC + +/* Code active when included from pre-boot environment: */ + +/* +* Some architectures want to ensure there is no local data in their +* pre-boot environment, so that data can arbitrarily relocated (via +* GOT references). This is achieved by defining STATIC_RW_DATA to +* be null. +*/ +#ifndef STATIC_RW_DATA +#define STATIC_RW_DATA static +#endif + +/* A trivial malloc implementation, adapted from +* malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 +*/ +STATIC_RW_DATA unsigned long malloc_ptr; +STATIC_RW_DATA int malloc_count; + +static void *malloc (int size) +{ +void *p; + +if (size <0 ) +return NULL ; +if (!malloc_ptr) + malloc_ptr = free_mem_ptr; + + malloc_ptr = (malloc_ptr +3 ) & ~3 ;/* Align */ + + p = (void *)malloc_ptr; + malloc_ptr += size; + +if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) +return NULL ; + + malloc_count++; +return p; +} + +static void free (void *where) +{ + malloc_count--; +if (!malloc_count) + malloc_ptr = free_mem_ptr; +} + +#define large_malloc (a) malloc(a) +#define large_free (a) free(a) + +#define INIT + +#endif /* STATIC */ + +#endif /* DECOMPR_MM_H */
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 10/12 ARM: add early malloc support needed by the decompressor
In reply to Jean-Christophe PLAGNIOL-VILLARDThis is not needed by lzo but by gunzip, xz and others.
--- arch/arm/cpu/start.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/cpu/start.c +7 -0
@@ -28,6 +28,9 @@#include <asm-generic/memory_layout.h> #include <asm/sections.h> +unsigned long free_mem_ptr; +unsigned long free_mem_end_ptr; +#ifdef CONFIG_PBL_IMAGE void __naked __section(.text_head_entry) pbl_start(void) {
@@ -193,6 +196,10 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void)/* clear bss */ memset (__bss_start,0 , __bss_stop - __bss_start); +/* set 128 KiB before the STACK_BASE - 16 address for early malloc */ + free_mem_ptr =STACK_BASE -0x20000 -16 ; + free_mem_end_ptr =STACK_BASE -16 ; +/* flush I-cache before jumping to the copied binary */ __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : :"r" (0 ));
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 10/12] ARM: add early malloc support needed by the decompressor
Quoted 22 lines · Jean-Christophe PLAGNIOL-VILLARD
This is not needed by lzo but by gunzip, xz and others.
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/cpu/start.c | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm/cpu/start.c +3
-0@@ -28,6 +28,9 @@#include <asm-generic/memory_layout.h> #include <asm/sections.h> +unsigned long free_mem_ptr; +unsigned long free_mem_end_ptr; +#ifdef CONFIG_PBL_IMAGE void __naked __section(.text_head_entry) pbl_start(void) {
arch/arm/cpu/start.c void __naked __section(.text_ll_return) board_init_lowlevel_return(void) · line 202
Quoted 7 lines
arch/arm/cpu/start.c +4
-0@@ -193,6 +196,10 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void)/* clear bss */ memset (__bss_start,0 , __bss_stop - __bss_start); +/* set 128 KiB before the STACK_BASE - 16 address for early malloc */ + free_mem_ptr =STACK_BASE -0x20000 -16 ; + free_mem_end_ptr =STACK_BASE -16 ; +
This assumes that the malloc area is directly before the stack. How about using __bss_stop or _end instead?
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 10/12] ARM: add early malloc support needed by the decompressor
Quoted 26 lines · Sascha Hauer
Quoted 25 lines · Jean-Christophe PLAGNIOL-VILLARD
This is not needed by lzo but by gunzip, xz and others.
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/cpu/start.c | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm/cpu/start.c +3
-0@@ -28,6 +28,9 @@#include <asm-generic/memory_layout.h> #include <asm/sections.h> +unsigned long free_mem_ptr; +unsigned long free_mem_end_ptr; +#ifdef CONFIG_PBL_IMAGE void __naked __section(.text_head_entry) pbl_start(void) {@@ -193,6 +196,10 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void)/* clear bss */ memset (__bss_start,0 , __bss_stop - __bss_start);
Quoted 7 lines
arch/arm/cpu/start.c void __naked __section(.text_ll_return) board_init_lowlevel_return(void) · line 202
Quoted 4 lines
arch/arm/cpu/start.c +4
-0+/* set 128 KiB before the STACK_BASE - 16 address for early malloc */ + free_mem_ptr =STACK_BASE -0x20000 -16 ; + free_mem_end_ptr =STACK_BASE -16 ; +This assumes that the malloc area is directly before the stack. How about using
__bss_stopor_endinstead?
it's just for early alloc and __bss_stop no so maybe we can use the same as Malloc but we already use this for HEAD_TEXT_BASE
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 10/12] ARM: add early malloc support needed by the decompressor
Quoted 35 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 26 lines · Sascha Hauer
Quoted 25 lines · Jean-Christophe PLAGNIOL-VILLARD
This is not needed by lzo but by gunzip, xz and others.
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/cpu/start.c | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm/cpu/start.c +3
-0@@ -28,6 +28,9 @@#include <asm-generic/memory_layout.h> #include <asm/sections.h> +unsigned long free_mem_ptr; +unsigned long free_mem_end_ptr; +#ifdef CONFIG_PBL_IMAGE void __naked __section(.text_head_entry) pbl_start(void) {@@ -193,6 +196,10 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void)/* clear bss */ memset (__bss_start,0 , __bss_stop - __bss_start);Quoted 7 lines
arch/arm/cpu/start.c void __naked __section(.text_ll_return) board_init_lowlevel_return(void) · line 202
Quoted 4 lines
arch/arm/cpu/start.c +4
-0+/* set 128 KiB before the STACK_BASE - 16 address for early malloc */ + free_mem_ptr =STACK_BASE -0x20000 -16 ; + free_mem_end_ptr =STACK_BASE -16 ; +This assumes that the malloc area is directly before the stack. How about using
__bss_stopor_endinstead?
Quoted 2 lines
it's just for early alloc and
__bss_stopno so maybe we can use the same as Malloc but we already use this forHEAD_TEXT_BASE
_end is HEAD_TEXT_BASE + the space needed for the compressed image, so what's wrong with it?
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 10/12] ARM: add early malloc support needed by the decompressor
Quoted 36 lines · Sascha Hauer
Quoted 35 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 33 lines · Sascha Hauer
Quoted 22 lines · Jean-Christophe PLAGNIOL-VILLARD
This is not needed by lzo but by gunzip, xz and others.
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/cpu/start.c | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm/cpu/start.c +3
-0@@ -28,6 +28,9 @@#include <asm-generic/memory_layout.h> #include <asm/sections.h> +unsigned long free_mem_ptr; +unsigned long free_mem_end_ptr; +#ifdef CONFIG_PBL_IMAGE void __naked __section(.text_head_entry) pbl_start(void) {arch/arm/cpu/start.c void __naked __section(.text_ll_return) board_init_lowlevel_return(void) · line 202
Quoted 7 lines
arch/arm/cpu/start.c +4
-0@@ -193,6 +196,10 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void)/* clear bss */ memset (__bss_start,0 , __bss_stop - __bss_start); +/* set 128 KiB before the STACK_BASE - 16 address for early malloc */ + free_mem_ptr =STACK_BASE -0x20000 -16 ; + free_mem_end_ptr =STACK_BASE -16 ; +This assumes that the malloc area is directly before the stack. How about using
__bss_stopor_endinstead?
Quoted 5 lines
Quoted 2 lines
it's just for early alloc and
__bss_stopno so maybe we can use the same as Malloc but we already use this forHEAD_TEXT_BASE
_endisHEAD_TEXT_BASE+ the space needed for the compressed image, so what's wrong with it?
the pbl image can be stored in a sram and link to fit there so _end could be at the end of the sram
so we can not use it.
We need to put the early malloc in the sdram
as example on at91 I plan to load the pbl only without the compressed data
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 10/12] ARM: add early malloc support needed by the decompressor
Quoted 40 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 39 lines · Sascha Hauer
Quoted 37 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 26 lines · Sascha Hauer
Quoted 25 lines · Jean-Christophe PLAGNIOL-VILLARD
This is not needed by lzo but by gunzip, xz and others.
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/cpu/start.c | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm/cpu/start.c +3
-0@@ -28,6 +28,9 @@#include <asm-generic/memory_layout.h> #include <asm/sections.h> +unsigned long free_mem_ptr; +unsigned long free_mem_end_ptr; +#ifdef CONFIG_PBL_IMAGE void __naked __section(.text_head_entry) pbl_start(void) {@@ -193,6 +196,10 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void)/* clear bss */ memset (__bss_start,0 , __bss_stop - __bss_start);Quoted 7 lines
arch/arm/cpu/start.c void __naked __section(.text_ll_return) board_init_lowlevel_return(void) · line 202
Quoted 4 lines
arch/arm/cpu/start.c +4
-0+/* set 128 KiB before the STACK_BASE - 16 address for early malloc */ + free_mem_ptr =STACK_BASE -0x20000 -16 ; + free_mem_end_ptr =STACK_BASE -16 ; +This assumes that the malloc area is directly before the stack. How about using
__bss_stopor_endinstead?it's just for early alloc and
__bss_stopno so maybe we can use the same as Malloc but we already use this forHEAD_TEXT_BASE
Quoted 8 lines
Quoted 2 lines
_endisHEAD_TEXT_BASE+ the space needed for the compressed image, so what's wrong with it?the pbl image can be stored in a sram and link to fit there so
_endcould be at the end of the sramso we can not use it.
We need to put the early malloc in the sdram
HEAD_TEXT_BASE is in sdram, because it's the same as MALLOC_BASE, so _end by definition also is in sdram.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 10/12] ARM: add early malloc support needed by the decompressor
Quoted 46 lines · Sascha Hauer
Quoted 45 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 36 lines · Sascha Hauer
Quoted 35 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 33 lines · Sascha Hauer
Quoted 22 lines · Jean-Christophe PLAGNIOL-VILLARD
This is not needed by lzo but by gunzip, xz and others.
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- arch/arm/cpu/start.c | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm/cpu/start.c +3
-0@@ -28,6 +28,9 @@#include <asm-generic/memory_layout.h> #include <asm/sections.h> +unsigned long free_mem_ptr; +unsigned long free_mem_end_ptr; +#ifdef CONFIG_PBL_IMAGE void __naked __section(.text_head_entry) pbl_start(void) {arch/arm/cpu/start.c void __naked __section(.text_ll_return) board_init_lowlevel_return(void) · line 202
Quoted 7 lines
arch/arm/cpu/start.c +4
-0@@ -193,6 +196,10 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void)/* clear bss */ memset (__bss_start,0 , __bss_stop - __bss_start); +/* set 128 KiB before the STACK_BASE - 16 address for early malloc */ + free_mem_ptr =STACK_BASE -0x20000 -16 ; + free_mem_end_ptr =STACK_BASE -16 ; +This assumes that the malloc area is directly before the stack. How about using
__bss_stopor_endinstead?Quoted 5 lines
Quoted 2 lines
it's just for early alloc and
__bss_stopno so maybe we can use the same as Malloc but we already use this forHEAD_TEXT_BASE
_endisHEAD_TEXT_BASE+ the space needed for the compressed image, so what's wrong with it?the pbl image can be stored in a sram and link to fit there so
_endcould be at the end of the sram
Quoted 6 lines
Quoted 3 lines
so we can not use it.
We need to put the early malloc in the sdram
HEAD_TEXT_BASEis in sdram, because it's the same asMALLOC_BASE, so_endby definition also is in sdram.
yes but pbl fill the sram fully so in my case I put HEAD_TEXT_BASE is sram not sdram so no space for the MALLOC and MALLOC_BASE is in sdram
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 10/12] ARM: add early malloc support needed by the decompressor
Quoted 19 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 19 lines
Quoted 19 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Review
Quoted 7 lines
(quoted diff) +4
-0/* clear bss */ memset(__bss_start, 0, __bss_stop - __bss_start); + /* set 128 KiB before the STACK_BASE - 16 address for early malloc */ + free_mem_ptr = STACK_BASE - 0x20000 - 16; + free_mem_end_ptr = STACK_BASE - 16; +This assumes that the malloc area is directly before the stack. How about using
__bss_stopor_endinstead?Quoted 5 lines
Quoted 2 lines
it's just for early alloc and
__bss_stopno so maybe we can use the same as Malloc but we already use this forHEAD_TEXT_BASE
_endisHEAD_TEXT_BASE+ the space needed for the compressed image, so what's wrong with it?the pbl image can be stored in a sram and link to fit there so
_endcould be at the end of the sram
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
so we can not use it.
We need to put the early malloc in the sdram
HEAD_TEXT_BASEis in sdram, because it's the same asMALLOC_BASE, so_endby definition also is in sdram.yes but pbl fill the sram fully so in my case I put
HEAD_TEXT_BASEis sram not sdram so no space for the MALLOC andMALLOC_BASEis in sdram
Ok, then the assumption that HEAD_TEXT_BASE is always in sdram is wrong. We can live with this until you add your at91 support. Nevertheless MALLOC_BASE always is in sdram, so I suggest to use the last 128k of the malloc space for early malloc:
free_mem_ptr = MALLOC_BASE + MALLOC_SIZE - SZ_128K
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 10/12] ARM: add early malloc support needed by the decompressor
Quoted 29 lines · Sascha Hauer
Quoted 19 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 19 lines
Quoted 19 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Review
Quoted 7 lines
(quoted diff) +4
-0/* clear bss */ memset(__bss_start, 0, __bss_stop - __bss_start); + /* set 128 KiB before the STACK_BASE - 16 address for early malloc */ + free_mem_ptr = STACK_BASE - 0x20000 - 16; + free_mem_end_ptr = STACK_BASE - 16; +This assumes that the malloc area is directly before the stack. How about using
__bss_stopor_endinstead?Quoted 5 lines
Quoted 2 lines
it's just for early alloc and
__bss_stopno so maybe we can use the same as Malloc but we already use this forHEAD_TEXT_BASE
_endisHEAD_TEXT_BASE+ the space needed for the compressed image, so what's wrong with it?the pbl image can be stored in a sram and link to fit there so
_endcould be at the end of the sramQuoted 8 lines
Quoted 6 lines
Quoted 3 lines
so we can not use it.
We need to put the early malloc in the sdram
HEAD_TEXT_BASEis in sdram, because it's the same asMALLOC_BASE, so_endby definition also is in sdram.yes but pbl fill the sram fully so in my case I put
HEAD_TEXT_BASEis sram not sdram so no space for the MALLOC andMALLOC_BASEis in sdram
Quoted 6 lines
Ok, then the assumption that
HEAD_TEXT_BASEis always in sdram is wrong. We can live with this until you add your at91 support. NeverthelessMALLOC_BASEalways is in sdram, so I suggest to use the last 128k of the malloc space for early malloc:
free_mem_ptr=MALLOC_BASE+MALLOC_SIZE-SZ_128K
ok fine by me
I resend the full patch series
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 11/12 compressed image: add gzip support
In reply to Jean-Christophe PLAGNIOL-VILLARD--- arch/arm/cpu/start.c | 4 ++++ arch/arm/pbl/Makefile | 1 + arch/arm/pbl/piggy.gzip.S | 6 ++++++ common/Kconfig | 3 +++ lib/decompress_inflate.c | 1 + 5 files changed, 15 insertions(+) create mode 100644 arch/arm/pbl/piggy.gzip.S
arch/arm/cpu/start.c +4 -0
@@ -110,6 +110,10 @@ extern void *input_data_end;#include "../../../lib/decompress_unlzo.c" #endif +#ifdef CONFIG_IMAGE_COMPRESSION_GZIP +#include "../../../../lib/decompress_inflate.c" +#endif +void barebox_uncompress (void *compressed_start,unsigned int len) {void (*barebox)(void );
arch/arm/pbl/Makefile +1 -0
@@ -1,4 +1,5 @@ +suffix_$(CONFIG_IMAGE_COMPRESSION_GZIP) = gzip suffix_$(CONFIG_IMAGE_COMPRESSION_LZO) = lzo OBJCOPYFLAGS_zbarebox.bin = -O binary
arch/arm/pbl/piggy.gzip.S new file +6 -0
@@ -0,0 +1,6 @@ + .section .piggydata,#alloc + .globl input_data +input_data: + .incbin "arch/arm/compressed/piggy.gzip" + .globl input_data_end +input_data_end:
common/Kconfig +3 -0
@@ -125,6 +125,9 @@ choice config IMAGE_COMPRESSION_LZO bool "lzo" +config IMAGE_COMPRESSION_GZIP + bool "gzip" + endchoice endif
lib/decompress_inflate.c +1 -0
@@ -4,6 +4,7 @@/* prevent inclusion of _LINUX_KERNEL_H in pre-boot environment: lots * errors about console_printk etc... on ARM */ #define _LINUX_KERNEL_H +#include <linux/decompress/mm.h> #include "zlib_inflate/inftrees.c" #include "zlib_inflate/inffast.c"
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 12/12 at91: add lowlevel init to the pbl
In reply to Jean-Christophe PLAGNIOL-VILLARD--- arch/arm/mach-at91/Makefile | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-at91/Makefile +2 -0
@@ -4,6 +4,8 @@ lowlevel_init-y = at91sam926x_lowlevel_init.o lowlevel_init-$(CONFIG_ARCH_AT91RM9200) = at91rm9200_lowlevel_init.o obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += $(lowlevel_init-y) +pbl-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += $(lowlevel_init-y) + obj-$(CONFIG_AT91SAM9_RESET) += at91sam9_reset.o obj-$(CONFIG_AT91SAM9G45_RESET) += at91sam9g45_reset.o
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox