Makefile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #
  2. # (C) Copyright 2000-2006
  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. LOAD_ADDR = 0x40000
  24. include $(TOPDIR)/config.mk
  25. PROG = $(obj)updater
  26. IMAGE = $(obj)updater.image
  27. COBJS = update.o flash.o flash_hw.o utils.o cmd_flash.o string.o ctype.o dummy.o
  28. COBJS_LINKS = stubs.o
  29. AOBJS = ppcstring.o
  30. AOBJS_LINKS = memio.o
  31. OBJS := $(addprefix $(obj),$(COBJS) $(COBJS_LINKS) $(AOBJS) $(AOBJS_LINKS))
  32. SRCS := $(COBJS:.o=.c) $(AOBJS:.o=.S) $(addprefix $(obj), $(COBJS_LINKS:.o:.c) $(AOBJS_LINKS:.o:.S))
  33. CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/board/MAI/AmigaOneG3SE
  34. CFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE
  35. AFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE
  36. DEPS = $(OBJTREE)/u-boot.bin $(OBJTREE)/tools/mkimage
  37. ifneq ($(DEPS),$(wildcard $(DEPS)))
  38. $(error "updater: Missing required objects, please run regular build first")
  39. endif
  40. all: $(obj).depend $(PROG) $(IMAGE)
  41. #########################################################################
  42. $(obj)%.srec: %.o $(LIB)
  43. $(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e $(<:.o=) $< $(LIB)
  44. $(OBJCOPY) -O srec $(<:.o=) $@
  45. $(obj)%.o: %.c
  46. $(CC) $(CFLAGS) -c -o $@ $<
  47. $(obj)%.o: %.S
  48. $(CC) $(AFLAGS) -c -o $@ $<
  49. $(obj)memio.o: $(obj)memio.S
  50. $(CC) $(AFLAGS) -c -o $@ $<
  51. $(obj)memio.S:
  52. rm -f $(obj)memio.c
  53. ln -s $(SRCTREE)/board/MAI/AmigaOneG3SE/memio.S $(obj)memio.S
  54. $(obj)stubs.o: $(obj)stubs.c
  55. $(CC) $(CFLAGS) -c -o $@ $<
  56. $(obj)stubs.c:
  57. rm -f $(obj)stubs.c
  58. ln -s $(SRCTREE)/examples/stubs.c $(obj)stubs.c
  59. #########################################################################
  60. $(obj)updater: $(OBJS)
  61. $(LD) -g -Ttext $(LOAD_ADDR) -o $(obj)updater -e _main $(OBJS)
  62. $(OBJCOPY) -O binary $(obj)updater $(obj)updater.bin
  63. $(obj)updater.image: $(obj)updater $(OBJTREE)/u-boot.bin
  64. cat >/tmp/tempimage $(obj)updater.bin junk $(OBJTREE)/u-boot.bin
  65. $(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \
  66. -e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \
  67. -n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image
  68. rm /tmp/tempimage
  69. cp $(obj)updater.image /tftpboot
  70. (obj)updater.image2: $(obj)updater $(OBJTREE)/u-boot.bin
  71. cat >/tmp/tempimage $(obj)updater.bin junk ../../create_image/image
  72. $(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \
  73. -e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \
  74. -n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image
  75. rm /tmp/tempimage
  76. cp $(obj)updater.image /tftpboot
  77. #########################################################################
  78. # defines $(obj).depend target
  79. include $(SRCTREE)/rules.mk
  80. sinclude $(obj).depend
  81. #########################################################################