wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 1 | # |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 2 | # (C) Copyright 2000-2006 |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 3 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | # |
| 5 | # See file CREDITS for list of people who contributed to this |
| 6 | # project. |
| 7 | # |
| 8 | # This program is free software; you can redistribute it and/or |
| 9 | # modify it under the terms of the GNU General Public License as |
| 10 | # published by the Free Software Foundation; either version 2 of |
| 11 | # the License, or (at your option) any later version. |
| 12 | # |
| 13 | # This program is distributed in the hope that it will be useful, |
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | # GNU General Public License for more details. |
| 17 | # |
| 18 | # You should have received a copy of the GNU General Public License |
| 19 | # along with this program; if not, write to the Free Software |
| 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | # MA 02111-1307 USA |
| 22 | # |
| 23 | |
| 24 | LOAD_ADDR = 0x40000 |
| 25 | |
| 26 | include $(TOPDIR)/config.mk |
| 27 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 28 | PROG = $(obj)updater |
| 29 | IMAGE = $(obj)updater.image |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 30 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 31 | COBJS = update.o flash.o flash_hw.o utils.o cmd_flash.o string.o ctype.o dummy.o |
| 32 | COBJS_LINKS = stubs.o |
| 33 | AOBJS = ppcstring.o |
| 34 | AOBJS_LINKS = memio.o |
| 35 | |
| 36 | OBJS := $(addprefix $(obj),$(COBJS) $(COBJS_LINKS) $(AOBJS) $(AOBJS_LINKS)) |
| 37 | SRCS := $(COBJS:.o=.c) $(AOBJS:.o=.S) $(addprefix $(obj), $(COBJS_LINKS:.o:.c) $(AOBJS_LINKS:.o:.S)) |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 38 | |
| 39 | CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/board/MAI/AmigaOneG3SE |
| 40 | CFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 41 | AFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 42 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 43 | DEPS = $(OBJTREE)/u-boot.bin $(OBJTREE)/tools/mkimage |
| 44 | ifneq ($(DEPS),$(wildcard $(DEPS))) |
| 45 | $(error "updater: Missing required objects, please run regular build first") |
| 46 | endif |
| 47 | |
| 48 | all: $(obj).depend $(PROG) $(IMAGE) |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 49 | |
| 50 | ######################################################################### |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 51 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 52 | $(obj)%.srec: %.o $(LIB) |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 53 | $(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e $(<:.o=) $< $(LIB) |
| 54 | $(OBJCOPY) -O srec $(<:.o=) $@ |
| 55 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 56 | $(obj)%.o: %.c |
| 57 | $(CC) $(CFLAGS) -c -o $@ $< |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 58 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 59 | $(obj)%.o: %.S |
| 60 | $(CC) $(AFLAGS) -c -o $@ $< |
| 61 | |
| 62 | $(obj)memio.o: $(obj)memio.S |
| 63 | $(CC) $(AFLAGS) -c -o $@ $< |
| 64 | |
| 65 | $(obj)memio.S: |
| 66 | rm -f $(obj)memio.c |
| 67 | ln -s $(SRCTREE)/board/MAI/AmigaOneG3SE/memio.S $(obj)memio.S |
| 68 | |
| 69 | $(obj)stubs.o: $(obj)stubs.c |
| 70 | $(CC) $(CFLAGS) -c -o $@ $< |
| 71 | |
| 72 | $(obj)stubs.c: |
| 73 | rm -f $(obj)stubs.c |
| 74 | ln -s $(SRCTREE)/examples/stubs.c $(obj)stubs.c |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 75 | |
| 76 | ######################################################################### |
| 77 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 78 | $(obj)updater: $(OBJS) |
| 79 | $(LD) -g -Ttext $(LOAD_ADDR) -o $(obj)updater -e _main $(OBJS) |
| 80 | $(OBJCOPY) -O binary $(obj)updater $(obj)updater.bin |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 81 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 82 | $(obj)updater.image: $(obj)updater $(OBJTREE)/u-boot.bin |
| 83 | cat >/tmp/tempimage $(obj)updater.bin junk $(OBJTREE)/u-boot.bin |
| 84 | $(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \ |
| 85 | -e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \ |
| 86 | -n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 87 | rm /tmp/tempimage |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 88 | cp $(obj)updater.image /tftpboot |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 89 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 90 | (obj)updater.image2: $(obj)updater $(OBJTREE)/u-boot.bin |
| 91 | cat >/tmp/tempimage $(obj)updater.bin junk ../../create_image/image |
| 92 | $(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \ |
| 93 | -e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \ |
| 94 | -n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 95 | rm /tmp/tempimage |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 96 | cp $(obj)updater.image /tftpboot |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 97 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 98 | ######################################################################### |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 99 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 100 | # defines $(obj).depend target |
| 101 | include $(SRCTREE)/rules.mk |
| 102 | |
| 103 | sinclude $(obj).depend |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 104 | |
| 105 | ######################################################################### |