Skip to content

Commit

Permalink
ARM: Merge single pbl with multi pbl
Browse files Browse the repository at this point in the history
So far we have two different implementations for PBL: One for a single
PBL and one for multiple images. This patch implements the single PBL
case as a special case of the multi PBL case. With this the single PBL
becomes a multi PBL image with the entry point start_pbl.

Signed-off-by: Sascha Hauer <[email protected]>
  • Loading branch information
saschahauer committed Oct 1, 2019
1 parent c123df1 commit 0be4826
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 112 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ images: barebox.bin FORCE
images/%.s: barebox.bin FORCE
$(Q)$(MAKE) $(build)=images $@

ifdef CONFIG_PBL_MULTI_IMAGES
ifdef CONFIG_PBL_IMAGE
all: barebox.bin images
else
all: barebox-flash-image barebox-flash-images
Expand Down
3 changes: 1 addition & 2 deletions arch/arm/cpu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ obj-pbl-$(CONFIG_CPU_64v8) += cache-armv8.o
AFLAGS_pbl-cache-armv8.o :=-Wa,-march=armv8-a

pbl-y += entry.o
pbl-$(CONFIG_PBL_SINGLE_IMAGE) += start-pbl.o
pbl-$(CONFIG_PBL_MULTI_IMAGES) += uncompress.o
pbl-y += uncompress.o

obj-pbl-y += common.o sections.o
6 changes: 2 additions & 4 deletions arch/arm/cpu/entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ void NAKED __noreturn barebox_arm_entry(unsigned long membase,
arm_setup_stack(arm_mem_stack_top(membase, membase + memsize));
arm_early_mmu_cache_invalidate();

if (IS_ENABLED(CONFIG_PBL_MULTI_IMAGES))
barebox_multi_pbl_start(membase, memsize, boarddata);
else if (IS_ENABLED(CONFIG_PBL_SINGLE_IMAGE))
barebox_single_pbl_start(membase, memsize, boarddata);
if (IS_ENABLED(CONFIG_PBL_IMAGE))
barebox_pbl_start(membase, memsize, boarddata);
else
barebox_non_pbl_start(membase, memsize, boarddata);
}
10 changes: 3 additions & 7 deletions arch/arm/cpu/entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ void __noreturn barebox_non_pbl_start(unsigned long membase,
unsigned long memsize,
void *boarddata);

void __noreturn barebox_multi_pbl_start(unsigned long membase,
unsigned long memsize,
void *boarddata);

void __noreturn barebox_single_pbl_start(unsigned long membase,
unsigned long memsize,
void *boarddata);
void __noreturn barebox_pbl_start(unsigned long membase,
unsigned long memsize,
void *boarddata);

#endif
96 changes: 0 additions & 96 deletions arch/arm/cpu/start-pbl.c

This file was deleted.

17 changes: 15 additions & 2 deletions arch/arm/cpu/uncompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,27 @@

#include "entry.h"

#ifndef CONFIG_HAVE_PBL_MULTI_IMAGES

void start_pbl(void);

/*
* First instructions in the pbl image
*/
void __naked __section(.text_head_entry_start_single_pbl) start_pbl(void)
{
barebox_arm_head();
}
#endif

unsigned long free_mem_ptr;
unsigned long free_mem_end_ptr;

extern unsigned char input_data[];
extern unsigned char input_data_end[];

void __noreturn barebox_multi_pbl_start(unsigned long membase,
unsigned long memsize, void *boarddata)
void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize,
void *boarddata)
{
uint32_t pg_len, uncompressed_len;
void __noreturn (*barebox)(unsigned long, unsigned long, void *);
Expand Down
7 changes: 7 additions & 0 deletions images/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,17 @@ include $(srctree)/images/Makefile.at91
include $(srctree)/images/Makefile.zynqmp
include $(srctree)/images/Makefile.layerscape


pblb-$(CONFIG_BOARD_ARM_GENERIC_DT) += start_dt_2nd
FILE_barebox-dt-2nd.img = start_dt_2nd.pblb
image-$(CONFIG_BOARD_ARM_GENERIC_DT) += barebox-dt-2nd.img

ifdef CONFIG_ARM
pblb-$(CONFIG_PBL_SINGLE_IMAGE) += start_pbl
FILE_barebox.img = start_pbl.pblb
image-$(CONFIG_PBL_SINGLE_IMAGE) += barebox.img
endif

ifneq ($(pblx-y)$(pblx-),)
$(error pblx- has been removed. Please use pblb- instead.)
endif
Expand Down

0 comments on commit 0be4826

Please sign in to comment.