1#
2# Copyright (C) 2004-2006 Atmel Corporation
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License.  See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8
9MKIMAGE		:= $(srctree)/scripts/mkuboot.sh
10
11extra-y		:= vmlinux.bin vmlinux.gz
12
13OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note.gnu.build-id
14$(obj)/vmlinux.bin: vmlinux FORCE
15	$(call if_changed,objcopy)
16
17$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
18	$(call if_changed,gzip)
19
20quiet_cmd_uimage = UIMAGE $@
21      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A avr32 -O linux -T kernel	\
22		-C gzip -a $(CONFIG_LOAD_ADDRESS) -e $(CONFIG_ENTRY_ADDRESS)	\
23		-n 'Linux-$(KERNELRELEASE)' -d $< $@
24
25targets += uImage uImage.srec
26$(obj)/uImage: $(obj)/vmlinux.gz
27	$(call if_changed,uimage)
28	@echo '  Image $@ is ready'
29
30OBJCOPYFLAGS_uImage.srec := -I binary -O srec
31$(obj)/uImage.srec: $(obj)/uImage
32	$(call if_changed,objcopy)
33
34OBJCOPYFLAGS_vmlinux.elf := --change-section-lma .text-0x80000000 \
35			    --change-section-lma __ex_table-0x80000000 \
36			    --change-section-lma .rodata-0x80000000 \
37			    --change-section-lma .data-0x80000000 \
38			    --change-section-lma .init-0x80000000 \
39			    --change-section-lma .bss-0x80000000 \
40			    --change-section-lma __param-0x80000000 \
41			    --change-section-lma __ksymtab-0x80000000 \
42			    --change-section-lma __ksymtab_gpl-0x80000000 \
43			    --change-section-lma __kcrctab-0x80000000 \
44			    --change-section-lma __kcrctab_gpl-0x80000000 \
45			    --change-section-lma __ksymtab_strings-0x80000000 \
46			    --set-start 0xa0000000
47$(obj)/vmlinux.elf: vmlinux FORCE
48	$(call if_changed,objcopy)
49
50quiet_cmd_sfdwarf = SFDWARF $@
51      cmd_sfdwarf = sfdwarf $< TO $@ GNUAVR IW $(SFDWARF_FLAGS) > $(obj)/sfdwarf.log
52
53$(obj)/vmlinux.cso: $(obj)/vmlinux.elf FORCE
54	$(call if_changed,sfdwarf)
55
56install: $(BOOTIMAGE)
57	sh $(srctree)/install-kernel.sh $<
58
59# Generated files to be removed upon make clean
60clean-files	:= vmlinux.elf vmlinux.bin vmlinux.gz uImage uImage.srec
61