make: Create stripped elf binary for aboot
Add rules to create stripped elf binary.
CRs-Fixed: 626209
Change-Id: I1d603c7e371daddc1db6d79f99c6afacd0f31645
diff --git a/makefile b/makefile
index 4c31db2..f6f9061 100644
--- a/makefile
+++ b/makefile
@@ -37,6 +37,8 @@
BUILDDIR := $(BOOTLOADER_OUT)/build-$(PROJECT)
OUTBIN := $(BUILDDIR)/lk.bin
OUTELF := $(BUILDDIR)/lk
+OUTELF_STRIP := $(BUILDDIR)/lk_s.elf
+
CONFIGHEADER := $(BUILDDIR)/config.h
#Initialize the command-line flag ENABLE_TRUSTZONE. Value for flag passed in at command-line will take precedence
@@ -60,6 +62,8 @@
# When the host arch is ARM, ensure stack protection code is not emitted since
# it's not supported by the bootloader's libc
+# setup toolchain prefix
+TOOLCHAIN_PREFIX ?= arm-eabi-
ifneq ($(shell uname -m | grep "arm.*"),)
CFLAGS += -fno-stack-protector
endif
@@ -72,7 +76,7 @@
LDFLAGS += -gc-sections
# top level rule
-all:: $(OUTBIN) $(OUTELF).lst $(OUTELF).debug.lst $(OUTELF).sym $(OUTELF).size APPSBOOTHEADER
+all:: $(OUTBIN) $(OUTELF).lst $(OUTELF).debug.lst $(OUTELF).sym $(OUTELF).size $(OUTELF_STRIP) APPSBOOTHEADER
# the following three object lists are identical except for the ordering
# which is bootobjs, kobjs, objs
@@ -149,7 +153,10 @@
# default to no ccache
CCACHE ?=
CC := $(CCACHE) $(TOOLCHAIN_PREFIX)gcc
+ifeq ($(LD),ld)
LD := $(TOOLCHAIN_PREFIX)ld
+endif
+STRIP := $(TOOLCHAIN_PREFIX)strip
OBJDUMP := $(TOOLCHAIN_PREFIX)objdump
OBJCOPY := $(TOOLCHAIN_PREFIX)objcopy
CPPFILT := $(TOOLCHAIN_PREFIX)c++filt
@@ -163,7 +170,7 @@
include make/build.mk
clean: $(EXTRA_CLEANDEPS)
- rm -f $(ALLOBJS) $(DEPS) $(GENERATED) $(OUTBIN) $(OUTELF) $(OUTELF).lst
+ rm -f $(ALLOBJS) $(DEPS) $(GENERATED) $(OUTBIN) $(OUTELF) $(OUTELF).lst $(OUTELF_STRIP)
install: all
scp $(OUTBIN) 192.168.0.4:/tftproot