diff options
author | Alexandru Gagniuc <mr.nuke.me@gmail.com> | 2014-01-10 23:06:03 -0600 |
---|---|---|
committer | Alexandru Gagniuc <mr.nuke.me@gmail.com> | 2014-01-13 04:03:00 +0100 |
commit | 910ce017571b85f2139c9ab1fcd94a8a88dd4f48 (patch) | |
tree | 72dece533e992aaa650283ef06d533587f23313d /src/cpu/allwinner/a10 | |
parent | d7b07af621627bbc40fb8481702b1fe7ab9b9c3c (diff) | |
download | coreboot-910ce017571b85f2139c9ab1fcd94a8a88dd4f48.tar.xz |
cpu/allwinner/a10: Provide utility to make a bootable image
Up until now, we relied on mksunxiboot to prepend the header which
makes coreboot.rom bootable on Allwinner SoCs. If that tool was not
present, the build silently failed.
Integrate this tool into our util/ package, so that we do not have to
rely on mksunxiboot being in PATH.
Our version of mksunxiboot also eliminates some limitations of the
original tool, so we no longer have to use 'dd' to limit the file
size.
Change-Id: Id5a4b1e2a3cb00cd1d6c70e6cbc3cfd8587e8a24
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-on: http://review.coreboot.org/4656
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/cpu/allwinner/a10')
-rw-r--r-- | src/cpu/allwinner/a10/Makefile.inc | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/cpu/allwinner/a10/Makefile.inc b/src/cpu/allwinner/a10/Makefile.inc index 03bc612457..1b720bf779 100644 --- a/src/cpu/allwinner/a10/Makefile.inc +++ b/src/cpu/allwinner/a10/Makefile.inc @@ -30,16 +30,25 @@ get_bootblock_size= \ sed 's/[^0-9 ]//g')) \ $(shell echo $$(($(word 2, $(strip $(bb_s)))))) +# This tool is used to prepend a header to coreboot.rom to trick the SoC into +# loading out bootblock +# +MKSUNXIBOOT:=$(objutil)/mksunxiboot +$(MKSUNXIBOOT): $(top)/util/arm_boot_tools/mksunxiboot/mksunxiboot.c + @printf " HOSTCC $(subst $(obj)/,,$(@))\n" + $(HOSTCC) $(HOSTCFLAGS) -o $@ $< + # The boot ROM in the SoC will start loading code if a special BOOT0 header is # found (at an offset of 8KiB in either NAND or SD), and the checksum is -# correct. This header is normally added by the 'mxsunxiboot' tool. The boot ROM -# will load at most 24KiB of data to SRAM, so limit the file size accordingly. -# The BOOT0 header takes 32 bytes, so limit our file to 24KiB - 32 bytes. -# FIXME: Figure out how to safely integrate in coreboot.rom. -# FIXME: The file passed to mksunxiboot should only include the bootblock due -# to size limitations. -$(obj)/BOOT0: $(obj)/coreboot.rom +# correct. This header is added by the 'mxsunxiboot' tool, which is provided +# under util/arm_boot_tools/mksunxiboot. The boot ROM will load at most 24KiB of +# data to SRAM. The BOOT0 header takes 32 bytes, so bootblock is limited to +# 24KiB - 32 bytes. +# TODO: make mksunxiboot take the bootblock size as a parameter +# TODO: print an error if bootblock is too large (maybe place ROMSTAGE at the +# exact offset needed to collide with the bootblock) +# FIXME: A10 loads 24KiB. According to Oliver other chips load a little more +# +$(obj)/BOOT0: $(obj)/coreboot.rom $(MKSUNXIBOOT) @printf " BOOT0 $(subst $(obj)/,,$(^))\n" - touch $@ - dd if=$^ of=$^.tmp bs=24544 count=1 - -mksunxiboot $^.tmp $@ + $(MKSUNXIBOOT) $(word 1, $^) $@ |