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 | # |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | # SPDX-License-Identifier: GPL-2.0+ |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 6 | # |
| 7 | |
| 8 | LOAD_ADDR = 0x40000 |
| 9 | |
| 10 | include $(TOPDIR)/config.mk |
| 11 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 12 | PROG = $(obj)updater |
| 13 | IMAGE = $(obj)updater.image |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 14 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 15 | COBJS = update.o flash.o flash_hw.o utils.o cmd_flash.o string.o ctype.o dummy.o |
| 16 | COBJS_LINKS = stubs.o |
| 17 | AOBJS = ppcstring.o |
| 18 | AOBJS_LINKS = memio.o |
| 19 | |
| 20 | OBJS := $(addprefix $(obj),$(COBJS) $(COBJS_LINKS) $(AOBJS) $(AOBJS_LINKS)) |
| 21 | 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] | 22 | |
| 23 | CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/board/MAI/AmigaOneG3SE |
| 24 | CFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 25 | AFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 26 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 27 | DEPS = $(OBJTREE)/u-boot.bin $(OBJTREE)/tools/mkimage |
| 28 | ifneq ($(DEPS),$(wildcard $(DEPS))) |
| 29 | $(error "updater: Missing required objects, please run regular build first") |
| 30 | endif |
| 31 | |
| 32 | all: $(obj).depend $(PROG) $(IMAGE) |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 33 | |
| 34 | ######################################################################### |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 35 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 36 | $(obj)%.srec: %.o $(LIB) |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 37 | $(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e $(<:.o=) $< $(LIB) |
| 38 | $(OBJCOPY) -O srec $(<:.o=) $@ |
| 39 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 40 | $(obj)%.o: %.c |
| 41 | $(CC) $(CFLAGS) -c -o $@ $< |
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 | $(obj)%.o: %.S |
| 44 | $(CC) $(AFLAGS) -c -o $@ $< |
| 45 | |
| 46 | $(obj)memio.o: $(obj)memio.S |
| 47 | $(CC) $(AFLAGS) -c -o $@ $< |
| 48 | |
| 49 | $(obj)memio.S: |
| 50 | rm -f $(obj)memio.c |
| 51 | ln -s $(SRCTREE)/board/MAI/AmigaOneG3SE/memio.S $(obj)memio.S |
| 52 | |
| 53 | $(obj)stubs.o: $(obj)stubs.c |
| 54 | $(CC) $(CFLAGS) -c -o $@ $< |
| 55 | |
| 56 | $(obj)stubs.c: |
| 57 | rm -f $(obj)stubs.c |
| 58 | ln -s $(SRCTREE)/examples/stubs.c $(obj)stubs.c |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 59 | |
| 60 | ######################################################################### |
| 61 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 62 | $(obj)updater: $(OBJS) |
| 63 | $(LD) -g -Ttext $(LOAD_ADDR) -o $(obj)updater -e _main $(OBJS) |
| 64 | $(OBJCOPY) -O binary $(obj)updater $(obj)updater.bin |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 65 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 66 | $(obj)updater.image: $(obj)updater $(OBJTREE)/u-boot.bin |
| 67 | cat >/tmp/tempimage $(obj)updater.bin junk $(OBJTREE)/u-boot.bin |
| 68 | $(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \ |
| 69 | -e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \ |
| 70 | -n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 71 | rm /tmp/tempimage |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 72 | cp $(obj)updater.image /tftpboot |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 73 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 74 | (obj)updater.image2: $(obj)updater $(OBJTREE)/u-boot.bin |
| 75 | cat >/tmp/tempimage $(obj)updater.bin junk ../../create_image/image |
| 76 | $(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \ |
| 77 | -e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \ |
| 78 | -n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 79 | rm /tmp/tempimage |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 80 | cp $(obj)updater.image /tftpboot |
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 | ######################################################################### |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 83 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 84 | # defines $(obj).depend target |
| 85 | include $(SRCTREE)/rules.mk |
| 86 | |
| 87 | sinclude $(obj).depend |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 88 | |
| 89 | ######################################################################### |