ramips: Add support for mt7621 to lzma-loader
[oweals/openwrt.git] / target / linux / ramips / 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 PLATFORM        :=
20
21 ifeq ($(TARGET_DIR),)
22 TARGET_DIR      := $(KDIR)
23 endif
24
25 LOADER_BIN      := $(TARGET_DIR)/$(LOADER_NAME).bin
26 LOADER_GZ       := $(TARGET_DIR)/$(LOADER_NAME).gz
27 LOADER_ELF      := $(TARGET_DIR)/$(LOADER_NAME).elf
28
29 PKG_NAME := lzma-loader
30 PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)
31
32 .PHONY : loader-compile loader.bin loader.elf loader.gz
33
34 $(PKG_BUILD_DIR)/.prepared:
35         mkdir $(PKG_BUILD_DIR)
36         $(CP) ./src/* $(PKG_BUILD_DIR)/
37         touch $@
38
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) \
45                 BOARD="$(BOARD)" \
46                 PLATFORM="$(PLATFORM)" \
47                 clean all
48
49 loader.gz: $(PKG_BUILD_DIR)/loader.bin
50         gzip -nc9 $< > $(LOADER_GZ)
51
52 loader.elf: $(PKG_BUILD_DIR)/loader.elf
53         $(CP) $< $(LOADER_ELF)
54
55 loader.bin: $(PKG_BUILD_DIR)/loader.bin
56         $(CP) $< $(LOADER_BIN)
57
58 download:
59 prepare: $(PKG_BUILD_DIR)/.prepared
60 compile: loader-compile
61
62 install:
63
64 clean:
65         rm -rf $(PKG_BUILD_DIR)
66