Chris Zankel | 4bedea9 | 2005-06-23 22:01:12 -0700 | [diff] [blame] | 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 | |
| 7 | GZIP = gzip |
| 8 | GZIP_FLAGS = -v9fc |
| 9 | ifeq ($(BIG_ENDIAN),1) |
| 10 | OBJCOPY_ARGS := -O elf32-xtensa-be |
| 11 | else |
| 12 | OBJCOPY_ARGS := -O elf32-xtensa-le |
| 13 | endif |
| 14 | |
Chris Zankel | e7d163f | 2005-06-30 02:58:59 -0700 | [diff] [blame] | 15 | LD_ARGS = -T $(srctree)/$(obj)/boot.ld |
Chris Zankel | 4bedea9 | 2005-06-23 22:01:12 -0700 | [diff] [blame] | 16 | |
| 17 | boot-y := bootstrap.o |
| 18 | |
| 19 | OBJS := $(addprefix $(obj)/,$(boot-y)) |
Chris Zankel | e7d163f | 2005-06-30 02:58:59 -0700 | [diff] [blame] | 20 | LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a |
Chris Zankel | 4bedea9 | 2005-06-23 22:01:12 -0700 | [diff] [blame] | 21 | |
Sam Ravnborg | a0f97e0 | 2007-10-14 22:21:35 +0200 | [diff] [blame] | 22 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
Chris Zankel | 4bedea9 | 2005-06-23 22:01:12 -0700 | [diff] [blame] | 23 | |
Max Filippov | 7c94fe4 | 2012-09-17 05:44:49 +0400 | [diff] [blame] | 24 | vmlinux.tmp: vmlinux |
Bob Wilson | bdd362f | 2008-02-01 16:56:32 -0800 | [diff] [blame] | 25 | $(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \ |
Max Filippov | 7c94fe4 | 2012-09-17 05:44:49 +0400 | [diff] [blame] | 26 | $^ $@ |
| 27 | |
| 28 | vmlinux.tmp.gz: vmlinux.tmp |
| 29 | $(GZIP) $(GZIP_FLAGS) $^ > $@ |
| 30 | |
| 31 | zImage: vmlinux.tmp.gz $(OBJS) $(LIBS) |
Chris Zankel | 4bedea9 | 2005-06-23 22:01:12 -0700 | [diff] [blame] | 32 | $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \ |
| 33 | --add-section image=vmlinux.tmp.gz \ |
| 34 | --set-section-flags image=contents,alloc,load,load,data \ |
| 35 | $(OBJS) $@.tmp |
| 36 | $(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC) |
Chris Zankel | e7d163f | 2005-06-30 02:58:59 -0700 | [diff] [blame] | 37 | $(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/$@.redboot |