summaryrefslogtreecommitdiff
path: root/src/soc/nvidia/tegra132/lp0/Makefile
diff options
context:
space:
mode:
authorYen Lin <yelin@nvidia.com>2014-08-27 14:35:08 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2015-04-06 19:12:39 +0200
commitd126a749b86504a6f4c3a6c572fc8a3b14de6df9 (patch)
tree6c6ff749993444a8d2056dd2ec90c3d79f17ad12 /src/soc/nvidia/tegra132/lp0/Makefile
parentd3b40bfc2d419906df49647492dc601aea181730 (diff)
tegra132: Add tegra_lp0_resume code
BUG=chrome-os-partner:32015 BRANCH=None TEST=successfully suspend/resume on Rush/Ryu Signed-off-by: Yen Lin <yelin@nvidia.com> Change-Id: I279e42fd055805f0060951d272571bda66514ea6 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: a02452e431d9aa6245fb2421773d66fc416d0a6e Original-Change-Id: I11cca0a8f5e7a36c1fff690c8070c74706348949 Original-Reviewed-on: https://chromium-review.googlesource.com/214580 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Original-Commit-Queue: Yen Lin <yelin@nvidia.com> Original-Tested-by: Yen Lin <yelin@nvidia.com> Reviewed-on: http://review.coreboot.org/9102 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/soc/nvidia/tegra132/lp0/Makefile')
-rw-r--r--src/soc/nvidia/tegra132/lp0/Makefile58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/soc/nvidia/tegra132/lp0/Makefile b/src/soc/nvidia/tegra132/lp0/Makefile
new file mode 100644
index 0000000000..57680c562f
--- /dev/null
+++ b/src/soc/nvidia/tegra132/lp0/Makefile
@@ -0,0 +1,58 @@
+################################################################################
+##
+## Copyright 2014 Google Inc.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+##
+################################################################################
+
+CC = $(GCC_PREFIX)gcc
+NM = $(GCC_PREFIX)nm
+OBJCOPY = $(GCC_PREFIX)objcopy
+
+OPENSSL = openssl
+DD = dd
+CP = cp
+MV = mv
+RM = rm
+
+SIGKEY = 00000000000000000000000000000000
+
+.PHONY: all
+all: tegra_lp0_resume.fw
+
+tegra_lp0_resume.elf: tegra_lp0_resume.ld tegra_lp0_resume.c
+ $(CC) -marm -march=armv4t -mno-unaligned-access -nostdlib -static \
+ -Os -fpie -Wl,--build-id=none -ggdb3 -T tegra_lp0_resume.ld \
+ -o $@ $(filter %.c,$+)
+
+tegra_lp0_resume.fw: tegra_lp0_resume.elf
+ @# Get rid of any files we're about to create.
+ $(RM) -f $@.nosig $@.sig $@.tosig
+ @# Convert the ELF image into a binary image.
+ $(OBJCOPY) -O binary $< $@.nosig
+ @# Extract the part of the binary which needs to be signed.
+ $(DD) bs=1 skip=544 if=$@.nosig of=$@.tosig
+ @# Calculate a signature for that part.
+ $(OPENSSL) dgst -mac cmac -macopt cipher:aes-128-cbc \
+ -macopt hexkey:$(SIGKEY) -md5 -binary \
+ $@.tosig > $@.sig
+ @# Inject the signature into the binary image's header.
+ $(DD) conv=notrunc bs=1 seek=272 count=16 if=$@.sig of=$@.nosig
+ @# Copy the signed binary to the target file name.
+ $(MV) $@.nosig $@
+
+clean:
+ $(RM) -f tegra_lp0_resume.fw tegra_lp0_resume.fw.sig
+ $(RM) -f tegra_lp0_resume.fw.tosig tegra_lp0_resume.elf