Makefile 1.3 KB

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