Makefile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. LOADER := loader.bin
  11. LOADER_NAME := $(basename $(notdir $(LOADER)))
  12. LOADER_DATA :=
  13. TARGET_DIR :=
  14. FLASH_OFFS :=
  15. FLASH_MAX :=
  16. BOARD :=
  17. ifeq ($(TARGET_DIR),)
  18. TARGET_DIR := $(KDIR)
  19. endif
  20. LOADER_BIN := $(TARGET_DIR)/$(LOADER_NAME).bin
  21. LOADER_GZ := $(TARGET_DIR)/$(LOADER_NAME).gz
  22. LOADER_ELF := $(TARGET_DIR)/$(LOADER_NAME).elf
  23. PKG_NAME := lzma-loader
  24. PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)
  25. .PHONY : loader-compile loader.bin loader.elf loader.gz
  26. $(PKG_BUILD_DIR)/.prepared:
  27. mkdir $(PKG_BUILD_DIR)
  28. $(CP) ./src/* $(PKG_BUILD_DIR)/
  29. touch $@
  30. loader-compile: $(PKG_BUILD_DIR)/.prepared
  31. $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE="$(TARGET_CROSS)" \
  32. LZMA_TEXT_START=$(LZMA_TEXT_START) \
  33. LOADER_DATA=$(LOADER_DATA) \
  34. FLASH_OFFS=$(FLASH_OFFS) \
  35. FLASH_MAX=$(FLASH_MAX) \
  36. BOARD="$(BOARD)" \
  37. clean all
  38. loader.gz: $(PKG_BUILD_DIR)/loader.bin
  39. gzip -nc9 $< > $(LOADER_GZ)
  40. loader.elf: $(PKG_BUILD_DIR)/loader.elf
  41. $(CP) $< $(LOADER_ELF)
  42. loader.bin: $(PKG_BUILD_DIR)/loader.bin
  43. $(CP) $< $(LOADER_BIN)
  44. download:
  45. prepare: $(PKG_BUILD_DIR)/.prepared
  46. compile: loader-compile
  47. install:
  48. clean:
  49. rm -rf $(PKG_BUILD_DIR)