2002-11-19 11:04:11 +00:00
|
|
|
#
|
2006-09-01 17:49:50 +00:00
|
|
|
# (C) Copyright 2000-2006
|
2002-11-19 11:04:11 +00:00
|
|
|
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
#
|
|
|
|
# See file CREDITS for list of people who contributed to this
|
|
|
|
# project.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License as
|
|
|
|
# published by the Free Software Foundation; either version 2 of
|
|
|
|
# the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
# MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
|
|
|
LOAD_ADDR = 0x40000
|
|
|
|
|
|
|
|
include $(TOPDIR)/config.mk
|
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
PROG = $(obj)updater
|
|
|
|
IMAGE = $(obj)updater.image
|
2002-11-19 11:04:11 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
COBJS = update.o flash.o flash_hw.o utils.o cmd_flash.o string.o ctype.o dummy.o
|
|
|
|
COBJS_LINKS = stubs.o
|
|
|
|
AOBJS = ppcstring.o
|
|
|
|
AOBJS_LINKS = memio.o
|
|
|
|
|
|
|
|
OBJS := $(addprefix $(obj),$(COBJS) $(COBJS_LINKS) $(AOBJS) $(AOBJS_LINKS))
|
|
|
|
SRCS := $(COBJS:.o=.c) $(AOBJS:.o=.S) $(addprefix $(obj), $(COBJS_LINKS:.o:.c) $(AOBJS_LINKS:.o:.S))
|
2002-11-19 11:04:11 +00:00
|
|
|
|
|
|
|
CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/board/MAI/AmigaOneG3SE
|
|
|
|
CFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE
|
2006-09-01 17:49:50 +00:00
|
|
|
AFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE
|
|
|
|
|
|
|
|
DEPS = $(OBJTREE)/u-boot.bin $(OBJTREE)/tools/mkimage
|
|
|
|
ifneq ($(DEPS),$(wildcard $(DEPS)))
|
|
|
|
$(error "updater: Missing required objects, please run regular build first")
|
|
|
|
endif
|
2002-11-19 11:04:11 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
all: $(obj).depend $(PROG) $(IMAGE)
|
2002-11-19 11:04:11 +00:00
|
|
|
|
|
|
|
#########################################################################
|
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)%.srec: %.o $(LIB)
|
2002-11-19 11:04:11 +00:00
|
|
|
$(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e $(<:.o=) $< $(LIB)
|
|
|
|
$(OBJCOPY) -O srec $(<:.o=) $@
|
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
$(obj)%.o: %.S
|
|
|
|
$(CC) $(AFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
$(obj)memio.o: $(obj)memio.S
|
|
|
|
$(CC) $(AFLAGS) -c -o $@ $<
|
2002-11-19 11:04:11 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)memio.S:
|
|
|
|
rm -f $(obj)memio.c
|
|
|
|
ln -s $(SRCTREE)/board/MAI/AmigaOneG3SE/memio.S $(obj)memio.S
|
|
|
|
|
|
|
|
$(obj)stubs.o: $(obj)stubs.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
$(obj)stubs.c:
|
|
|
|
rm -f $(obj)stubs.c
|
|
|
|
ln -s $(SRCTREE)/examples/stubs.c $(obj)stubs.c
|
2002-11-19 11:04:11 +00:00
|
|
|
|
|
|
|
#########################################################################
|
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)updater: $(OBJS)
|
|
|
|
$(LD) -g -Ttext $(LOAD_ADDR) -o $(obj)updater -e _main $(OBJS)
|
|
|
|
$(OBJCOPY) -O binary $(obj)updater $(obj)updater.bin
|
2002-11-19 11:04:11 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
$(obj)updater.image: $(obj)updater $(OBJTREE)/u-boot.bin
|
|
|
|
cat >/tmp/tempimage $(obj)updater.bin junk $(OBJTREE)/u-boot.bin
|
|
|
|
$(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \
|
|
|
|
-e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \
|
|
|
|
-n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image
|
2002-11-19 11:04:11 +00:00
|
|
|
rm /tmp/tempimage
|
2006-09-01 17:49:50 +00:00
|
|
|
cp $(obj)updater.image /tftpboot
|
2002-11-19 11:04:11 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
(obj)updater.image2: $(obj)updater $(OBJTREE)/u-boot.bin
|
|
|
|
cat >/tmp/tempimage $(obj)updater.bin junk ../../create_image/image
|
|
|
|
$(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \
|
|
|
|
-e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \
|
|
|
|
-n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image
|
2002-11-19 11:04:11 +00:00
|
|
|
rm /tmp/tempimage
|
2006-09-01 17:49:50 +00:00
|
|
|
cp $(obj)updater.image /tftpboot
|
|
|
|
|
|
|
|
#########################################################################
|
2002-11-19 11:04:11 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
# defines $(obj).depend target
|
|
|
|
include $(SRCTREE)/rules.mk
|
2002-11-19 11:04:11 +00:00
|
|
|
|
2006-09-01 17:49:50 +00:00
|
|
|
sinclude $(obj).depend
|
2002-11-19 11:04:11 +00:00
|
|
|
|
|
|
|
#########################################################################
|