2 # Copyright (C) 2011 OpenWrt.org
3 # Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
9 include $(TOPDIR)/rules.mk
11 LZMA_TEXT_START := 0x80a00000
13 LOADER_NAME := $(basename $(notdir $(LOADER)))
25 LOADER_BIN := $(TARGET_DIR)/$(LOADER_NAME).bin
26 LOADER_GZ := $(TARGET_DIR)/$(LOADER_NAME).gz
27 LOADER_ELF := $(TARGET_DIR)/$(LOADER_NAME).elf
29 PKG_NAME := lzma-loader
30 PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)
32 .PHONY : loader-compile loader.bin loader.elf loader.gz
34 $(PKG_BUILD_DIR)/.prepared:
35 mkdir $(PKG_BUILD_DIR)
36 $(CP) ./src/* $(PKG_BUILD_DIR)/
39 loader-compile: $(PKG_BUILD_DIR)/.prepared
40 $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE="$(TARGET_CROSS)" \
41 LZMA_TEXT_START=$(LZMA_TEXT_START) \
42 LOADER_DATA=$(LOADER_DATA) \
43 FLASH_OFFS=$(FLASH_OFFS) \
44 FLASH_MAX=$(FLASH_MAX) \
46 PLATFORM="$(PLATFORM)" \
49 loader.gz: $(PKG_BUILD_DIR)/loader.bin
50 gzip -nc9 $< > $(LOADER_GZ)
52 loader.elf: $(PKG_BUILD_DIR)/loader.elf
53 $(CP) $< $(LOADER_ELF)
55 loader.bin: $(PKG_BUILD_DIR)/loader.bin
56 $(CP) $< $(LOADER_BIN)
59 prepare: $(PKG_BUILD_DIR)/.prepared
60 compile: loader-compile
65 rm -rf $(PKG_BUILD_DIR)