summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/buildman/func_test.py2
-rw-r--r--tools/env/Makefile3
-rwxr-xr-xtools/k3_fit_atf.sh99
-rw-r--r--tools/mkimage.c6
l---------tools/version.h1
5 files changed, 107 insertions, 4 deletions
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index 363db9d8ce..119d02cbb2 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -27,7 +27,7 @@ settings_data = '''
[make-flags]
src=/home/sjg/c/src
chroot=/home/sjg/c/chroot
-vboot=USE_STDINT=1 VBOOT_DEBUG=1 MAKEFLAGS_VBOOT=DEBUG=1 CFLAGS_EXTRA_VBOOT=-DUNROLL_LOOPS VBOOT_SOURCE=${src}/platform/vboot_reference
+vboot=VBOOT_DEBUG=1 MAKEFLAGS_VBOOT=DEBUG=1 CFLAGS_EXTRA_VBOOT=-DUNROLL_LOOPS VBOOT_SOURCE=${src}/platform/vboot_reference
chromeos_coreboot=VBOOT=${chroot}/build/link/usr ${vboot}
chromeos_daisy=VBOOT=${chroot}/build/daisy/usr ${vboot}
chromeos_peach=VBOOT=${chroot}/build/peach_pit/usr ${vboot}
diff --git a/tools/env/Makefile b/tools/env/Makefile
index 4633e0e72b..b627796e94 100644
--- a/tools/env/Makefile
+++ b/tools/env/Makefile
@@ -9,7 +9,8 @@
override HOSTCC = $(CC)
# Compile for a hosted environment on the target
-HOST_EXTRACFLAGS = $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
+HOST_EXTRACFLAGS = -I$(srctree)/tools \
+ $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
-idirafter $(srctree)/tools/env \
-DUSE_HOSTCC \
-DTEXT_BASE=$(TEXT_BASE)
diff --git a/tools/k3_fit_atf.sh b/tools/k3_fit_atf.sh
new file mode 100755
index 0000000000..430b5ca616
--- /dev/null
+++ b/tools/k3_fit_atf.sh
@@ -0,0 +1,99 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0+
+#
+# script to generate FIT image source for K3 Family boards with
+# ATF, OPTEE, SPL and multiple device trees (given on the command line).
+# Inspired from board/sunxi/mksunxi_fit_atf.sh
+#
+# usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
+
+[ -z "$ATF" ] && ATF="bl31.bin"
+
+if [ ! -f $ATF ]; then
+ echo "WARNING ATF file $ATF NOT found, resulting binary is non-functional" >&2
+ ATF=/dev/null
+fi
+
+[ -z "$TEE" ] && TEE="bl32.bin"
+
+if [ ! -f $TEE ]; then
+ echo "WARNING OPTEE file $TEE NOT found, resulting might be non-functional" >&2
+ TEE=/dev/null
+fi
+
+cat << __HEADER_EOF
+/dts-v1/;
+
+/ {
+ description = "Configuration to load ATF and SPL";
+ #address-cells = <1>;
+
+ images {
+ atf {
+ description = "ARM Trusted Firmware";
+ data = /incbin/("$ATF");
+ type = "firmware";
+ arch = "arm64";
+ compression = "none";
+ os = "arm-trusted-firmware";
+ load = <0x70000000>;
+ entry = <0x70000000>;
+ };
+ tee {
+ description = "OPTEE";
+ data = /incbin/("$TEE");
+ type = "tee";
+ arch = "arm64";
+ compression = "none";
+ os = "tee";
+ load = <0x9e800000>;
+ entry = <0x9e800000>;
+ };
+ spl {
+ description = "SPL (64-bit)";
+ data = /incbin/("spl/u-boot-spl-nodtb.bin");
+ type = "standalone";
+ os = "U-Boot";
+ arch = "arm64";
+ compression = "none";
+ load = <0x80080000>;
+ entry = <0x80080000>;
+ };
+__HEADER_EOF
+
+for dtname in $*
+do
+ cat << __FDT_IMAGE_EOF
+ $(basename $dtname) {
+ description = "$(basename $dtname .dtb)";
+ data = /incbin/("$dtname");
+ type = "flat_dt";
+ arch = "arm";
+ compression = "none";
+ };
+__FDT_IMAGE_EOF
+done
+
+cat << __CONF_HEADER_EOF
+ };
+ configurations {
+ default = "$(basename $1)";
+
+__CONF_HEADER_EOF
+
+for dtname in $*
+do
+ cat << __CONF_SECTION_EOF
+ $(basename $dtname) {
+ description = "$(basename $dtname .dtb)";
+ firmware = "atf";
+ loadables = "tee", "spl";
+ fdt = "$(basename $dtname)";
+ };
+__CONF_SECTION_EOF
+done
+
+cat << __ITS_EOF
+ };
+};
+__ITS_EOF
diff --git a/tools/mkimage.c b/tools/mkimage.c
index e0d4d20be4..6abd4d6a8b 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -318,6 +318,7 @@ int main(int argc, char **argv)
struct image_type_params *tparams = NULL;
int pad_len = 0;
int dfd;
+ size_t map_len;
params.cmdname = *argv;
params.addr = 0;
@@ -576,7 +577,8 @@ int main(int argc, char **argv)
}
params.file_size = sbuf.st_size;
- ptr = mmap(0, sbuf.st_size, PROT_READ|PROT_WRITE, MAP_SHARED, ifd, 0);
+ map_len = sbuf.st_size;
+ ptr = mmap(0, map_len, PROT_READ | PROT_WRITE, MAP_SHARED, ifd, 0);
if (ptr == MAP_FAILED) {
fprintf (stderr, "%s: Can't map %s: %s\n",
params.cmdname, params.imagefile, strerror(errno));
@@ -600,7 +602,7 @@ int main(int argc, char **argv)
params.cmdname, tparams->name);
}
- (void) munmap((void *)ptr, sbuf.st_size);
+ (void)munmap((void *)ptr, map_len);
/* We're a bit of paranoid */
#if defined(_POSIX_SYNCHRONIZED_IO) && \
diff --git a/tools/version.h b/tools/version.h
new file mode 120000
index 0000000000..bb576071e8
--- /dev/null
+++ b/tools/version.h
@@ -0,0 +1 @@
+../include/version.h \ No newline at end of file