Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35411 )
Change subject: cpu/allwinner: Prepend the BOOT0 header to the bootblock.bin
......................................................................
cpu/allwinner: Prepend the BOOT0 header to the bootblock.bin
Instead of prepending the BOOT0 header to the full coreboot.rom to
create a new file called BOOT0, prepend to the bootblock.bin that gets
included in BOOTBLOCK FMAP region.
This updates mksunxiboot to reflect that it only operates on the raw
bootblock.bin and not the final image:
- given the necessary alignment on some boot media assume that the
remainder bytes after the bootblock will be filled with 1's
- don't allow bootblocks larger than 24K as the BROM won't load these
fully anyway.
Change-Id: I974a6aaa1a340c6b26f78b9d038be0f580331831
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/cpu/allwinner/a10/Makefile.inc
M util/arm_boot_tools/mksunxiboot/mksunxiboot.c
2 files changed, 15 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/35411/1
diff --git a/src/cpu/allwinner/a10/Makefile.inc b/src/cpu/allwinner/a10/Makefile.inc
index a6cd4b4..9f5f6ac 100644
--- a/src/cpu/allwinner/a10/Makefile.inc
+++ b/src/cpu/allwinner/a10/Makefile.inc
@@ -25,8 +25,6 @@
romstage-y += uart.c uart_console.c
ramstage-y += uart.c uart_console.c
-real-target: $(obj)/BOOT0
-
get_bootblock_size= \
$(eval bb_s=$(shell $(CBFSTOOL) $(1) print | grep bootblocksize | \
sed 's/[^0-9 ]//g')) \
@@ -46,11 +44,11 @@
# 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"
+
+$(objcbfs)/bootblock.bin: $(objcbfs)/bootblock.raw.bin $(MKSUNXIBOOT)
+ @printf " Prepending BOOT0 header $(subst $(obj)/,,$(^))\n"
$(MKSUNXIBOOT) $(word 1, $^) $@
diff --git a/util/arm_boot_tools/mksunxiboot/mksunxiboot.c b/util/arm_boot_tools/mksunxiboot/mksunxiboot.c
index 58765b1..50771e9 100644
--- a/util/arm_boot_tools/mksunxiboot/mksunxiboot.c
+++ b/util/arm_boot_tools/mksunxiboot/mksunxiboot.c
@@ -62,7 +62,7 @@
}
/* Check sum function from sun4i boot code */
-static int fill_check_sum(struct boot_file_head *hdr, const void *boot_code)
+static int fill_check_sum(struct boot_file_head *hdr, const void *boot_code, size_t load_size)
{
size_t i;
uint8_t raw_hdr[HEADER_SIZE];
@@ -83,9 +83,14 @@
chksum += le32_to_h(raw_hdr + i);
/* Checksum the boot code */
- for (i = 0; i < hdr->length - HEADER_SIZE; i += 4)
+ for (i = 0; i < load_size; i += 4)
chksum += le32_to_h(boot_code + i);
+ /* Given that the hdr.length is aligned one can assume that the
+ remaining bytes covered by the length are all 1's */
+ for (i = 0; i < hdr->length - load_size- HEADER_SIZE; i +=4)
+ chksum += 0xffffffff;
+
/* write back check sum */
hdr->check_sum = chksum;
@@ -165,8 +170,10 @@
load_size = align(file_size, sizeof(uint32_t));
- if (load_size > SRAM_LOAD_MAX_SIZE)
- load_size = SRAM_LOAD_MAX_SIZE;
+ if (load_size > SRAM_LOAD_MAX_SIZE) {
+ fprintf(stderr, "Bootblock larger than the max 24K!\n");
+ return EXIT_FAILURE;
+ }
printf("Load size: 0x%x\n", load_size);
@@ -178,7 +185,7 @@
/* Fill the header */
fill_header(&hdr, load_size);
- fill_check_sum(&hdr, file_data);
+ fill_check_sum(&hdr, file_data, load_size);
/* Now write the header */
serialize_header(raw_hdr, &hdr);
--
To view, visit https://review.coreboot.org/c/coreboot/+/35411
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I974a6aaa1a340c6b26f78b9d038be0f580331831
Gerrit-Change-Number: 35411
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-MessageType: newchange
Peter Lemenkov has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/11791 )
Change subject: mainboard/lenovo/t410: Add new port
......................................................................
Patch Set 15:
(2 comments)
https://review.coreboot.org/c/coreboot/+/11791/15/src/mainboard/lenovo/t410…
File src/mainboard/lenovo/t410/mainboard.c:
https://review.coreboot.org/c/coreboot/+/11791/15/src/mainboard/lenovo/t410…
PS15, Line 33: static void mainboard_init(struct device *dev)
I think this RCBA configuration may be removed. See commit b236cba61558649791224cf35357568bfe3b30db.
https://review.coreboot.org/c/coreboot/+/11791/15/src/mainboard/lenovo/t410…
File src/mainboard/lenovo/t410/smihandler.c:
https://review.coreboot.org/c/coreboot/+/11791/15/src/mainboard/lenovo/t410…
PS15, Line 21: #include <southbridge/intel/ibexpeak/pch.h>
I believe this include is no longer necessary since commit 548f33a9f4a7675c42822516c285bdf2c8bb64de
--
To view, visit https://review.coreboot.org/c/coreboot/+/11791
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Id9d872e643dd242e925bfb46d18076e6ad100995
Gerrit-Change-Number: 11791
Gerrit-PatchSet: 15
Gerrit-Owner: Nicolas Reinecke <nr(a)das-labor.org>
Gerrit-Reviewer: Alexander Couzens <lynxis(a)fe80.eu>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Nicolas Reinecke <nr(a)das-labor.org>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Patrick Rudolph <patrick.rudolph(a)9elements.com>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Eloy Degen
Gerrit-CC: Matt Parnell <mparnell(a)gmail.com>
Gerrit-CC: Okashi Odayakana <okashi(a)okashi.me>
Gerrit-CC: Peter Lemenkov <lemenkov(a)gmail.com>
Gerrit-Comment-Date: Sat, 14 Sep 2019 15:42:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment