wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 1 | # |
| 2 | # (C) Copyright 2000 |
| 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 | |
| 28 | PROG = updater |
| 29 | IMAGE = updater.image |
| 30 | SRC = update.c flash.c flash_hw.c utils.c cmd_flash.c string.c ctype.c dummy.c |
| 31 | ASRC = ppcstring.S |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 32 | OBJS = $(SRC:.c=.o) $(ASRC:.S=.o) |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 33 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 34 | LIB = $(TOPDIR)/examples/libsyscall.a |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 35 | LIBAOBJS= $(TOPDIR)/examples/syscall.o |
| 36 | LIBCOBJS= |
| 37 | LIBOBJS = $(LIBAOBJS) $(LIBCOBJS) |
| 38 | |
| 39 | CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/board/MAI/AmigaOneG3SE |
| 40 | CFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE |
| 41 | |
| 42 | all: .depend $(LIB) $(PROG) |
| 43 | |
| 44 | ######################################################################### |
| 45 | $(LIB): .depend $(LIBOBJS) |
| 46 | $(AR) crv $@ $(LIBOBJS) |
| 47 | |
| 48 | %.srec: %.o $(LIB) |
| 49 | $(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e $(<:.o=) $< $(LIB) |
| 50 | $(OBJCOPY) -O srec $(<:.o=) $@ |
| 51 | |
| 52 | %.o: %.c |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 53 | $(CC) $(CPPFLAGS) -c $< |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 54 | |
| 55 | %.o: %.S |
| 56 | $(CC) $(CPPFLAGS) -c $< |
| 57 | |
| 58 | ######################################################################### |
| 59 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 60 | updater: $(OBJS) $(LIB) $(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 61 | $(LD) -g -Ttext $(LOAD_ADDR) -o updater -e _main $(OBJS) $(LIB) \ |
| 62 | $(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o |
| 63 | $(OBJCOPY) -O binary updater updater.bin |
| 64 | |
| 65 | updater.image: updater $(TOPDIR)/u-boot.bin |
| 66 | cat >/tmp/tempimage updater.bin junk $(TOPDIR)/u-boot.bin |
| 67 | $(TOPDIR)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \ |
| 68 | -e `ppc-elf32-nm updater | grep _main | cut --bytes=0-8` \ |
| 69 | -n "Firmware Updater" -d /tmp/tempimage updater.image |
| 70 | rm /tmp/tempimage |
| 71 | cp updater.image /tftpboot |
| 72 | |
| 73 | updater.image2: updater $(TOPDIR)/u-boot.bin |
| 74 | cat >/tmp/tempimage updater.bin junk ../../create_image/image |
| 75 | $(TOPDIR)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \ |
| 76 | -e `ppc-elf32-nm updater | grep _main | cut --bytes=0-8` \ |
| 77 | -n "Firmware Updater" -d /tmp/tempimage updater.image |
| 78 | rm /tmp/tempimage |
| 79 | cp updater.image /tftpboot |
| 80 | |
| 81 | .depend: Makefile $(SRC) $(ASRC) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S) |
| 82 | $(CC) -M $(CFLAGS) $(SRC) $(ASRC) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S) > $@ |
| 83 | |
| 84 | sinclude .depend |
| 85 | |
| 86 | ######################################################################### |