1
0

Makefile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #
  2. # Copyright (C) 2011 OpenWrt.org
  3. # Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. include $(TOPDIR)/rules.mk
  9. LZMA_TEXT_START := 0x80a00000
  10. LOADADDR := 0x80060000
  11. LOADER := loader.bin
  12. LOADER_NAME := $(basename $(notdir $(LOADER)))
  13. LOADER_DATA :=
  14. TARGET_DIR :=
  15. FLASH_OFFS :=
  16. FLASH_MAX :=
  17. BOARD :=
  18. ifeq ($(TARGET_DIR),)
  19. TARGET_DIR := $(KDIR)
  20. endif
  21. LOADER_BIN := $(TARGET_DIR)/$(LOADER_NAME).bin
  22. LOADER_GZ := $(TARGET_DIR)/$(LOADER_NAME).gz
  23. LOADER_ELF := $(TARGET_DIR)/$(LOADER_NAME).elf
  24. PKG_NAME := lzma-loader
  25. PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)
  26. .PHONY : loader-compile loader.bin loader.elf loader.gz
  27. $(PKG_BUILD_DIR)/.prepared:
  28. mkdir $(PKG_BUILD_DIR)
  29. $(CP) ./src/* $(PKG_BUILD_DIR)/
  30. touch $@
  31. loader-compile: $(PKG_BUILD_DIR)/.prepared
  32. $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE="$(TARGET_CROSS)" \
  33. LZMA_TEXT_START=$(LZMA_TEXT_START) \
  34. LOADADDR=$(LOADADDR) \
  35. LOADER_DATA=$(LOADER_DATA) \
  36. FLASH_OFFS=$(FLASH_OFFS) \
  37. FLASH_MAX=$(FLASH_MAX) \
  38. BOARD="$(BOARD)" \
  39. clean all
  40. loader.gz: $(PKG_BUILD_DIR)/loader.bin
  41. gzip -nc9 $< > $(LOADER_GZ)
  42. loader.elf: $(PKG_BUILD_DIR)/loader.elf
  43. $(CP) $< $(LOADER_ELF)
  44. loader.bin: $(PKG_BUILD_DIR)/loader.bin
  45. $(CP) $< $(LOADER_BIN)
  46. download:
  47. prepare: $(PKG_BUILD_DIR)/.prepared
  48. compile: loader-compile
  49. install:
  50. clean:
  51. rm -rf $(PKG_BUILD_DIR)