Debianize tf-a

- Build bl31 from ARM Trusted Framework

Change-Id: I1a5f2b70e8cb915abeb193b5417c36a2b99aae7a
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..5088cfb
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+tf-a (2.2-1) mendel-day; urgency=medium
+
+  * Initial release.
+
+ -- Coral Team <coral-support@google.com>  Wed, 19 Feb 2020 16:26:57 -0800
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+10
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..49cb2e5
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,13 @@
+Source: tf-a
+Section: misc
+Priority: optional
+Maintainer: Coral Team <coral-support@google.com>
+Build-Depends: debhelper (>=10), libssl-dev:native
+Standards-Version: 3.9.8
+Homepage: https://coral.ai
+
+Package: tf-a
+Architecture: any
+Depends: ${misc:Depends}
+Description: Trusted Firmware-A for mt8167s
+ Trusted Firmware-A for mt8167s, as well as fiptool
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..f3288c3
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,7 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: tf-a
+Source: https://excelsior.googlesource.com/tf-a
+
+Files: *
+Copyright: Copyright 2020 Google, LLC <coral-support@google.com>
+License: Apache-2.0
diff --git a/debian/lintian-overrides b/debian/lintian-overrides
new file mode 100644
index 0000000..1196e1b
--- /dev/null
+++ b/debian/lintian-overrides
@@ -0,0 +1 @@
+tf-a: binary-from-other-architecture usr/bin/fiptool
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..5b4cd07
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,40 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+#
+# output every command that modifies files on the build system.
+# export DH_VERBOSE = 1
+PACKAGENAME=tf-a
+DESTDIR=$(shell pwd)/debian/$(PACKAGENAME)
+
+CFLAGS=\
+	-Wno-error=missing-braces \
+	-Wno-error=unused-function \
+	-Wno-error=unused-variable \
+	-Wno-error=maybe-uninitialized
+
+%:
+	dh $@
+
+override_dh_auto_build:
+	make -j$(shell nproc) \
+		CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)- \
+		PLAT=mt8516 \
+		CFLAGS="$(CFLAGS)" \
+		LDFLAGS= \
+		BL32=/usr/share/optee-os/tee.bin \
+		BL33=/usr/share/u-boot/u-boot.bin \
+		NEED_BL32=yes \
+		NEED_BL33=yes \
+		SPD=opteed \
+		bl31 fiptool
+
+
+override_dh_auto_install:
+	install -d $(DESTDIR)/usr/bin
+	install -d $(DESTDIR)/usr/share/tf-a
+	install -p -m 755 ./tools/fiptool/fiptool $(DESTDIR)/usr/bin/fiptool
+	install -p -m 755 ./build/mt8516/release/bl31.bin $(DESTDIR)/usr/share/tf-a/bl31.bin
+
+override_dh_installinit:
+override_dh_strip:
+	true
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)