Files
system76-coreboot/src/soc/ti/am335x/Makefile.inc
Sam Lewis 266c136304 soc/ti/am335x: Fix MLO build
Allows the AM335X to boot from the coreboot generated MLO by:

- Fixing the load address in the MLO header to be the start of SRAM
- Fixing the way that the bootblock size is calculated (which is
  embedded into the MLO so that the MLO knows how much to load into
  SRAM). The previous method relied on parsing cbfstool output - the
  output has changed format since this was originally written so this no
  longer works. Directly using the filesize of the built binary is
  probably a more stable way of doing this.

As part of this, the start addresses of SRAM and DRAM were fixed to be
consistent with the AM335x Technical Reference Manual (spruh73, rev Q).

TEST: Booted Beaglebone Black from MLO placed at offset 0x00 on an SD card

Change-Id: I514d7cda65ddcbf27e78286dc6857c9e81ce6f9e
Signed-off-by: Sam Lewis <sam.vr.lewis@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44381
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-09-09 10:49:05 +00:00

53 lines
1.4 KiB
Makefile

ifeq ($(CONFIG_SOC_TI_AM335X),y)
bootblock-y += bootblock.c
bootblock-y += bootblock_media.c
bootblock-y += dmtimer.c
bootblock-y += gpio.c
bootblock-y += pinmux.c
bootblock-y += monotonic_timer.c
romstage-y += nand.c
romstage-y += cbmem.c
romstage-y += dmtimer.c
romstage-y += monotonic_timer.c
ramstage-y += dmtimer.c
ramstage-y += monotonic_timer.c
ramstage-y += nand.c
ramstage-y += soc.c
bootblock-y += uart.c
romstage-y += uart.c
ramstage-y += uart.c
$(call add-class,omap-header)
$(eval $(call create_class_compiler,omap-header,arm))
omap-header-generic-ccopts += -D__COREBOOT_ARM_ARCH__=7
real-target: $(obj)/MLO
header_ld := $(call src-to-obj,omap-header,$(dir)/header.ld)
get_header_size= \
$(shell echo $$(wc -c < $(objcbfs)/bootblock.bin))
$(obj)/omap-header.bin: $$(omap-header-objs) $(objcbfs)/bootblock.bin
@printf " CC $(subst $(obj)/,,$(@))\n"
$(CC_omap-header) -nostdlib -nostartfiles -static -include $(obj)/config.h \
-Wl,--defsym,header_load_size=$(strip \
$(call get_header_size,$(obj)/coreboot.rom) \
) \
-o $@.tmp $< -T $(header_ld)
$(OBJCOPY_omap-header) --only-section=".header" -O binary $@.tmp $@
$(obj)/MLO: $(obj)/coreboot.rom $(obj)/omap-header.bin
@printf " HEADER $(subst $(obj)/,,$(@))\n"
$(Q)cat $(obj)/omap-header.bin $(obj)/coreboot.rom > $@
omap-header-y += header.c
omap-header-srcs += $(CONFIG_MEMLAYOUT_LD_FILE)
omap-header-y += header.ld
endif