diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-09-05 12:59:29 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-09-05 12:59:29 +0200 |
commit | bed1a6ffab6ba8f59146af07ccbdc7a625b6496f (patch) | |
tree | 6301a84dc2ef2d746a9a60979573e03eb6cc1c6a /arch | |
parent | b40aeb00d32f07c5b1b617ea4e88032cb895d8b3 (diff) | |
parent | d5b6012ac1e674e7ce285d6b47cd346d765267d0 (diff) | |
download | barebox-bed1a6ffab6ba8f59146af07ccbdc7a625b6496f.tar.gz barebox-bed1a6ffab6ba8f59146af07ccbdc7a625b6496f.tar.xz |
Merge branch 'for-next/pbl'
Diffstat (limited to 'arch')
64 files changed, 626 insertions, 149 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 904c02d0fb..a54ad03445 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -4,6 +4,8 @@ config ARM select HAS_MODULES 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 1b60261bc8..8e660bea2b 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -160,8 +160,17 @@ CPPFLAGS += -fdata-sections -ffunction-sections LDFLAGS_barebox += -static --gc-sections endif -barebox.netx: barebox.bin - $(Q)scripts/gen_netx_image -i barebox.bin -o barebox.netx \ +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) \ --memctrl=$(CONFIG_NETX_MEM_CTRL) \ @@ -169,35 +178,48 @@ 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 - $(Q)scripts/s5p_cksum barebox.bin barebox.s5p +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 barebox.bin $(TEXT_BASE) 1 - $(Q)test -e barebox.bin.ift && mv barebox.bin.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.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 +KBUILD_TARGET := barebox.ubl +KBUILD_BINARY := $(KBUILD_TARGET) endif -all: $(KBUILD_IMAGE) +pbl := arch/arm/pbl +zbarebox.S zbarebox.bin zbarebox: barebox.bin + $(Q)$(MAKE) $(build)=$(pbl) $(pbl)/$@ + +archclean: + $(MAKE) $(clean)=$(pbl) + +KBUILD_IMAGE := $(KBUILD_BINARY) archprepare: maketools maketools: @@ -222,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 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/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/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/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/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 406c6f32f7..cc01cf985b 100644 --- a/arch/arm/boards/eukrea_cpuimx25/Makefile +++ b/arch/arm/boards/eukrea_cpuimx25/Makefile @@ -21,4 +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_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 <mach/devices-imx25.h> #include <asm/barebox-arm-head.h> -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 <s.hauer@pengutronix.de> + * (c) 2010 Eukrea Electromatique, Eric BĂ©nard <eric@eukrea.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + */ +#include <common.h> +#include <mach/imx-flash-header.h> +#include <mach/imx-regs.h> +#include <asm/barebox-arm-head.h> + +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; 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/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/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/cpu/Makefile b/arch/arm/cpu/Makefile index 93a34a9ff1..0ecc72eea7 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 @@ -10,8 +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/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) /* 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 <asm/system.h> #include <memory.h> +#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 */ diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c new file mode 100644 index 0000000000..932a3da9e2 --- /dev/null +++ b/arch/arm/cpu/start-pbl.c @@ -0,0 +1,213 @@ +/* + * start-pbl.c + * + * Copyright (c) 2010-2012 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix + * Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License 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 <common.h> +#include <init.h> +#include <sizes.h> +#include <asm/barebox-arm.h> +#include <asm/barebox-arm-head.h> +#include <asm-generic/memory_layout.h> +#include <asm/sections.h> +#include <asm/pgtable.h> +#include <asm/cache.h> + +#include "mmu.h" + +unsigned long free_mem_ptr; +unsigned long free_mem_end_ptr; + +void __naked __section(.text_head_entry) pbl_start(void) +{ + barebox_arm_head(); +} + +extern void *input_data; +extern void *input_data_end; + +#define STATIC static + +#ifdef CONFIG_IMAGE_COMPRESSION_LZO +#include "../../../lib/decompress_unlzo.c" +#endif + +#ifdef CONFIG_IMAGE_COMPRESSION_GZIP +#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 + barebox = (void *)TEXT_BASE; + + decompress((void *)compressed_start, + len, + NULL, NULL, + (void *)TEXT_BASE, NULL, NULL); + + if (use_mmu) + mmu_disable(); + + flush_icache(); + + barebox(); +} + +/* + * 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; + uint32_t pg_start, pg_end, pg_len; + + /* + * 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; + + 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), + __bss_start - _text); + + /* clear bss */ + memset(__bss_start, 0, __bss_stop - __bss_start); + + flush_icache(); + + 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"(pg_start), "r"(pg_len) + : "r0", "r1"); +} 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 <s.hauer@pengutronix.de>, 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 <common.h> +#include <init.h> +#include <asm/system.h> +#include <asm/barebox-arm.h> +#include <asm/sections.h> + +/* + * 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..07e7dfe822 100644 --- a/arch/arm/cpu/start.c +++ b/arch/arm/cpu/start.c @@ -24,53 +24,32 @@ #include <init.h> #include <asm/barebox-arm.h> #include <asm/barebox-arm-head.h> -#include <asm/system.h> #include <asm-generic/memory_layout.h> #include <asm/sections.h> +#include <asm/cache.h> -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(); } /* @@ -102,11 +81,10 @@ 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; __asm__ __volatile__("mov pc, %0" : : "r"(r)); } - +#endif 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 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/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 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 7b872f6da3..2b595bce43 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/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 diff --git a/arch/arm/pbl/Makefile b/arch/arm/pbl/Makefile new file mode 100644 index 0000000000..fe68e72eed --- /dev/null +++ b/arch/arm/pbl/Makefile @@ -0,0 +1,40 @@ + +suffix_$(CONFIG_IMAGE_COMPRESSION_GZIP) = gzip +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) + +# 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) + $(call cmd,check_file_size,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE)) + @echo ' Barebox: $@ is ready' + +$(obj)/zbarebox.S: $(obj)/zbarebox FORCE + $(call if_changed,disasm) + +PBL_CPPFLAGS += -fdata-sections -ffunction-sections +LDFLAGS_zbarebox := -Map $(obj)/zbarebox.map +LDFLAGS_zbarebox += -static --gc-sections +zbarebox-common := $(barebox-pbl-common) $(obj)/$(piggy_o) +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__) + +$(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.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/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 new file mode 100644 index 0000000000..2dca278318 --- /dev/null +++ b/arch/arm/pbl/zbarebox.lds.S @@ -0,0 +1,78 @@ +/* + * (C) Copyright 2012 Sascha Hauer <s.hauer@pengutronix.de>, 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 <asm-generic/barebox.lds.h> +#include <asm-generic/memory_layout.h> + +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*) + } + + /* Discard unwind if enable in barebox */ + /DISCARD/ : { *(.ARM.ex*) } + + 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; + _barebox_pbl_size = __bss_start - HEAD_TEXT_BASE; +} 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),) |