bmips: add new target
[openwrt/openwrt.git] / target / linux / bmips / image / lzma-loader / Makefile
1 # SPDX-License-Identifier: GPL-2.0-or-later
2
3 #
4 # Copyright (C) 2020 Álvaro Fernández Rojas <noltari@gmail.com>
5 # Copyright (C) 2014 Jonas Gorski <jogo@openwrt.org>
6 # Copyright (C) 2011 OpenWrt.org
7 # Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
8 #
9
10 include $(TOPDIR)/rules.mk
11
12 LZMA_TEXT_START := 0x80a00000
13 LOADER := loader.bin
14 LOADER_NAME := $(basename $(notdir $(LOADER)))
15 LOADER_DATA :=
16 TARGET_DIR :=
17
18 UART_BASE_3329 := 0xb0000100
19 UART_BASE_3368 := 0xfff8c100
20 UART_BASE_3380 := 0xb4e00200
21 UART_BASE_3383 := 0xb4e00500
22 UART_BASE_3384 := 0xb4e00500
23 UART_BASE_6318 := 0xb0000100
24 UART_BASE_6328 := 0xb0000100
25 UART_BASE_6338 := 0xfffe0300
26 UART_BASE_6345 := 0xfffe0300
27 UART_BASE_6348 := 0xfffe0300
28 UART_BASE_6358 := 0xfffe0100
29 UART_BASE_6362 := 0xb0000100
30 UART_BASE_6368 := 0xb0000100
31 UART_BASE_63268 := 0xb0000180
32 UART_BASE_6816 := 0xb0000100
33 UART_BASE_6818 := 0xb0000100
34 UART_BASE_6828 := 0xb0000180
35 UART_BASE := $(if $(UART_BASE_$(CHIP_ID)),$(UART_BASE_$(CHIP_ID)),0)
36
37 ifeq ($(TARGET_DIR),)
38 TARGET_DIR := $(KDIR)
39 endif
40
41 LOADER_BIN := $(TARGET_DIR)/$(LOADER_NAME).bin
42 LOADER_ELF := $(TARGET_DIR)/$(LOADER_NAME).elf
43
44 PKG_NAME := lzma-loader
45 PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)
46
47 .PHONY : loader-compile loader.bin loader.elf
48
49 $(PKG_BUILD_DIR)/.prepared:
50 mkdir $(PKG_BUILD_DIR)
51 $(CP) ./src/* $(PKG_BUILD_DIR)/
52 touch $@
53
54 loader-compile: $(PKG_BUILD_DIR)/.prepared
55 $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE="$(TARGET_CROSS)" \
56 LZMA_TEXT_START=$(LZMA_TEXT_START) \
57 LOADER_DATA=$(LOADER_DATA) \
58 UART_BASE=$(UART_BASE) \
59 clean all
60
61 loader.elf: $(PKG_BUILD_DIR)/loader.elf
62 $(CP) $< $(LOADER_ELF)
63
64 loader.bin: $(PKG_BUILD_DIR)/loader.bin
65 $(CP) $< $(LOADER_BIN)
66
67 download:
68 prepare: $(PKG_BUILD_DIR)/.prepared
69 compile: loader-compile
70
71 install:
72
73 clean:
74 rm -rf $(PKG_BUILD_DIR)