kbuild: enable 'make CFLAGS=...' to add additional options to CC
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / xtensa / boot / boot-redboot / Makefile
CommitLineData
4bedea94
CZ
1#
2# This file is subject to the terms and conditions of the GNU General Public
3# License. See the file "COPYING" in the main directory of this archive
4# for more details.
5#
6
7GZIP = gzip
8GZIP_FLAGS = -v9fc
9ifeq ($(BIG_ENDIAN),1)
10OBJCOPY_ARGS := -O elf32-xtensa-be
11else
12OBJCOPY_ARGS := -O elf32-xtensa-le
13endif
14
e7d163f7 15LD_ARGS = -T $(srctree)/$(obj)/boot.ld
4bedea94
CZ
16
17boot-y := bootstrap.o
18
19OBJS := $(addprefix $(obj)/,$(boot-y))
e7d163f7 20LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
4bedea94 21
a0f97e06 22LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
4bedea94
CZ
23
24zImage: vmlinux $(OBJS) $(LIBS)
25 $(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \
e7d163f7 26 vmlinux vmlinux.tmp
4bedea94
CZ
27 gzip -vf9 vmlinux.tmp
28 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
29 --add-section image=vmlinux.tmp.gz \
30 --set-section-flags image=contents,alloc,load,load,data \
31 $(OBJS) $@.tmp
32 $(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC)
e7d163f7
CZ
33 $(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/$@.redboot
34 rm -f $@.tmp $@.elf vmlinux.tmp.gz
4bedea94 35