From f34423048968ced91c03f7b0a22389c6ec4d12bb Mon Sep 17 00:00:00 2001 From: Jarielle Catbagan Date: Fri, 3 Jul 2015 10:54:55 -0700 Subject: BBB: Build an MLO file when booting from non-XIP devices (e.g. SD) An MLO file will be created from the concatenation of a corresponding GP header and the uMon image. A GP header must be prepended to the uMon image when booting from non-XIP devices. Refer to the AM335x TRM, Section 26.1.9 for more information. These type of images have been tested when booting the MLO file from an SD card with a FAT32 primary partition marked as Active. --- ports/beagleboneblack/Makefile | 7 +++++++ ports/beagleboneblack/gp_header.S | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 ports/beagleboneblack/gp_header.S diff --git a/ports/beagleboneblack/Makefile b/ports/beagleboneblack/Makefile index 0525dec..db285bd 100644 --- a/ports/beagleboneblack/Makefile +++ b/ports/beagleboneblack/Makefile @@ -83,8 +83,15 @@ OBJS = $(LOCSOBJ) $(CPUSOBJ) $(LOCCOBJ) $(CPUCOBJ) $(COMCOBJ) \ # load a new version onto an already running system. # boot: $(BUILDDIR)/boot.$(FILETYPE) + $(CC) $(ASMFLAGS) -D \ + BIN_SIZE=$(shell wc --bytes build_$(PLATFORM)/boot.bin | cut -f 1 -d ' ') \ + -o gp_header.o gp_header.S + $(OBJCOPY) -O binary gp_header.o build_$(PLATFORM)/gp_header.bin + @cat build_$(PLATFORM)/gp_header.bin build_$(PLATFORM)/boot.bin > build_$(PLATFORM)/MLO @echo Boot version of uMon built under $(BUILDDIR) ... @ls $(BUILDDIR)/boot* + @echo Boot version of uMon attached with GP header build under $(BUILDDIR) ... + @ls $(BUILDDIR)/MLO # ramtst: # A shortcut to $(BUILDDIR)/ramtst.$(FILETYPE). This is a version of uMon diff --git a/ports/beagleboneblack/gp_header.S b/ports/beagleboneblack/gp_header.S new file mode 100644 index 0000000..3efceae --- /dev/null +++ b/ports/beagleboneblack/gp_header.S @@ -0,0 +1,7 @@ + .file "gp_header.S" + +/* This GP header is prepended to uMon images when booting from non-XIP devices (e.g. SD). + * Refer to the AM335x TRM, Section 26.1.9 for more information. + */ + .word BIN_SIZE + 8 + .word 0x402f0400 -- cgit v1.2.3