From 78867e2bbd066df7d56e281e03a8cdbe82adf4e4 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 28 Jul 2012 01:25:56 +0800 Subject: Add pre-bootloader (pbl) image support This 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 Add compressed image support patch Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/Kconfig | 1 + arch/arm/Makefile | 7 ++++ arch/arm/cpu/Makefile | 3 +- arch/arm/cpu/start-pbl.c | 80 +++++++++++++++++++++++++++++++++++++++++++++ arch/arm/cpu/start-reset.c | 67 +++++++++++++++++++++++++++++++++++++ arch/arm/cpu/start.c | 54 +++++++++--------------------- arch/arm/lib/Makefile | 4 +++ arch/arm/lib/barebox.lds.S | 3 +- arch/arm/pbl/Makefile | 25 ++++++++++++++ arch/arm/pbl/zbarebox.lds.S | 73 +++++++++++++++++++++++++++++++++++++++++ 10 files changed, 277 insertions(+), 40 deletions(-) create mode 100644 arch/arm/cpu/start-pbl.c create mode 100644 arch/arm/cpu/start-reset.c create mode 100644 arch/arm/pbl/Makefile create mode 100644 arch/arm/pbl/zbarebox.lds.S (limited to 'arch') diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 08c742bfb3..7932afc131 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -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 diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 1b60261bc8..0ea050ebed 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -197,6 +197,13 @@ 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)/$@ + +archclean: + $(MAKE) $(clean)=$(pbl) + all: $(KBUILD_IMAGE) archprepare: maketools diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile index 93a34a9ff1..78d300dba8 100644 --- a/arch/arm/cpu/Makefile +++ b/arch/arm/cpu/Makefile @@ -1,7 +1,7 @@ obj-y += cpu.o obj-$(CONFIG_ARM_EXCEPTIONS) += exceptions.o obj-$(CONFIG_ARM_EXCEPTIONS) += interrupts.o -obj-y += start.o +obj-y += start.o start-reset.o # # Any variants can be called as start-armxyz.S @@ -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-pbl.o start-reset.o diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c new file mode 100644 index 0000000000..28d6f34449 --- /dev/null +++ b/arch/arm/cpu/start-pbl.c @@ -0,0 +1,80 @@ +/* + * start-pbl.c + * + * Copyright (c) 2010-2012 Sascha Hauer , Pengutronix + * Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD + * + * 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 version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include + +void __naked __section(.text_head_entry) pbl_start(void) +{ + barebox_arm_head(); +} + +void barebox_pbl(uint32_t offset) +{ +} + +/* + * Board code can jump here by either returning from board_init_lowlevel + * or by calling this function directly. + */ +void __naked __section(.text_ll_return) board_init_lowlevel_return(void) +{ + uint32_t r, addr, offset; + + /* + * Get runtime address of this function. Do not + * put any code above this. + */ + __asm__ __volatile__("1: adr %0, 1b":"=r"(addr)); + + /* Setup the stack */ + r = STACK_BASE + STACK_SIZE - 16; + __asm__ __volatile__("mov sp, %0" : : "r"(r)); + + /* Get offset between linked address and runtime address */ + offset = (uint32_t)__ll_return - addr; + + /* relocate to link address if necessary */ + if (offset) + memcpy((void *)_text, (void *)(_text - offset), + __bss_start - _text); + + /* clear bss */ + memset(__bss_start, 0, __bss_stop - __bss_start); + + /* flush I-cache before jumping to the copied binary */ + __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); + + r = (unsigned int)&barebox_pbl; + /* call barebox_uncompress with its absolute address */ + __asm__ __volatile__( + "mov r0, %1\n" + "mov pc, %0\n" + : + : "r"(r), "r"(offset), + : "r0"); +} diff --git a/arch/arm/cpu/start-reset.c b/arch/arm/cpu/start-reset.c new file mode 100644 index 0000000000..e0df676274 --- /dev/null +++ b/arch/arm/cpu/start-reset.c @@ -0,0 +1,67 @@ +/* + * start-reset.c + * + * Copyright (c) 2010 Sascha Hauer , Pengutronix + * + * 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 version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include + +/* + * The actual reset vector. This code is position independent and usually + * does not run at the address it's linked at. + */ +void __naked __bare_init reset(void) +{ + uint32_t r; + + /* set the cpu to SVC32 mode */ + __asm__ __volatile__("mrs %0, cpsr":"=r"(r)); + r &= ~0x1f; + r |= 0xd3; + __asm__ __volatile__("msr cpsr, %0" : : "r"(r)); + +#ifdef CONFIG_ARCH_HAS_LOWLEVEL_INIT + arch_init_lowlevel(); +#endif + + /* disable MMU stuff and caches */ + r = get_cr(); + r &= ~(CR_M | CR_C | CR_B | CR_S | CR_R | CR_V); + r |= CR_I; + +#if __LINUX_ARM_ARCH__ >= 6 + r |= CR_U; +#else + r |= CR_A; +#endif + +#ifdef __ARMEB__ + r |= CR_B; +#endif + set_cr(r); + +#ifdef CONFIG_MACH_DO_LOWLEVEL_INIT + board_init_lowlevel(); +#endif + board_init_lowlevel_return(); +} diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c index 112403e33e..8365a7516f 100644 --- a/arch/arm/cpu/start.c +++ b/arch/arm/cpu/start.c @@ -24,53 +24,31 @@ #include #include #include -#include #include #include -void __naked __section(.text_entry) start(void) -{ - barebox_arm_head(); -} - +#ifdef CONFIG_PBL_IMAGE /* - * The actual reset vector. This code is position independent and usually - * does not run at the address it's linked at. + * First function in the pbl image. We get here from + * the pbl. */ -void __naked __bare_init reset(void) +void __naked __section(.text_entry) start(void) { - uint32_t r; + u32 r; - /* set the cpu to SVC32 mode */ - __asm__ __volatile__("mrs %0, cpsr":"=r"(r)); - r &= ~0x1f; - r |= 0xd3; - __asm__ __volatile__("msr cpsr, %0" : : "r"(r)); - -#ifdef CONFIG_ARCH_HAS_LOWLEVEL_INIT - arch_init_lowlevel(); -#endif - - /* disable MMU stuff and caches */ - r = get_cr(); - r &= ~(CR_M | CR_C | CR_B | CR_S | CR_R | CR_V); - r |= CR_I; + /* Setup the stack */ + r = STACK_BASE + STACK_SIZE - 16; + __asm__ __volatile__("mov sp, %0" : : "r"(r)); + /* clear bss */ + memset(__bss_start, 0, __bss_stop - __bss_start); -#if __LINUX_ARM_ARCH__ >= 6 - r |= CR_U; + start_barebox(); +} #else - r |= CR_A; -#endif - -#ifdef __ARMEB__ - r |= CR_B; -#endif - set_cr(r); -#ifdef CONFIG_MACH_DO_LOWLEVEL_INIT - board_init_lowlevel(); -#endif - board_init_lowlevel_return(); +void __naked __section(.text_entry) start(void) +{ + barebox_arm_head(); } /* @@ -109,4 +87,4 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void) r = (unsigned int)&start_barebox; __asm__ __volatile__("mov pc, %0" : : "r"(r)); } - +#endif diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 1eaf474911..9d0ff7a856 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -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 diff --git a/arch/arm/lib/barebox.lds.S b/arch/arm/lib/barebox.lds.S index e0bae70f4f..a69013f7f5 100644 --- a/arch/arm/lib/barebox.lds.S +++ b/arch/arm/lib/barebox.lds.S @@ -31,8 +31,9 @@ SECTIONS { . = TEXT_BASE; +#ifndef CONFIG_PBL_IMAGE PRE_IMAGE - +#endif . = ALIGN(4); .text : { diff --git a/arch/arm/pbl/Makefile b/arch/arm/pbl/Makefile new file mode 100644 index 0000000000..9b364bb35a --- /dev/null +++ b/arch/arm/pbl/Makefile @@ -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__) diff --git a/arch/arm/pbl/zbarebox.lds.S b/arch/arm/pbl/zbarebox.lds.S new file mode 100644 index 0000000000..b6e8028fd3 --- /dev/null +++ b/arch/arm/pbl/zbarebox.lds.S @@ -0,0 +1,73 @@ +/* + * (C) Copyright 2012 Sascha Hauer , Pengutronix + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + */ + +#include +#include + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(pbl_start) +SECTIONS +{ + . = HEAD_TEXT_BASE; + + PRE_IMAGE + + . = ALIGN(4); + .text : + { + _stext = .; + _text = .; + *(.text_head_entry*) + __ll_return = .; + *(.text_ll_return*) + __bare_init_start = .; + *(.text_bare_init*) + __bare_init_end = .; + *(.text*) + } + BAREBOX_BARE_INIT_SIZE + + . = ALIGN(4); + .rodata : { *(.rodata*) } + + _etext = .; /* End of text and rodata section */ + + . = ALIGN(4); + .data : { *(.data*) } + + . = ALIGN(4); + __bss_start = .; + .bss : { *(.bss*) } + __bss_stop = .; + _end = .; + + . = ALIGN(4); + __piggydata_start = .; + .piggydata : { + *(.piggydata) + } + __piggydata_end = .; + + _barebox_image_size = __piggydata_end - HEAD_TEXT_BASE; +} -- cgit v1.2.3 From 53391b5a8dda0b8d33b5433db21e43c82cb5246d Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Fri, 27 Jul 2012 06:03:12 +0800 Subject: pbl: discard unwind symbol if enable in barebox Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/Kconfig | 1 + arch/arm/Makefile | 4 ++++ arch/arm/pbl/Makefile | 16 ++++++++++++++-- arch/arm/pbl/piggy.lzo.S | 6 ++++++ arch/arm/pbl/zbarebox.lds.S | 4 ++++ 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 arch/arm/pbl/piggy.lzo.S (limited to 'arch') diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 7932afc131..9cba6552df 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -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 diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 0ea050ebed..be4ef308bf 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -197,6 +197,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)/$@ diff --git a/arch/arm/pbl/Makefile b/arch/arm/pbl/Makefile index 9b364bb35a..413591104f 100644 --- a/arch/arm/pbl/Makefile +++ b/arch/arm/pbl/Makefile @@ -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 diff --git a/arch/arm/pbl/piggy.lzo.S b/arch/arm/pbl/piggy.lzo.S new file mode 100644 index 0000000000..e0484c7d5c --- /dev/null +++ b/arch/arm/pbl/piggy.lzo.S @@ -0,0 +1,6 @@ + .section .piggydata,#alloc + .globl input_data +input_data: + .incbin "arch/arm/pbl/piggy.lzo" + .globl input_data_end +input_data_end: diff --git a/arch/arm/pbl/zbarebox.lds.S b/arch/arm/pbl/zbarebox.lds.S index b6e8028fd3..d58709030e 100644 --- a/arch/arm/pbl/zbarebox.lds.S +++ b/arch/arm/pbl/zbarebox.lds.S @@ -46,6 +46,10 @@ SECTIONS __bare_init_end = .; *(.text*) } + + /* Discard unwind if enable in barebox */ + /DISCARD/ : { *(.ARM.ex*) } + BAREBOX_BARE_INIT_SIZE . = ALIGN(4); -- cgit v1.2.3 From 5c3db111daa298b0fdab421e1fbd87427e9a108c Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Fri, 3 Aug 2012 17:03:01 +0800 Subject: Add compressed image support This allows for creating a lzo compressed binary unsing the pbl. Only copy the piggydata if needed. Add CONFIG_PBL_FORCE_PIGGYDATA_COPY option In some case we need to copy the PIGGYDATA as the link address as example we run from SRAM and shutdown the SDRAM/DDR for reconfiguration but most of the time we just need to copy the executable code. based on Sascha Hauer Add compressed image support Signed-off-by: Sascha Hauer Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/cpu/start-pbl.c | 59 +++++++++++++++++++++++++++++++++++++++--- arch/arm/pbl/zbarebox.lds.S | 1 + common/Kconfig | 12 ++++++++- include/asm-generic/sections.h | 2 ++ 4 files changed, 69 insertions(+), 5 deletions(-) (limited to 'arch') diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c index 28d6f34449..17e0829da3 100644 --- a/arch/arm/cpu/start-pbl.c +++ b/arch/arm/cpu/start-pbl.c @@ -33,8 +33,33 @@ void __naked __section(.text_head_entry) pbl_start(void) barebox_arm_head(); } -void barebox_pbl(uint32_t offset) +extern void *input_data; +extern void *input_data_end; + +#define STATIC static + +#ifdef CONFIG_IMAGE_COMPRESSION_LZO +#include "../../../lib/decompress_unlzo.c" +#endif + +static void barebox_uncompress(void *compressed_start, unsigned int len) { + void (*barebox)(void); + + if (IS_ENABLED(CONFIG_THUMB2_BAREBOX)) + barebox = (void *)(TEXT_BASE + 1); + else + barebox = (void *)TEXT_BASE; + + decompress((void *)compressed_start, + len, + NULL, NULL, + (void *)TEXT_BASE, NULL, NULL); + + /* flush I-cache before jumping to the uncompressed binary */ + __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); + + barebox(); } /* @@ -44,6 +69,7 @@ void barebox_pbl(uint32_t offset) void __naked __section(.text_ll_return) board_init_lowlevel_return(void) { uint32_t r, addr, offset; + uint32_t pg_start, pg_end, pg_len; /* * Get runtime address of this function. Do not @@ -58,6 +84,30 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void) /* Get offset between linked address and runtime address */ offset = (uint32_t)__ll_return - addr; + pg_start = (uint32_t)&input_data - offset; + pg_end = (uint32_t)&input_data_end - offset; + pg_len = pg_end - pg_start; + + if (IS_ENABLED(CONFIG_PBL_FORCE_PIGGYDATA_COPY)) + goto copy_piggy_link; + + /* + * Check if the piggydata binary will be overwritten + * by the uncompressed binary or by the pbl relocation + */ + if (!offset || + !((pg_start >= TEXT_BASE && pg_start < TEXT_BASE + pg_len * 4) || + ((uint32_t)_text >= pg_start && (uint32_t)_text <= pg_end))) + goto copy_link; + +copy_piggy_link: + /* + * copy piggydata binary to its link address + */ + memcpy(&input_data, (void *)pg_start, pg_len); + pg_start = (uint32_t)&input_data; + +copy_link: /* relocate to link address if necessary */ if (offset) memcpy((void *)_text, (void *)(_text - offset), @@ -69,12 +119,13 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void) /* flush I-cache before jumping to the copied binary */ __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); - r = (unsigned int)&barebox_pbl; + r = (unsigned int)&barebox_uncompress; /* call barebox_uncompress with its absolute address */ __asm__ __volatile__( "mov r0, %1\n" + "mov r1, %2\n" "mov pc, %0\n" : - : "r"(r), "r"(offset), - : "r0"); + : "r"(r), "r"(pg_start), "r"(pg_len) + : "r0", "r1"); } diff --git a/arch/arm/pbl/zbarebox.lds.S b/arch/arm/pbl/zbarebox.lds.S index d58709030e..2dca278318 100644 --- a/arch/arm/pbl/zbarebox.lds.S +++ b/arch/arm/pbl/zbarebox.lds.S @@ -74,4 +74,5 @@ SECTIONS __piggydata_end = .; _barebox_image_size = __piggydata_end - HEAD_TEXT_BASE; + _barebox_pbl_size = __bss_start - HEAD_TEXT_BASE; } diff --git a/common/Kconfig b/common/Kconfig index 7b5a3077ea..828fc050c4 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -111,11 +111,20 @@ config PBL_IMAGE bool "Pre-Bootloader image" depends on HAVE_PBL_IMAGE +config PBL_FORCE_PIGGYDATA_COPY + bool + help + In some case we need to copy the PIGGYDATA as the link address + as example we run from SRAM and shutdown the SDRAM/DDR for + reconfiguration but most of the time we just need to copy the + executable code. + if PBL_IMAGE config IMAGE_COMPRESSION - bool "Compressed image" + bool depends on HAVE_IMAGE_COMPRESSION + default y if IMAGE_COMPRESSION @@ -511,6 +520,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 diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 5484b6f004..17d5fd1ae4 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -7,8 +7,10 @@ extern char __bare_init_start[], __bare_init_end[]; extern char _end[]; extern void *_barebox_image_size; extern void *_barebox_bare_init_size; +extern void *_barebox_pbl_size; #define barebox_image_size (unsigned int)&_barebox_image_size #define barebox_bare_init_size (unsigned int)&_barebox_bare_init_size +#define barebox_pbl_size (unsigned int)&_barebox_pbl_size #endif /* _ASM_GENERIC_SECTIONS_H_ */ -- cgit v1.2.3 From 8d29296240863ce5962a3e8127f7854fdfbbd73f Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sun, 22 Jul 2012 18:09:44 +0800 Subject: ARM: add early malloc support needed by the decompressor This is not needed by lzo but by gunzip, xz and others. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/cpu/start-pbl.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'arch') diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c index 17e0829da3..dd5c483f81 100644 --- a/arch/arm/cpu/start-pbl.c +++ b/arch/arm/cpu/start-pbl.c @@ -23,11 +23,15 @@ #include #include +#include #include #include #include #include +unsigned long free_mem_ptr; +unsigned long free_mem_end_ptr; + void __naked __section(.text_head_entry) pbl_start(void) { barebox_arm_head(); @@ -46,6 +50,10 @@ static void barebox_uncompress(void *compressed_start, unsigned int len) { void (*barebox)(void); + /* set 128 KiB at the end of the MALLOC_BASE for early malloc */ + free_mem_ptr = MALLOC_BASE + MALLOC_SIZE - SZ_128K; + free_mem_end_ptr = free_mem_ptr + SZ_128K; + if (IS_ENABLED(CONFIG_THUMB2_BAREBOX)) barebox = (void *)(TEXT_BASE + 1); else -- cgit v1.2.3 From 104c39fe820a9311e4b56f5577a1dc82127484db Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sun, 22 Jul 2012 18:12:01 +0800 Subject: compressed image: add gzip support Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/cpu/start-pbl.c | 4 ++++ arch/arm/pbl/Makefile | 1 + arch/arm/pbl/piggy.gzip.S | 6 ++++++ common/Kconfig | 4 ++++ lib/decompress_inflate.c | 1 + 5 files changed, 16 insertions(+) create mode 100644 arch/arm/pbl/piggy.gzip.S (limited to 'arch') diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c index dd5c483f81..004ba6a2e6 100644 --- a/arch/arm/cpu/start-pbl.c +++ b/arch/arm/cpu/start-pbl.c @@ -46,6 +46,10 @@ extern void *input_data_end; #include "../../../lib/decompress_unlzo.c" #endif +#ifdef CONFIG_IMAGE_COMPRESSION_GZIP +#include "../../../../lib/decompress_inflate.c" +#endif + static void barebox_uncompress(void *compressed_start, unsigned int len) { void (*barebox)(void); diff --git a/arch/arm/pbl/Makefile b/arch/arm/pbl/Makefile index 413591104f..04fdffbaf1 100644 --- a/arch/arm/pbl/Makefile +++ b/arch/arm/pbl/Makefile @@ -1,4 +1,5 @@ +suffix_$(CONFIG_IMAGE_COMPRESSION_GZIP) = gzip suffix_$(CONFIG_IMAGE_COMPRESSION_LZO) = lzo OBJCOPYFLAGS_zbarebox.bin = -O binary diff --git a/arch/arm/pbl/piggy.gzip.S b/arch/arm/pbl/piggy.gzip.S new file mode 100644 index 0000000000..4a623c0c57 --- /dev/null +++ b/arch/arm/pbl/piggy.gzip.S @@ -0,0 +1,6 @@ + .section .piggydata,#alloc + .globl input_data +input_data: + .incbin "arch/arm/pbl/piggy.gzip" + .globl input_data_end +input_data_end: diff --git a/common/Kconfig b/common/Kconfig index 828fc050c4..b97392cfdb 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -134,6 +134,9 @@ choice config IMAGE_COMPRESSION_LZO bool "lzo" +config IMAGE_COMPRESSION_GZIP + bool "gzip" + endchoice endif @@ -521,6 +524,7 @@ config DEFAULT_ENVIRONMENT_COMPRESSED bool depends on DEFAULT_ENVIRONMENT depends on !IMAGE_COMPRESSION_LZO + depends on !IMAGE_COMPRESSION_GZIP default y if ZLIB default y if BZLIB default y if LZO_DECOMPRESS diff --git a/lib/decompress_inflate.c b/lib/decompress_inflate.c index 526d6a173f..5c1ebb6850 100644 --- a/lib/decompress_inflate.c +++ b/lib/decompress_inflate.c @@ -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 #include "zlib_inflate/inftrees.c" #include "zlib_inflate/inffast.c" -- cgit v1.2.3 From 2765ecdd2de0c1a549b1c88d801a284194814de1 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 3 Aug 2012 08:52:44 +0200 Subject: ARM pbl: Add .gitignore for generated files Signed-off-by: Sascha Hauer Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/pbl/.gitignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 arch/arm/pbl/.gitignore (limited to 'arch') diff --git a/arch/arm/pbl/.gitignore b/arch/arm/pbl/.gitignore new file mode 100644 index 0000000000..3384d8b3c1 --- /dev/null +++ b/arch/arm/pbl/.gitignore @@ -0,0 +1,5 @@ +piggy.gzip +piggy.lzo +zbarebox +zbarebox.bin +zbarebox.lds -- cgit v1.2.3 From db8a8e21299e56732b18fa03b8d058fabf4c3487 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Wed, 25 Jul 2012 15:25:46 +0800 Subject: at91: add lowlevel init to the pbl Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/mach-at91/Makefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch') diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 491c45446c..3ade725778 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -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 -- cgit v1.2.3 From 1d861eb2a6384495261122f183842fcd8a8e059e Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 28 Jul 2012 19:23:55 +0800 Subject: arm: always enable the garbage collector for pbl This allow to save arround 1KiB on at91 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/pbl/Makefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch') diff --git a/arch/arm/pbl/Makefile b/arch/arm/pbl/Makefile index 04fdffbaf1..143da8bc98 100644 --- a/arch/arm/pbl/Makefile +++ b/arch/arm/pbl/Makefile @@ -19,7 +19,9 @@ $(obj)/zbarebox.bin: $(obj)/zbarebox FORCE $(obj)/zbarebox.S: $(obj)/zbarebox FORCE $(call if_changed,disasm) +PBL_CPPFLAGS += -fdata-sections -ffunction-sections LDFLAGS_zbarebox := -Map zbarebox.map +LDFLAGS_zbarebox += -static --gc-sections zbarebox-common := $(barebox-pbl-common) $(obj)/$(piggy_o) zbarebox-lds := $(obj)/zbarebox.lds -- cgit v1.2.3 From b61544556474e8a39e1ecbe0b5d27a5fbca9b42d Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sun, 12 Aug 2012 16:09:23 +0200 Subject: Makefile: generate a barebox-flash-image link Depending on the SoC a barebox.bin, barebox.netx, barebox.s5p, MLO image is generated. With pbl support there now is an additional arch/arm/pbl/zbarebox.bin image. To help the user to determine which image should be flashed to his device, generate a barebox-flash-image link. Signed-off-by: Sascha Hauer Acked-by: Jean-Christophe PLAGNIOL-VILLARD --- Makefile | 15 +++++++-------- arch/arm/Makefile | 2 -- arch/blackfin/Makefile | 2 +- arch/mips/Makefile | 2 -- arch/x86/Makefile | 5 ----- 5 files changed, 8 insertions(+), 18 deletions(-) (limited to 'arch') diff --git a/Makefile b/Makefile index 06a94c34e5..a084db3341 100644 --- a/Makefile +++ b/Makefile @@ -437,12 +437,6 @@ else include/config/auto.conf: ; endif # $(dot-config) -# The all: target is the default when no target is given on the -# command line. -# This allow a user to issue only 'make' to build a kernel -# Defaults barebox but it is usually overridden in the arch makefile -all: barebox.bin - include $(srctree)/arch/$(ARCH)/Makefile ifdef CONFIG_DEBUG_INFO @@ -473,7 +467,12 @@ CFLAGS += $(call cc-option,-Wno-pointer-sign,) # set in the environment # Also any assignments in arch/$(ARCH)/Makefile take precedence over # this default value -export KBUILD_IMAGE ?= barebox +export KBUILD_IMAGE ?= barebox.bin + +barebox-flash-image: $(KBUILD_IMAGE) + $(call if_changed,ln) + +all: barebox-flash-image common-$(CONFIG_PBL_IMAGE) += pbl/ @@ -1009,7 +1008,7 @@ CLEAN_DIRS += $(MODVERDIR) CLEAN_FILES += barebox System.map include/generated/barebox_default_env.h \ .tmp_version .tmp_barebox* barebox.bin barebox.map barebox.S \ .tmp_kallsyms* barebox_default_env* barebox.ldr \ - scripts/bareboxenv-target \ + scripts/bareboxenv-target barebox-flash-image \ Doxyfile.version barebox.srec barebox.s5p # Directories & files removed with 'make mrproper' diff --git a/arch/arm/Makefile b/arch/arm/Makefile index be4ef308bf..1362b3192b 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -208,8 +208,6 @@ zbarebox.S zbarebox.bin zbarebox: barebox.bin archclean: $(MAKE) $(clean)=$(pbl) -all: $(KBUILD_IMAGE) - archprepare: maketools maketools: $(Q)$(MAKE) $(build)=arch/arm/tools include/generated/mach-types.h diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile index a0b87f77d7..381c6a9f39 100644 --- a/arch/blackfin/Makefile +++ b/arch/blackfin/Makefile @@ -13,7 +13,7 @@ CFLAGS += -D__blackfin__ KALLSYMS += --symbol-prefix=_ ifndef CONFIG_BFIN_BOOT_BYPASS -all: barebox.ldr +KBUILD_IMAGE := barebox.ldr endif archprepare: maketools diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 6b7dae9faf..5e40de760f 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -82,8 +82,6 @@ incdir-y := $(machine-y) endif INCDIR := arch-$(incdir-y) -all: $(KBUILD_IMAGE) - ifneq ($(board-y),) BOARD := arch/mips/boards/$(board-y)/ else diff --git a/arch/x86/Makefile b/arch/x86/Makefile index db4180b32b..518b37fe2f 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -14,11 +14,6 @@ CPPFLAGS += -fdata-sections -ffunction-sections LDFLAGS_uboot += -static --gc-sections endif -all: $(KBUILD_IMAGE) - - - - machdirs := $(patsubst %,arch/x86/mach-%/,$(machine-y)) ifeq ($(KBUILD_SRC),) -- cgit v1.2.3 From 5022723a7db637c8efe544cad2fe4048c89ac9a2 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 6 Aug 2012 09:26:22 +0200 Subject: ARM eukrea cpuimx25: Move flash_header to seperate file The flash header is needed for pbl support, so move it to separate file to be able to add it to pbl-y Signed-off-by: Sascha Hauer Acked-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/boards/eukrea_cpuimx25/Makefile | 1 + arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 34 ------------- arch/arm/boards/eukrea_cpuimx25/flash_header.c | 61 +++++++++++++++++++++++ 3 files changed, 62 insertions(+), 34 deletions(-) create mode 100644 arch/arm/boards/eukrea_cpuimx25/flash_header.c (limited to 'arch') diff --git a/arch/arm/boards/eukrea_cpuimx25/Makefile b/arch/arm/boards/eukrea_cpuimx25/Makefile index 406c6f32f7..edd09a6275 100644 --- a/arch/arm/boards/eukrea_cpuimx25/Makefile +++ b/arch/arm/boards/eukrea_cpuimx25/Makefile @@ -22,3 +22,4 @@ obj-y += lowlevel.o obj-y += eukrea_cpuimx25.o +obj-$(CONFIG_ARCH_IMX_INTERNAL_BOOT) += flash_header.o diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c index 0aac13c988..a84288cca3 100644 --- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c @@ -50,40 +50,6 @@ #include #include -void __naked __flash_header_start go(void) -{ - barebox_arm_head(); -} - -struct imx_dcd_entry __dcd_entry_section dcd_entry[] = { - { .ptr_type = 4, .addr = 0xb8001010, .val = 0x00000004, }, - { .ptr_type = 4, .addr = 0xb8001000, .val = 0x92100000, }, - { .ptr_type = 1, .addr = 0x80000400, .val = 0x12344321, }, - { .ptr_type = 4, .addr = 0xb8001000, .val = 0xa2100000, }, - { .ptr_type = 4, .addr = 0x80000000, .val = 0x12344321, }, - { .ptr_type = 4, .addr = 0x80000000, .val = 0x12344321, }, - { .ptr_type = 4, .addr = 0xb8001000, .val = 0xb2100000, }, - { .ptr_type = 1, .addr = 0x80000033, .val = 0xda, }, - { .ptr_type = 1, .addr = 0x81000000, .val = 0xff, }, - { .ptr_type = 4, .addr = 0xb8001000, .val = 0x82216080, }, - { .ptr_type = 4, .addr = 0xb8001004, .val = 0x00295729, }, - { .ptr_type = 4, .addr = 0x53f80008, .val = 0x20034000, }, -}; - -struct imx_flash_header __flash_header_section flash_header = { - .app_code_jump_vector = DEST_BASE + 0x1000, - .app_code_barker = APP_CODE_BARKER, - .app_code_csf = 0, - .dcd_ptr_ptr = FLASH_HEADER_BASE + offsetof(struct imx_flash_header, dcd), - .super_root_key = 0, - .dcd = FLASH_HEADER_BASE + offsetof(struct imx_flash_header, dcd_barker), - .app_dest = DEST_BASE, - .dcd_barker = DCD_BARKER, - .dcd_block_len = sizeof(dcd_entry), -}; - -unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE; - static struct fec_platform_data fec_info = { .xcv_type = RMII, .phy_addr = 0, diff --git a/arch/arm/boards/eukrea_cpuimx25/flash_header.c b/arch/arm/boards/eukrea_cpuimx25/flash_header.c new file mode 100644 index 0000000000..344c7ffc13 --- /dev/null +++ b/arch/arm/boards/eukrea_cpuimx25/flash_header.c @@ -0,0 +1,61 @@ +/* + * (C) 2009 Pengutronix, Sascha Hauer + * (c) 2010 Eukrea Electromatique, Eric BĂ©nard + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + */ +#include +#include +#include +#include + +void __naked __flash_header_start go(void) +{ + barebox_arm_head(); +} + +struct imx_dcd_entry __dcd_entry_section dcd_entry[] = { + { .ptr_type = 4, .addr = 0xb8001010, .val = 0x00000004, }, + { .ptr_type = 4, .addr = 0xb8001000, .val = 0x92100000, }, + { .ptr_type = 1, .addr = 0x80000400, .val = 0x12344321, }, + { .ptr_type = 4, .addr = 0xb8001000, .val = 0xa2100000, }, + { .ptr_type = 4, .addr = 0x80000000, .val = 0x12344321, }, + { .ptr_type = 4, .addr = 0x80000000, .val = 0x12344321, }, + { .ptr_type = 4, .addr = 0xb8001000, .val = 0xb2100000, }, + { .ptr_type = 1, .addr = 0x80000033, .val = 0xda, }, + { .ptr_type = 1, .addr = 0x81000000, .val = 0xff, }, + { .ptr_type = 4, .addr = 0xb8001000, .val = 0x82216080, }, + { .ptr_type = 4, .addr = 0xb8001004, .val = 0x00295729, }, + { .ptr_type = 4, .addr = 0x53f80008, .val = 0x20034000, }, +}; + +struct imx_flash_header __flash_header_section flash_header = { + .app_code_jump_vector = DEST_BASE + 0x1000, + .app_code_barker = APP_CODE_BARKER, + .app_code_csf = 0, + .dcd_ptr_ptr = FLASH_HEADER_BASE + offsetof(struct imx_flash_header, dcd), + .super_root_key = 0, + .dcd = FLASH_HEADER_BASE + offsetof(struct imx_flash_header, dcd_barker), + .app_dest = DEST_BASE, + .dcd_barker = DCD_BARKER, + .dcd_block_len = sizeof(dcd_entry), +}; + +unsigned long __image_len_section barebox_len = DCD_BAREBOX_SIZE; -- cgit v1.2.3 From 6478566b2de99484de1616bde9e5cd142b39265d Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 6 Aug 2012 22:26:40 +0200 Subject: ARM s3c boards: Do not hardcode image sizes The existing nand_boot functions all do the same, so move it to a common place. To be flexible enough for future boards the real image size is used instead of hardcoded 256k. Signed-off-by: Sascha Hauer Acked-by: Juergen Beisert Acked-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/boards/a9m2410/a9m2410.c | 7 ------- arch/arm/boards/a9m2440/a9m2440.c | 7 ------- arch/arm/boards/friendlyarm-mini2440/mini2440.c | 7 ------- drivers/mtd/nand/nand_s3c24xx.c | 10 ++++++++++ 4 files changed, 10 insertions(+), 21 deletions(-) (limited to 'arch') diff --git a/arch/arm/boards/a9m2410/a9m2410.c b/arch/arm/boards/a9m2410/a9m2410.c index fb3f1baf10..8d97282756 100644 --- a/arch/arm/boards/a9m2410/a9m2410.c +++ b/arch/arm/boards/a9m2410/a9m2410.c @@ -137,13 +137,6 @@ static int a9m2410_devices_init(void) device_initcall(a9m2410_devices_init); -#ifdef CONFIG_S3C_NAND_BOOT -void __bare_init nand_boot(void) -{ - s3c24x0_nand_load_image(_text, 256 * 1024, 0); -} -#endif - static int a9m2410_console_init(void) { s3c24xx_add_uart1(); diff --git a/arch/arm/boards/a9m2440/a9m2440.c b/arch/arm/boards/a9m2440/a9m2440.c index 6beb72eb71..ac1c7a491a 100644 --- a/arch/arm/boards/a9m2440/a9m2440.c +++ b/arch/arm/boards/a9m2440/a9m2440.c @@ -156,13 +156,6 @@ static int a9m2440_devices_init(void) device_initcall(a9m2440_devices_init); -#ifdef CONFIG_S3C_NAND_BOOT -void __bare_init nand_boot(void) -{ - s3c24x0_nand_load_image(_text, 256 * 1024, 0); -} -#endif - static int a9m2440_console_init(void) { s3c24xx_add_uart1(); diff --git a/arch/arm/boards/friendlyarm-mini2440/mini2440.c b/arch/arm/boards/friendlyarm-mini2440/mini2440.c index a032fbc053..251287ee20 100644 --- a/arch/arm/boards/friendlyarm-mini2440/mini2440.c +++ b/arch/arm/boards/friendlyarm-mini2440/mini2440.c @@ -324,13 +324,6 @@ static int mini2440_devices_init(void) device_initcall(mini2440_devices_init); -#ifdef CONFIG_S3C_NAND_BOOT -void __bare_init nand_boot(void) -{ - s3c24x0_nand_load_image(_text, 256 * 1024, 0); -} -#endif - static int mini2440_console_init(void) { /* diff --git a/drivers/mtd/nand/nand_s3c24xx.c b/drivers/mtd/nand/nand_s3c24xx.c index c6297011a3..3d5732e02a 100644 --- a/drivers/mtd/nand/nand_s3c24xx.c +++ b/drivers/mtd/nand/nand_s3c24xx.c @@ -603,6 +603,16 @@ void __nand_boot_init s3c24x0_nand_load_image(void *dest, int size, int page) disable_nand_controller(host); } +#include + +void __nand_boot_init nand_boot(void) +{ + void *dest = _text; + int size = barebox_image_size; + int page = 0; + + s3c24x0_nand_load_image(dest, size, page); +} #ifdef CONFIG_NAND_S3C_BOOT_DEBUG #include -- cgit v1.2.3 From 95423f8af2ad471a60bf0f98e4fddbfaaf23cef2 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 2 Aug 2012 17:16:35 +0200 Subject: ARM boards: Make boards pbl safe With pbl support enabled most boards need a pbl-y for their lowlevel stuff. Signed-off-by: Sascha Hauer Acked-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/boards/a9m2410/Makefile | 1 + arch/arm/boards/a9m2440/Makefile | 1 + arch/arm/boards/ccxmx51/Makefile | 1 + arch/arm/boards/edb93xx/Makefile | 1 + arch/arm/boards/eukrea_cpuimx25/Makefile | 2 ++ arch/arm/boards/eukrea_cpuimx27/Makefile | 1 + arch/arm/boards/eukrea_cpuimx35/Makefile | 2 ++ arch/arm/boards/eukrea_cpuimx51/Makefile | 1 + arch/arm/boards/freescale-mx25-3-stack/Makefile | 1 + arch/arm/boards/freescale-mx35-3-stack/Makefile | 2 ++ arch/arm/boards/freescale-mx51-pdk/Makefile | 1 + arch/arm/boards/freescale-mx53-loco/Makefile | 1 + arch/arm/boards/freescale-mx53-smd/Makefile | 1 + arch/arm/boards/freescale-mx6-arm2/Makefile | 1 + arch/arm/boards/freescale-mx6-sabrelite/Makefile | 1 + arch/arm/boards/friendlyarm-mini2440/Makefile | 1 + arch/arm/boards/guf-cupid/Makefile | 1 + arch/arm/boards/guf-neso/Makefile | 3 +-- arch/arm/boards/imx21ads/Makefile | 1 + arch/arm/boards/imx27ads/Makefile | 1 + arch/arm/boards/karo-tx25/Makefile | 1 + arch/arm/boards/karo-tx51/Makefile | 3 ++- arch/arm/boards/netx/Makefile | 2 +- arch/arm/boards/panda/Makefile | 4 +++- arch/arm/boards/pcm027/Makefile | 1 + arch/arm/boards/pcm037/Makefile | 1 + arch/arm/boards/pcm038/Makefile | 1 + arch/arm/boards/pcm043/Makefile | 1 + arch/arm/boards/pcm049/Makefile | 1 + arch/arm/boards/phycard-a-xl2/Makefile | 1 + arch/arm/boards/phycard-i.MX27/Makefile | 1 + arch/arm/boards/scb9328/Makefile | 1 + arch/arm/boards/tqma53/Makefile | 1 + arch/arm/mach-ep93xx/Makefile | 1 + arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-omap/Makefile | 3 +++ arch/arm/mach-samsung/Makefile | 2 ++ drivers/mtd/nand/Makefile | 1 + 38 files changed, 47 insertions(+), 5 deletions(-) (limited to 'arch') diff --git a/arch/arm/boards/a9m2410/Makefile b/arch/arm/boards/a9m2410/Makefile index 63026f08b2..6842c844b2 100644 --- a/arch/arm/boards/a9m2410/Makefile +++ b/arch/arm/boards/a9m2410/Makefile @@ -1,3 +1,4 @@ obj-y += lowlevel_init.o +pbl-y += lowlevel_init.o obj-y += a9m2410.o diff --git a/arch/arm/boards/a9m2440/Makefile b/arch/arm/boards/a9m2440/Makefile index 779e83dc03..8a8f36df02 100644 --- a/arch/arm/boards/a9m2440/Makefile +++ b/arch/arm/boards/a9m2440/Makefile @@ -1,4 +1,5 @@ obj-y += lowlevel_init.o +pbl-y += lowlevel_init.o obj-y += a9m2440.o obj-$(CONFIG_MACH_A9M2410DEV) += a9m2410dev.o diff --git a/arch/arm/boards/ccxmx51/Makefile b/arch/arm/boards/ccxmx51/Makefile index 249927ef2e..f9eb2db14e 100644 --- a/arch/arm/boards/ccxmx51/Makefile +++ b/arch/arm/boards/ccxmx51/Makefile @@ -1,2 +1,3 @@ obj-y += flash_header.o ccxmx51.o +pbl-y += flash_header.o obj-$(CONFIG_MACH_CCMX51_BASEBOARD) += ccxmx51js.o diff --git a/arch/arm/boards/edb93xx/Makefile b/arch/arm/boards/edb93xx/Makefile index e19cd7b4c2..945c963ffd 100644 --- a/arch/arm/boards/edb93xx/Makefile +++ b/arch/arm/boards/edb93xx/Makefile @@ -1,2 +1,3 @@ obj-y += edb93xx.o flash_cfg.o pll_cfg.o sdram_cfg.o +pbl-y += edb93xx.o flash_cfg.o pll_cfg.o sdram_cfg.o diff --git a/arch/arm/boards/eukrea_cpuimx25/Makefile b/arch/arm/boards/eukrea_cpuimx25/Makefile index edd09a6275..cc01cf985b 100644 --- a/arch/arm/boards/eukrea_cpuimx25/Makefile +++ b/arch/arm/boards/eukrea_cpuimx25/Makefile @@ -21,5 +21,7 @@ # obj-y += lowlevel.o +pbl-y += lowlevel.o obj-y += eukrea_cpuimx25.o obj-$(CONFIG_ARCH_IMX_INTERNAL_BOOT) += flash_header.o +pbl-$(CONFIG_ARCH_IMX_INTERNAL_BOOT) += flash_header.o diff --git a/arch/arm/boards/eukrea_cpuimx27/Makefile b/arch/arm/boards/eukrea_cpuimx27/Makefile index 5d958fa9aa..fe6d376159 100644 --- a/arch/arm/boards/eukrea_cpuimx27/Makefile +++ b/arch/arm/boards/eukrea_cpuimx27/Makefile @@ -1,3 +1,4 @@ obj-y += lowlevel_init.o +pbl-y += lowlevel_init.o obj-y += eukrea_cpuimx27.o diff --git a/arch/arm/boards/eukrea_cpuimx35/Makefile b/arch/arm/boards/eukrea_cpuimx35/Makefile index 32ffe42cb1..234c1bab12 100644 --- a/arch/arm/boards/eukrea_cpuimx35/Makefile +++ b/arch/arm/boards/eukrea_cpuimx35/Makefile @@ -21,5 +21,7 @@ # obj-y += lowlevel.o +pbl-y += lowlevel.o obj-y += eukrea_cpuimx35.o obj-$(CONFIG_ARCH_IMX_INTERNAL_BOOT) += flash_header.o +pbl-$(CONFIG_ARCH_IMX_INTERNAL_BOOT) += flash_header.o diff --git a/arch/arm/boards/eukrea_cpuimx51/Makefile b/arch/arm/boards/eukrea_cpuimx51/Makefile index 0f781c0f34..ce81ffa207 100644 --- a/arch/arm/boards/eukrea_cpuimx51/Makefile +++ b/arch/arm/boards/eukrea_cpuimx51/Makefile @@ -1,2 +1,3 @@ obj-y += eukrea_cpuimx51.o obj-y += flash_header.o +pbl-y += flash_header.o diff --git a/arch/arm/boards/freescale-mx25-3-stack/Makefile b/arch/arm/boards/freescale-mx25-3-stack/Makefile index ab853e0d6b..ff70e1b66c 100644 --- a/arch/arm/boards/freescale-mx25-3-stack/Makefile +++ b/arch/arm/boards/freescale-mx25-3-stack/Makefile @@ -21,4 +21,5 @@ # obj-y += lowlevel_init.o +pbl-y += lowlevel_init.o obj-y += 3stack.o diff --git a/arch/arm/boards/freescale-mx35-3-stack/Makefile b/arch/arm/boards/freescale-mx35-3-stack/Makefile index a8ea4a3d66..3f224f6ad2 100644 --- a/arch/arm/boards/freescale-mx35-3-stack/Makefile +++ b/arch/arm/boards/freescale-mx35-3-stack/Makefile @@ -1,4 +1,6 @@ obj-y += lowlevel_init.o +pbl-y += lowlevel_init.o obj-y += 3stack.o obj-$(CONFIG_ARCH_IMX_INTERNAL_BOOT) += flash_header.o +pbl-$(CONFIG_ARCH_IMX_INTERNAL_BOOT) += flash_header.o diff --git a/arch/arm/boards/freescale-mx51-pdk/Makefile b/arch/arm/boards/freescale-mx51-pdk/Makefile index b56ce7f50d..d08bb68a5c 100644 --- a/arch/arm/boards/freescale-mx51-pdk/Makefile +++ b/arch/arm/boards/freescale-mx51-pdk/Makefile @@ -1,2 +1,3 @@ obj-y += board.o obj-y += flash_header.o +pbl-y += flash_header.o diff --git a/arch/arm/boards/freescale-mx53-loco/Makefile b/arch/arm/boards/freescale-mx53-loco/Makefile index b56ce7f50d..d08bb68a5c 100644 --- a/arch/arm/boards/freescale-mx53-loco/Makefile +++ b/arch/arm/boards/freescale-mx53-loco/Makefile @@ -1,2 +1,3 @@ obj-y += board.o obj-y += flash_header.o +pbl-y += flash_header.o diff --git a/arch/arm/boards/freescale-mx53-smd/Makefile b/arch/arm/boards/freescale-mx53-smd/Makefile index b56ce7f50d..d08bb68a5c 100644 --- a/arch/arm/boards/freescale-mx53-smd/Makefile +++ b/arch/arm/boards/freescale-mx53-smd/Makefile @@ -1,2 +1,3 @@ obj-y += board.o obj-y += flash_header.o +pbl-y += flash_header.o diff --git a/arch/arm/boards/freescale-mx6-arm2/Makefile b/arch/arm/boards/freescale-mx6-arm2/Makefile index ad2e1beb99..11199d252c 100644 --- a/arch/arm/boards/freescale-mx6-arm2/Makefile +++ b/arch/arm/boards/freescale-mx6-arm2/Makefile @@ -1 +1,2 @@ obj-y += board.o flash_header.o +pbl-y += flash_header.o diff --git a/arch/arm/boards/freescale-mx6-sabrelite/Makefile b/arch/arm/boards/freescale-mx6-sabrelite/Makefile index ad2e1beb99..11199d252c 100644 --- a/arch/arm/boards/freescale-mx6-sabrelite/Makefile +++ b/arch/arm/boards/freescale-mx6-sabrelite/Makefile @@ -1 +1,2 @@ obj-y += board.o flash_header.o +pbl-y += flash_header.o diff --git a/arch/arm/boards/friendlyarm-mini2440/Makefile b/arch/arm/boards/friendlyarm-mini2440/Makefile index 856fed092e..f56e80382a 100644 --- a/arch/arm/boards/friendlyarm-mini2440/Makefile +++ b/arch/arm/boards/friendlyarm-mini2440/Makefile @@ -1,2 +1,3 @@ obj-y += mini2440.o lowlevel_init.o +pbl-y += lowlevel_init.o diff --git a/arch/arm/boards/guf-cupid/Makefile b/arch/arm/boards/guf-cupid/Makefile index 3a06cf406b..69208aa498 100644 --- a/arch/arm/boards/guf-cupid/Makefile +++ b/arch/arm/boards/guf-cupid/Makefile @@ -21,4 +21,5 @@ # obj-y += lowlevel.o +pbl-y += lowlevel.o obj-y += board.o diff --git a/arch/arm/boards/guf-neso/Makefile b/arch/arm/boards/guf-neso/Makefile index 2b6eb02595..89f0aba1af 100644 --- a/arch/arm/boards/guf-neso/Makefile +++ b/arch/arm/boards/guf-neso/Makefile @@ -1,5 +1,4 @@ - obj-y += lowlevel.o +pbl-y += lowlevel.o obj-y += board.o obj-y += pll_init.o - diff --git a/arch/arm/boards/imx21ads/Makefile b/arch/arm/boards/imx21ads/Makefile index 7993fdef8a..e18f7d9c3c 100644 --- a/arch/arm/boards/imx21ads/Makefile +++ b/arch/arm/boards/imx21ads/Makefile @@ -1,2 +1,3 @@ obj-y += lowlevel_init.o +pbl-y += lowlevel_init.o obj-y += imx21ads.o diff --git a/arch/arm/boards/imx27ads/Makefile b/arch/arm/boards/imx27ads/Makefile index bdc905f0ef..88d1baf619 100644 --- a/arch/arm/boards/imx27ads/Makefile +++ b/arch/arm/boards/imx27ads/Makefile @@ -1,3 +1,4 @@ obj-y += lowlevel_init.o +pbl-y += lowlevel_init.o obj-y += imx27ads.o diff --git a/arch/arm/boards/karo-tx25/Makefile b/arch/arm/boards/karo-tx25/Makefile index e909a2c172..90f244b872 100644 --- a/arch/arm/boards/karo-tx25/Makefile +++ b/arch/arm/boards/karo-tx25/Makefile @@ -21,4 +21,5 @@ # obj-y += lowlevel.o +pbl-y += lowlevel.o obj-y += board.o diff --git a/arch/arm/boards/karo-tx51/Makefile b/arch/arm/boards/karo-tx51/Makefile index e8f710e1ac..6f51586e53 100644 --- a/arch/arm/boards/karo-tx51/Makefile +++ b/arch/arm/boards/karo-tx51/Makefile @@ -1,2 +1,3 @@ obj-y += tx51.o -obj-y += flash_header.o +obj-$(CONFIG_ARCH_IMX_INTERNAL_BOOT) += flash_header.o +pbl-$(CONFIG_ARCH_IMX_INTERNAL_BOOT) += flash_header.o diff --git a/arch/arm/boards/netx/Makefile b/arch/arm/boards/netx/Makefile index 8b33fec316..ad694cd272 100644 --- a/arch/arm/boards/netx/Makefile +++ b/arch/arm/boards/netx/Makefile @@ -1,2 +1,2 @@ obj-y += netx.o platform.o - +pbl-y += platform.o diff --git a/arch/arm/boards/panda/Makefile b/arch/arm/boards/panda/Makefile index c55e26e066..53b9d5b88b 100644 --- a/arch/arm/boards/panda/Makefile +++ b/arch/arm/boards/panda/Makefile @@ -1 +1,3 @@ -obj-y += board.o lowlevel.o mux.o +obj-y += board.o +obj-y += lowlevel.o mux.o +pbl-y += lowlevel.o mux.o diff --git a/arch/arm/boards/pcm027/Makefile b/arch/arm/boards/pcm027/Makefile index e3830e4f19..1602c0a572 100644 --- a/arch/arm/boards/pcm027/Makefile +++ b/arch/arm/boards/pcm027/Makefile @@ -1,2 +1,3 @@ obj-y += board.o obj-y += lowlevel_init.o +pbl-y += lowlevel_init.o diff --git a/arch/arm/boards/pcm037/Makefile b/arch/arm/boards/pcm037/Makefile index 7d36b77df0..dfe180c8d1 100644 --- a/arch/arm/boards/pcm037/Makefile +++ b/arch/arm/boards/pcm037/Makefile @@ -21,4 +21,5 @@ # obj-y += lowlevel_init.o +pbl-y += lowlevel_init.o obj-y += pcm037.o diff --git a/arch/arm/boards/pcm038/Makefile b/arch/arm/boards/pcm038/Makefile index 6cd3a5b6c6..2c1b74d306 100644 --- a/arch/arm/boards/pcm038/Makefile +++ b/arch/arm/boards/pcm038/Makefile @@ -1,2 +1,3 @@ obj-y += lowlevel.o pcm038.o +pbl-y += lowlevel.o obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970.o diff --git a/arch/arm/boards/pcm043/Makefile b/arch/arm/boards/pcm043/Makefile index 6753bbe81a..961ffcc3a4 100644 --- a/arch/arm/boards/pcm043/Makefile +++ b/arch/arm/boards/pcm043/Makefile @@ -21,4 +21,5 @@ # obj-y += lowlevel.o +pbl-y += lowlevel.o obj-y += pcm043.o diff --git a/arch/arm/boards/pcm049/Makefile b/arch/arm/boards/pcm049/Makefile index 1bb7212a32..df3764ca6a 100644 --- a/arch/arm/boards/pcm049/Makefile +++ b/arch/arm/boards/pcm049/Makefile @@ -1 +1,2 @@ obj-y += board.o mux.o lowlevel.o +pbl-y += lowlevel.o mux.o diff --git a/arch/arm/boards/phycard-a-xl2/Makefile b/arch/arm/boards/phycard-a-xl2/Makefile index 1d23d72ddc..23958c2f8f 100644 --- a/arch/arm/boards/phycard-a-xl2/Makefile +++ b/arch/arm/boards/phycard-a-xl2/Makefile @@ -18,3 +18,4 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA obj-y += pca-a-xl2.o mux.o lowlevel.o +pbl-y += mux.o lowlevel.o diff --git a/arch/arm/boards/phycard-i.MX27/Makefile b/arch/arm/boards/phycard-i.MX27/Makefile index fd52350fbb..60253e55b9 100644 --- a/arch/arm/boards/phycard-i.MX27/Makefile +++ b/arch/arm/boards/phycard-i.MX27/Makefile @@ -1,3 +1,4 @@ obj-y += lowlevel_init.o +pbl-y += lowlevel_init.o obj-y += pca100.o diff --git a/arch/arm/boards/scb9328/Makefile b/arch/arm/boards/scb9328/Makefile index db6fd7ec37..69d3970223 100644 --- a/arch/arm/boards/scb9328/Makefile +++ b/arch/arm/boards/scb9328/Makefile @@ -1,3 +1,4 @@ obj-y += lowlevel_init.o +pbl-y += lowlevel_init.o obj-y += scb9328.o diff --git a/arch/arm/boards/tqma53/Makefile b/arch/arm/boards/tqma53/Makefile index b56ce7f50d..d08bb68a5c 100644 --- a/arch/arm/boards/tqma53/Makefile +++ b/arch/arm/boards/tqma53/Makefile @@ -1,2 +1,3 @@ obj-y += board.o obj-y += flash_header.o +pbl-y += flash_header.o diff --git a/arch/arm/mach-ep93xx/Makefile b/arch/arm/mach-ep93xx/Makefile index d401164e4a..5615394791 100644 --- a/arch/arm/mach-ep93xx/Makefile +++ b/arch/arm/mach-ep93xx/Makefile @@ -1,3 +1,4 @@ obj-y += clocksource.o gpio.o led.o header.o obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o +pbl-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += lowlevel_init.o led.o diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 2ff537ab89..82a86d74b8 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_IMX_CLKO) += clko.o obj-$(CONFIG_IMX_IIM) += iim.o obj-$(CONFIG_NAND_IMX) += nand.o obj-$(CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND) += external-nand-boot.o +pbl-$(CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND) += external-nand-boot.o obj-y += speed.o obj-y += devices.o obj-y += boot.o diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile index 87078ae6d5..f087f4b765 100644 --- a/arch/arm/mach-omap/Makefile +++ b/arch/arm/mach-omap/Makefile @@ -20,9 +20,12 @@ # MA 02111-1307 USA # obj-$(CONFIG_ARCH_OMAP) += syslib.o +pbl-$(CONFIG_ARCH_OMAP) += syslib.o obj-$(CONFIG_OMAP_CLOCK_SOURCE_S32K) += s32k_clksource.o obj-$(CONFIG_ARCH_OMAP3) += omap3_core.o omap3_generic.o auxcr.o +pbl-$(CONFIG_ARCH_OMAP3) += omap3_core.o omap3_generic.o auxcr.o obj-$(CONFIG_ARCH_OMAP4) += omap4_generic.o omap4_clock.o +pbl-$(CONFIG_ARCH_OMAP4) += omap4_generic.o omap4_clock.o obj-$(CONFIG_OMAP3_CLOCK_CONFIG) += omap3_clock.o obj-$(CONFIG_OMAP_GPMC) += gpmc.o devices-gpmc-nand.o obj-$(CONFIG_SHELL_NONE) += xload.o diff --git a/arch/arm/mach-samsung/Makefile b/arch/arm/mach-samsung/Makefile index 39aa26957b..0ffe3705ef 100644 --- a/arch/arm/mach-samsung/Makefile +++ b/arch/arm/mach-samsung/Makefile @@ -2,6 +2,8 @@ obj-y += s3c-timer.o generic.o obj-$(CONFIG_RESET_SOURCE) += reset_source.o obj-lowlevel-$(CONFIG_ARCH_S3C24xx) += lowlevel-s3c24x0.o obj-lowlevel-$(CONFIG_ARCH_S5PCxx) += lowlevel-s5pcxx.o +pbl-$(CONFIG_ARCH_S3C24xx) += lowlevel-s3c24x0.o +pbl-$(CONFIG_ARCH_S5PCxx) += lowlevel-s5pcxx.o obj-$(CONFIG_ARCH_S3C24xx) += gpio-s3c24x0.o clocks-s3c24xx.o mem-s3c24x0.o obj-$(CONFIG_ARCH_S3C64xx) += gpio-s3c64xx.o clocks-s3c64xx.o mem-s3c64xx.o obj-$(CONFIG_ARCH_S5PCxx) += gpio-s5pcxx.o clocks-s5pcxx.o mem-s5pcxx.o diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index 8c08c9f82c..d52c272c5c 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -14,4 +14,5 @@ obj-$(CONFIG_NAND_IMX) += nand_imx.o obj-$(CONFIG_NAND_OMAP_GPMC) += nand_omap_gpmc.o nand_omap_bch_decoder.o obj-$(CONFIG_NAND_ATMEL) += atmel_nand.o obj-$(CONFIG_NAND_S3C24XX) += nand_s3c24xx.o +pbl-$(CONFIG_NAND_S3C24XX) += nand_s3c24xx.o obj-$(CONFIG_NAND_MXS) += nand_mxs.o -- cgit v1.2.3 From e90a9ba7e680e41f6771bfedd952b96bf5d3f850 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 6 Aug 2012 22:31:22 +0200 Subject: ARM Makefile: Do not hardcode targets in MLO/netx/davinci/s5p use $< rather than barebox.bin directly Signed-off-by: Sascha Hauer Acked-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'arch') diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 1362b3192b..948eb4e824 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -161,7 +161,7 @@ LDFLAGS_barebox += -static --gc-sections endif barebox.netx: barebox.bin - $(Q)scripts/gen_netx_image -i barebox.bin -o barebox.netx \ + $(Q)scripts/gen_netx_image -i $< -o barebox.netx \ --sdramctrl=$(CONFIG_NETX_SDRAM_CTRL) \ --sdramtimctrl=$(CONFIG_NETX_SDRAM_TIMING_CTRL) \ --memctrl=$(CONFIG_NETX_MEM_CTRL) \ @@ -173,7 +173,7 @@ KBUILD_IMAGE := barebox.netx endif barebox.s5p: barebox.bin - $(Q)scripts/s5p_cksum barebox.bin barebox.s5p + $(Q)scripts/s5p_cksum $< barebox.s5p ifeq ($(CONFIG_ARCH_S5PCxx),y) KBUILD_IMAGE := barebox.s5p @@ -181,8 +181,8 @@ endif MLO: barebox.bin @echo " IFT " $@ - $(Q)scripts/omap_signGP barebox.bin $(TEXT_BASE) 1 - $(Q)test -e barebox.bin.ift && mv barebox.bin.ift MLO + $(Q)scripts/omap_signGP $< $(TEXT_BASE) 1 + $(Q)test -e $<.ift && mv $<.ift MLO ifeq ($(CONFIG_OMAP_BUILD_IFT),y) KBUILD_IMAGE := MLO @@ -190,8 +190,8 @@ endif barebox.ubl: barebox.bin @echo " UBL " $@ - $(Q)scripts/mkublheader barebox.bin > barebox.ubl - $(Q)cat barebox.bin >> barebox.ubl + $(Q)scripts/mkublheader $< > barebox.ubl + $(Q)cat $< >> barebox.ubl ifeq ($(CONFIG_ARCH_DAVINCI),y) KBUILD_IMAGE := barebox.ubl -- cgit v1.2.3 From e42e1613d099726b2257d7079834bd1c26d492f8 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sun, 12 Aug 2012 16:11:26 +0200 Subject: ARM: fix netx/MLO/s5p image build for pbl If pbl support is enabled only zbarebox.bin was built, but not the SoC specific images. Fix this. Signed-off-by: Sascha Hauer Acked-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/Makefile | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'arch') diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 948eb4e824..8e660bea2b 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -160,7 +160,16 @@ CPPFLAGS += -fdata-sections -ffunction-sections LDFLAGS_barebox += -static --gc-sections endif -barebox.netx: barebox.bin +ifdef CONFIG_IMAGE_COMPRESSION +KBUILD_BINARY := arch/arm/pbl/zbarebox.bin +KBUILD_TARGET := zbarebox.bin +$(KBUILD_BINARY): $(KBUILD_TARGET) +else +KBUILD_BINARY := barebox.bin +KBUILD_TARGET := barebox.bin +endif + +barebox.netx: $(KBUILD_BINARY) $(Q)scripts/gen_netx_image -i $< -o barebox.netx \ --sdramctrl=$(CONFIG_NETX_SDRAM_CTRL) \ --sdramtimctrl=$(CONFIG_NETX_SDRAM_TIMING_CTRL) \ @@ -169,36 +178,38 @@ barebox.netx: barebox.bin --cookie=$(CONFIG_NETX_COOKIE); ifeq ($(machine-y),netx) -KBUILD_IMAGE := barebox.netx +KBUILD_TARGET := barebox.netx +KBUILD_BINARY := $(KBUILD_TARGET) endif -barebox.s5p: barebox.bin +barebox.s5p: $(KBUILD_BINARY) $(Q)scripts/s5p_cksum $< barebox.s5p ifeq ($(CONFIG_ARCH_S5PCxx),y) -KBUILD_IMAGE := barebox.s5p +KBUILD_TARGET := barebox.s5p +KBUILD_BINARY := $(KBUILD_TARGET) endif -MLO: barebox.bin - @echo " IFT " $@ - $(Q)scripts/omap_signGP $< $(TEXT_BASE) 1 - $(Q)test -e $<.ift && mv $<.ift MLO +quiet_cmd_mlo ?= IFT $@ + cmd_mlo ?= scripts/omap_signGP $< $(TEXT_BASE) 1; \ + test -e $<.ift && mv $<.ift MLO + +MLO: $(KBUILD_BINARY) + $(call if_changed,mlo) ifeq ($(CONFIG_OMAP_BUILD_IFT),y) -KBUILD_IMAGE := MLO +KBUILD_TARGET := MLO +KBUILD_BINARY := $(KBUILD_TARGET) endif -barebox.ubl: barebox.bin +barebox.ubl: $(KBUILD_BINARY) @echo " UBL " $@ $(Q)scripts/mkublheader $< > barebox.ubl $(Q)cat $< >> barebox.ubl ifeq ($(CONFIG_ARCH_DAVINCI),y) -KBUILD_IMAGE := barebox.ubl -endif - -ifdef CONFIG_IMAGE_COMPRESSION -KBUILD_IMAGE := zbarebox.bin +KBUILD_TARGET := barebox.ubl +KBUILD_BINARY := $(KBUILD_TARGET) endif pbl := arch/arm/pbl @@ -208,6 +219,8 @@ zbarebox.S zbarebox.bin zbarebox: barebox.bin archclean: $(MAKE) $(clean)=$(pbl) +KBUILD_IMAGE := $(KBUILD_BINARY) + archprepare: maketools maketools: $(Q)$(MAKE) $(build)=arch/arm/tools include/generated/mach-types.h @@ -231,4 +244,4 @@ common-y += arch/arm/lib/ arch/arm/cpu/ lds-y := arch/arm/lib/barebox.lds -CLEAN_FILES += include/generated/mach-types.h arch/arm/lib/barebox.lds +CLEAN_FILES += include/generated/mach-types.h arch/arm/lib/barebox.lds barebox-flash-image -- cgit v1.2.3 From e4e141159d5019006a85d4be5fb672a7e928dc38 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 6 Aug 2012 22:34:49 +0200 Subject: ARM pbl: generate zbarebox.map in $(obj) All other linker generated files are there, too, so it seems logical to put the map file there aswell. Signed-off-by: Sascha Hauer Acked-by: Jean-Christophe PLAGNIOL-VILLARD --- arch/arm/pbl/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/arm/pbl/Makefile b/arch/arm/pbl/Makefile index 143da8bc98..fe68e72eed 100644 --- a/arch/arm/pbl/Makefile +++ b/arch/arm/pbl/Makefile @@ -20,7 +20,7 @@ $(obj)/zbarebox.S: $(obj)/zbarebox FORCE $(call if_changed,disasm) PBL_CPPFLAGS += -fdata-sections -ffunction-sections -LDFLAGS_zbarebox := -Map zbarebox.map +LDFLAGS_zbarebox := -Map $(obj)/zbarebox.map LDFLAGS_zbarebox += -static --gc-sections zbarebox-common := $(barebox-pbl-common) $(obj)/$(piggy_o) zbarebox-lds := $(obj)/zbarebox.lds -- cgit v1.2.3 From 837795895801e6c368a564f9dcbbda2c87137ea7 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sun, 12 Aug 2012 15:21:54 +0200 Subject: ARM __mmu_cache_*: Do not clobber registers Save/restore the registers used in __mmu_cache_* so that they can be called as regular C functions. Signed-off-by: Sascha Hauer --- arch/arm/cpu/cache-armv4.S | 3 ++- arch/arm/cpu/cache-armv7.S | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'arch') diff --git a/arch/arm/cpu/cache-armv4.S b/arch/arm/cpu/cache-armv4.S index 2231eee06b..22fab1455c 100644 --- a/arch/arm/cpu/cache-armv4.S +++ b/arch/arm/cpu/cache-armv4.S @@ -46,6 +46,7 @@ ENDPROC(__mmu_cache_off) .section .text.__mmu_cache_flush ENTRY(__mmu_cache_flush) + stmfd sp!, {r6, r11, lr} mrc p15, 0, r6, c0, c0 @ get processor ID mov r2, #64*1024 @ default: 32K dcache size (*2) mov r11, #32 @ default: 32 byte line size @@ -74,7 +75,7 @@ no_cache_id: mcr p15, 0, r1, c7, c5, 0 @ flush I cache mcr p15, 0, r1, c7, c6, 0 @ flush D cache mcr p15, 0, r1, c7, c10, 4 @ drain WB - mov pc, lr + ldmfd sp!, {r6, r11, pc} ENDPROC(__mmu_cache_flush) /* diff --git a/arch/arm/cpu/cache-armv7.S b/arch/arm/cpu/cache-armv7.S index 9bd74254f3..2eba959672 100644 --- a/arch/arm/cpu/cache-armv7.S +++ b/arch/arm/cpu/cache-armv7.S @@ -3,6 +3,7 @@ .section .text.__mmu_cache_on ENTRY(__mmu_cache_on) + stmfd sp!, {r11, lr} mov r12, lr #ifdef CONFIG_MMU mrc p15, 0, r11, c0, c1, 4 @ read ID_MMFR0 @@ -28,7 +29,7 @@ ENTRY(__mmu_cache_on) mrc p15, 0, r0, c1, c0, 0 @ and read it back mov r0, #0 mcr p15, 0, r0, c7, c5, 4 @ ISB - mov pc, r12 + ldmfd sp!, {r11, pc} ENDPROC(__mmu_cache_on) .section .text.__mmu_cache_off @@ -54,6 +55,7 @@ ENDPROC(__mmu_cache_off) .section .text.__mmu_cache_flush ENTRY(__mmu_cache_flush) + stmfd sp!, {r10, lr} mrc p15, 0, r10, c0, c1, 5 @ read ID_MMFR1 tst r10, #0xf << 16 @ hierarchical cache (ARMv7) mov r10, #0 @@ -111,7 +113,7 @@ iflush: mcr p15, 0, r10, c7, c5, 0 @ invalidate I+BTB mcr p15, 0, r10, c7, c10, 4 @ DSB mcr p15, 0, r10, c7, c5, 4 @ ISB - mov pc, lr + ldmfd sp!, {r10, pc} ENDPROC(__mmu_cache_flush) /* -- cgit v1.2.3 From a3a103c95c9b74e611480134d61dd727c9c0b4ba Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sun, 12 Aug 2012 15:26:27 +0200 Subject: ARM MMU: call __mmu_cache_* as regular C functions Now that __mmu_cache_* restore the registers they can be called as regular C functions. Create a header file for them and use C functions rather than inline assembly. Signed-off-by: Sascha Hauer --- arch/arm/cpu/mmu.c | 25 ++++++------------------- arch/arm/cpu/mmu.h | 8 ++++++++ 2 files changed, 14 insertions(+), 19 deletions(-) create mode 100644 arch/arm/cpu/mmu.h (limited to 'arch') diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c index 607f3572db..dad8092e9f 100644 --- a/arch/arm/cpu/mmu.c +++ b/arch/arm/cpu/mmu.c @@ -8,6 +8,8 @@ #include #include +#include "mmu.h" + static unsigned long *ttb; static void create_sections(unsigned long virt, unsigned long phys, int size_m, @@ -21,12 +23,7 @@ static void create_sections(unsigned long virt, unsigned long phys, int size_m, for (i = size_m; i > 0; i--, virt++, phys++) ttb[virt] = (phys << 20) | flags; - asm volatile ( - "bl __mmu_cache_flush;" - : - : - : "r0", "r1", "r2", "r3", "r6", "r10", "r12", "lr", "cc", "memory" - ); + __mmu_cache_flush(); } /* @@ -255,12 +252,7 @@ static int mmu_init(void) create_sections(bank->start, bank->start, bank->size >> 20, PMD_SECT_DEF_CACHED); - asm volatile ( - "bl __mmu_cache_on;" - : - : - : "r0", "r1", "r2", "r3", "r6", "r10", "r12", "lr", "cc", "memory" - ); + __mmu_cache_on(); /* * Now that we have the MMU and caches on remap sdram again using @@ -284,13 +276,8 @@ void mmu_disable(void) if (outer_cache.disable) outer_cache.disable(); - asm volatile ( - "bl __mmu_cache_flush;" - "bl __mmu_cache_off;" - : - : - : "r0", "r1", "r2", "r3", "r6", "r10", "r12", "lr", "cc", "memory" - ); + __mmu_cache_flush(); + __mmu_cache_off(); } #define PAGE_ALIGN(s) ((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1); diff --git a/arch/arm/cpu/mmu.h b/arch/arm/cpu/mmu.h new file mode 100644 index 0000000000..618968bc82 --- /dev/null +++ b/arch/arm/cpu/mmu.h @@ -0,0 +1,8 @@ +#ifndef __ARM_MMU_H +#define __ARM_MMU_H + +void __mmu_cache_on(void); +void __mmu_cache_off(void); +void __mmu_cache_flush(void); + +#endif /* __ARM_MMU_H */ -- cgit v1.2.3 From bdb4093d3d36986cced0a953ed861ed2d7e55216 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 10 Aug 2012 23:29:38 +0200 Subject: ARM pbl: enable MMU during decompression Signed-off-by: Sascha Hauer --- arch/arm/cpu/Makefile | 4 +++ arch/arm/cpu/start-pbl.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) (limited to 'arch') diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile index 78d300dba8..0ecc72eea7 100644 --- a/arch/arm/cpu/Makefile +++ b/arch/arm/cpu/Makefile @@ -10,9 +10,13 @@ obj-$(CONFIG_CMD_ARM_CPUINFO) += cpuinfo.o obj-$(CONFIG_CMD_ARM_MMUINFO) += mmuinfo.o obj-$(CONFIG_MMU) += mmu.o obj-$(CONFIG_CPU_32v4T) += cache-armv4.o +pbl-$(CONFIG_CPU_32v4T) += cache-armv4.o obj-$(CONFIG_CPU_32v5) += cache-armv5.o +pbl-$(CONFIG_CPU_32v5) += cache-armv5.o obj-$(CONFIG_CPU_32v6) += cache-armv6.o +pbl-$(CONFIG_CPU_32v6) += cache-armv6.o obj-$(CONFIG_CPU_32v7) += cache-armv7.o +pbl-$(CONFIG_CPU_32v7) += cache-armv7.o obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o pbl-y += start-pbl.o start-reset.o diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c index 004ba6a2e6..8eb465cc9a 100644 --- a/arch/arm/cpu/start-pbl.c +++ b/arch/arm/cpu/start-pbl.c @@ -28,6 +28,9 @@ #include #include #include +#include + +#include "mmu.h" unsigned long free_mem_ptr; unsigned long free_mem_end_ptr; @@ -50,14 +53,79 @@ extern void *input_data_end; #include "../../../../lib/decompress_inflate.c" #endif +static unsigned long *ttb; + +static void create_sections(unsigned long addr, int size, unsigned int flags) +{ + int i; + + addr >>= 20; + size >>= 20; + + for (i = size; i > 0; i--, addr++) + ttb[addr] = (addr << 20) | flags; +} + +static void map_cachable(unsigned long start, unsigned long size) +{ + start &= ~(SZ_1M - 1); + size = (size + (SZ_1M - 1)) & ~(SZ_1M - 1); + + create_sections(start, size, PMD_SECT_AP_WRITE | + PMD_SECT_AP_READ | PMD_TYPE_SECT | PMD_SECT_WB); +} + +static void mmu_enable(unsigned long compressed_start, unsigned int len) +{ + int i; + + /* Set the ttb register */ + asm volatile ("mcr p15,0,%0,c2,c0,0" : : "r"(ttb) /*:*/); + + /* Set the Domain Access Control Register */ + i = 0x3; + asm volatile ("mcr p15,0,%0,c3,c0,0" : : "r"(i) /*:*/); + + create_sections(0, 4096, PMD_SECT_AP_WRITE | + PMD_SECT_AP_READ | PMD_TYPE_SECT); + /* + * Setup all regions we need cacheable, namely: + * - the stack + * - the decompressor code + * - the compressed image + * - the uncompressed image + * - the early malloc space + */ + map_cachable(STACK_BASE, STACK_SIZE); + map_cachable((unsigned long)&_text, + (unsigned long)&_end - (unsigned long)&_text); + map_cachable((unsigned long)compressed_start, len); + map_cachable(TEXT_BASE, len * 4); + map_cachable(free_mem_ptr, free_mem_end_ptr - free_mem_ptr); + + __mmu_cache_on(); +} + +static void mmu_disable(void) +{ + __mmu_cache_flush(); + __mmu_cache_off(); +} + static void barebox_uncompress(void *compressed_start, unsigned int len) { void (*barebox)(void); + int use_mmu = IS_ENABLED(CONFIG_MMU); /* set 128 KiB at the end of the MALLOC_BASE for early malloc */ free_mem_ptr = MALLOC_BASE + MALLOC_SIZE - SZ_128K; free_mem_end_ptr = free_mem_ptr + SZ_128K; + ttb = (void *)((free_mem_ptr - 0x4000) & ~0x3fff); + + if (use_mmu) + mmu_enable((unsigned long)compressed_start, len); + if (IS_ENABLED(CONFIG_THUMB2_BAREBOX)) barebox = (void *)(TEXT_BASE + 1); else @@ -68,6 +136,9 @@ static void barebox_uncompress(void *compressed_start, unsigned int len) NULL, NULL, (void *)TEXT_BASE, NULL, NULL); + if (use_mmu) + mmu_disable(); + /* flush I-cache before jumping to the uncompressed binary */ __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); -- cgit v1.2.3 From d5b6012ac1e674e7ce285d6b47cd346d765267d0 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sun, 12 Aug 2012 14:31:16 +0200 Subject: create a common ARM flush_icache function Signed-off-by: Sascha Hauer --- arch/arm/cpu/start-pbl.c | 7 +++---- arch/arm/cpu/start.c | 4 ++-- arch/arm/include/asm/cache.h | 9 +++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 arch/arm/include/asm/cache.h (limited to 'arch') diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c index 8eb465cc9a..932a3da9e2 100644 --- a/arch/arm/cpu/start-pbl.c +++ b/arch/arm/cpu/start-pbl.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "mmu.h" @@ -139,8 +140,7 @@ static void barebox_uncompress(void *compressed_start, unsigned int len) if (use_mmu) mmu_disable(); - /* flush I-cache before jumping to the uncompressed binary */ - __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); + flush_icache(); barebox(); } @@ -199,8 +199,7 @@ copy_link: /* clear bss */ memset(__bss_start, 0, __bss_stop - __bss_start); - /* flush I-cache before jumping to the copied binary */ - __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); + flush_icache(); r = (unsigned int)&barebox_uncompress; /* call barebox_uncompress with its absolute address */ diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c index 8365a7516f..07e7dfe822 100644 --- a/arch/arm/cpu/start.c +++ b/arch/arm/cpu/start.c @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef CONFIG_PBL_IMAGE /* @@ -80,8 +81,7 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void) /* clear bss */ memset(__bss_start, 0, __bss_stop - __bss_start); - /* flush I-cache before jumping to the copied binary */ - __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); + flush_icache(); /* call start_barebox with its absolute address */ r = (unsigned int)&start_barebox; diff --git a/arch/arm/include/asm/cache.h b/arch/arm/include/asm/cache.h new file mode 100644 index 0000000000..ff797493f7 --- /dev/null +++ b/arch/arm/include/asm/cache.h @@ -0,0 +1,9 @@ +#ifndef __ASM_CACHE_H +#define __ASM_CACHE_H + +static inline void flush_icache(void) +{ + asm volatile("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); +} + +#endif -- cgit v1.2.3