[PATCH 8/8] BBB: Build an MLO file when booting from non-XIP devices (e.g. SD)

Jarielle Catbagan jcatbagan93 at gmail.com
Fri Jul 3 17:54:55 UTC 2015


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
-- 
2.3.3




More information about the umon-devel mailing list