blob: 3fa1912416491084712d04da4e8c254cbfa2d3b2 [file] [log] [blame]
wdenkc7de8292002-11-19 11:04:11 +00001#
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
24LOAD_ADDR = 0x40000
25
26include $(TOPDIR)/config.mk
27
28PROG = updater
29IMAGE = updater.image
30SRC = update.c flash.c flash_hw.c utils.c cmd_flash.c string.c ctype.c dummy.c
31ASRC = ppcstring.S
wdenk8bde7f72003-06-27 21:31:46 +000032OBJS = $(SRC:.c=.o) $(ASRC:.S=.o)
wdenkc7de8292002-11-19 11:04:11 +000033
wdenk27b207f2003-07-24 23:38:38 +000034LIB = $(TOPDIR)/examples/libstubs.a
35LIBAOBJS=
36LIBCOBJS= $(TOPDIR)/examples/stubs.o
wdenkc7de8292002-11-19 11:04:11 +000037LIBOBJS = $(LIBAOBJS) $(LIBCOBJS)
38
39CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/board/MAI/AmigaOneG3SE
40CFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE
41
42all: .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
wdenk8bde7f72003-06-27 21:31:46 +000053 $(CC) $(CPPFLAGS) -c $<
wdenkc7de8292002-11-19 11:04:11 +000054
55%.o: %.S
56 $(CC) $(CPPFLAGS) -c $<
57
58#########################################################################
59
wdenk8bde7f72003-06-27 21:31:46 +000060updater: $(OBJS) $(LIB) $(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o
wdenkc7de8292002-11-19 11:04:11 +000061 $(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
65updater.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
73updater.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
84sinclude .depend
85
86#########################################################################