1
0

Makefile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. PLATFORM="ralink" \
  38. clean all
  39. loader.gz: $(PKG_BUILD_DIR)/loader.bin
  40. gzip -nc9 $< > $(LOADER_GZ)
  41. loader.elf: $(PKG_BUILD_DIR)/loader.elf
  42. $(CP) $< $(LOADER_ELF)
  43. loader.bin: $(PKG_BUILD_DIR)/loader.bin
  44. $(CP) $< $(LOADER_BIN)
  45. download:
  46. prepare: $(PKG_BUILD_DIR)/.prepared
  47. compile: loader-compile
  48. install:
  49. clean:
  50. rm -rf $(PKG_BUILD_DIR)