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