lantiq: add lzma-loader source
[openwrt/svn-archive/archive.git] / target / linux / lantiq / image / lzma-loader / Makefile
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
9 include $(TOPDIR)/rules.mk
10
11 LZMA_TEXT_START := 0x80a00000
12 LOADER := loader.bin
13 LOADER_NAME := $(basename $(notdir $(LOADER)))
14 LOADER_DATA :=
15 TARGET_DIR :=
16 FLASH_OFFS :=
17 FLASH_MAX :=
18 BOARD :=
19
20 ifeq ($(TARGET_DIR),)
21 TARGET_DIR := $(KDIR)
22 endif
23
24 LOADER_BIN := $(TARGET_DIR)/$(LOADER_NAME).bin
25 LOADER_GZ := $(TARGET_DIR)/$(LOADER_NAME).gz
26 LOADER_ELF := $(TARGET_DIR)/$(LOADER_NAME).elf
27
28 PKG_NAME := lzma-loader
29 PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)
30
31 .PHONY : loader-compile loader.bin loader.elf loader.gz
32
33 $(PKG_BUILD_DIR)/.prepared:
34 mkdir $(PKG_BUILD_DIR)
35 $(CP) ./src/* $(PKG_BUILD_DIR)/
36 touch $@
37
38 loader-compile: $(PKG_BUILD_DIR)/.prepared
39 $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE="$(TARGET_CROSS)" \
40 LZMA_TEXT_START=$(LZMA_TEXT_START) \
41 LOADER_DATA=$(LOADER_DATA) \
42 FLASH_OFFS=$(FLASH_OFFS) \
43 FLASH_MAX=$(FLASH_MAX) \
44 BOARD="$(BOARD)" \
45 PLATFORM="lantiq" \
46 clean all
47
48 loader.gz: $(PKG_BUILD_DIR)/loader.bin
49 gzip -nc9 $< > $(LOADER_GZ)
50
51 loader.elf: $(PKG_BUILD_DIR)/loader.elf
52 $(CP) $< $(LOADER_ELF)
53
54 loader.bin: $(PKG_BUILD_DIR)/loader.bin
55 $(CP) $< $(LOADER_BIN)
56
57 download:
58 prepare: $(PKG_BUILD_DIR)/.prepared
59 compile: loader-compile
60
61 install:
62
63 clean:
64 rm -rf $(PKG_BUILD_DIR)
65