360a87f657810257442b5cf9873fdc4ddf0914e6
[openwrt/openwrt.git] / target / linux / adm5120-2.6 / image / Makefile
1 #
2 # Copyright (C) 2006,2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 IMGNAME = $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)
11 LOADER_MAKE = $(MAKE) -C lzma-loader KDIR=$(KDIR)
12
13 define Image/Build/Loader
14 $(LOADER_MAKE) LOADER=loader-$(1).$(2) LOADER_DATA="" \
15 LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \
16 CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \
17 compile loader.$(2)
18 endef
19
20 define Build/Clean
21 $(LOADER_MAKE) clean
22 endef
23
24 define Image/Prepare
25 cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
26 endef
27
28 define trxalign/jffs2-128k
29 -a 0x20000
30 endef
31 define trxalign/jffs2-64k
32 -a 0x10000
33 endef
34 define trxalign/squashfs
35 -a 1024
36 endef
37
38 define Image/Build/TRX
39 $(STAGING_DIR)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \
40 $(call trxalign/$(2)) -f $(KDIR)/root.$(2)
41 endef
42
43 define Image/Build/TRXNoloader
44 $(STAGING_DIR)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
45 $(call trxalign/$(2)) -f $(KDIR)/root.$(2)
46 endef
47
48 define Image/Build/Compex
49 $(call Image/Build/Loader,$(2),gz,0x80500000,0,y,$(2))
50 $(call Image/Build/TRX,$(IMGNAME)-$(3)-$(2).trx,$(1),$(KDIR)/loader-$(2).gz)
51 endef
52
53 define Image/Build/Edimax
54 $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2))
55 $(call Image/Build/TRXNoloader,$(IMGNAME)-$(3)-$(2).trx,$(1))
56 $(STAGING_DIR)/bin/mkcsysimg -B $(4) -d -w \
57 -r $(KDIR)/loader-$(2).gz \
58 -x $(IMGNAME)-$(3)-$(2).trx \
59 $(IMGNAME)-$(3)-$(2).bin
60 endef
61
62 define Image/Build/Infineon
63 $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2))
64 $(call Image/Build/TRXNoloader,$(IMGNAME)-$(3)-$(2).trx,$(1))
65 dd if=$(KDIR)/loader-$(2).gz of=$(IMGNAME)-$(3)-$(2).img bs=64k conv=sync
66 cat $(IMGNAME)-$(3)-$(2).trx >>$(IMGNAME)-$(3)-$(2).img
67 endef
68
69 define Image/Build/MyLoader
70 $(call Image/Build/Loader,$(2),gz,0x80500000,0)
71 $(call Image/Build/TRXNoloader,$(IMGNAME)-$(3)-$(2).trx,$(1))
72 $(STAGING_DIR)/bin/mkmylofw -B $(4) \
73 -p0x20000:0x10000:ahp:0x80001000 \
74 -p0x30000:0 \
75 -b0x20000:0x10000:h:$(KDIR)/loader-$(2).gz \
76 -b0x30000:0::$(IMGNAME)-$(3)-$(2).trx \
77 $(IMGNAME)-$(3)-$(2).bin
78 endef
79
80 define Image/Build/RouterBoard
81 $(CP) $(KDIR)/vmlinux.elf $(IMGNAME)-vmlinux
82 endef
83
84 define Image/Build
85 # this line is here intentionally
86 ifneq ($(1),jffs2-256k)
87 ifneq ($(1),jffs2-128k)
88 $(call Image/Build/Compex,$(1),wp54g-wrt,$(patsubst jffs2-%,jffs2,$(1)),WP54G-WRT)
89 $(call Image/Build/Edimax,$(1),br-6104k,$(patsubst jffs2-%,jffs2,$(1)),BR-6104K)
90 $(call Image/Build/Edimax,$(1),br-6104kp,$(patsubst jffs2-%,jffs2,$(1)),BR-6104KP)
91 $(call Image/Build/Edimax,$(1),br-6114wg,$(patsubst jffs2-%,jffs2,$(1)),BR-6114WG)
92 $(call Image/Build/Edimax,$(1),br-6524k,$(patsubst jffs2-%,jffs2,$(1)),BR-6524K)
93 $(call Image/Build/Edimax,$(1),br-6524kp,$(patsubst jffs2-%,jffs2,$(1)),BR-6524KP)
94 $(call Image/Build/Edimax,$(1),br-6541k,$(patsubst jffs2-%,jffs2,$(1)),BR-6541K)
95 $(call Image/Build/Edimax,$(1),br-6541kp,$(patsubst jffs2-%,jffs2,$(1)),BR-6541KP)
96 $(call Image/Build/Edimax,$(1),ew-7207apg,$(patsubst jffs2-%,jffs2,$(1)),EW-7207APg)
97 $(call Image/Build/Edimax,$(1),ps-1205uwg,$(patsubst jffs2-%,jffs2,$(1)),PS-1205UWg)
98 $(call Image/Build/Edimax,$(1),ps-3205u,$(patsubst jffs2-%,jffs2,$(1)),PS-3205U)
99 $(call Image/Build/Edimax,$(1),ps-3205uwg,$(patsubst jffs2-%,jffs2,$(1)),PS-3205UWg)
100 $(call Image/Build/Edimax,$(1),br-6524wg,$(patsubst jffs2-%,jffs2,$(1)),BR-6524WG)
101 $(call Image/Build/Edimax,$(1),br-6524wp,$(patsubst jffs2-%,jffs2,$(1)),BR-6524WP)
102 $(call Image/Build/Infineon,$(1),easy-5120,$(patsubst jffs2-%,jffs2,$(1)))
103 $(call Image/Build/Infineon,$(1),easy-5120-rt,$(patsubst jffs2-%,jffs2,$(1)))
104 $(call Image/Build/Infineon,$(1),easy-5120p-ata,$(patsubst jffs2-%,jffs2,$(1)))
105 $(call Image/Build/Infineon,$(1),easy-83000,$(patsubst jffs2-%,jffs2,$(1)))
106 $(call Image/Build/MyLoader,$(1),np27g,$(patsubst jffs2-%,jffs2,$(1)),NP27G)
107 $(call Image/Build/MyLoader,$(1),np28g,$(patsubst jffs2-%,jffs2,$(1)),NP28G)
108 $(call Image/Build/MyLoader,$(1),np28ghs,$(patsubst jffs2-%,jffs2,$(1)),NP28GHS)
109 $(call Image/Build/MyLoader,$(1),wp54g,$(patsubst jffs2-%,jffs2,$(1)),WP54G)
110 $(call Image/Build/MyLoader,$(1),wp54ag,$(patsubst jffs2-%,jffs2,$(1)),WP54AG)
111 $(call Image/Build/MyLoader,$(1),wpp54g,$(patsubst jffs2-%,jffs2,$(1)),WPP54G)
112 $(call Image/Build/MyLoader,$(1),wpp54ag,$(patsubst jffs2-%,jffs2,$(1)),WPP54AG)
113 endif
114 endif
115 ifeq ($(1),tgz)
116 $(call Image/Build/RouterBoard)
117 endif
118 endef
119
120 define Image/Build/LZMAKernel
121 $(LOADER_MAKE) TARGET_DIR=$(BIN_DIR) \
122 LOADER=openwrt-$(BOARD)-$(KERNEL)-ramfs-lzma-$(1).$(2) \
123 LOADER_DATA=$(KDIR)/vmlinux.lzma \
124 LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \
125 CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \
126 compile loader.$(2)
127 endef
128
129 define Image/Build/LZMAKernel/Compex
130 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0,y,$(1))
131 endef
132
133 define Image/Build/LZMAKernel/Generic
134 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0)
135 endef
136
137 define Image/Build/LZMAKernel/Admboot
138 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0x6D8,y,$(1))
139 endef
140
141 define Image/Build/Initramfs
142 $(call Image/Build/LZMAKernel/Generic,generic,bin)
143 $(call Image/Build/LZMAKernel/Generic,rb-100,elf)
144 $(call Image/Build/LZMAKernel/Generic,np27g,bin)
145 $(call Image/Build/LZMAKernel/Generic,wp54g,bin)
146 $(call Image/Build/LZMAKernel/Compex,wp54g-wrt,bin)
147 $(call Image/Build/LZMAKernel/Admboot,br-6104k,gz)
148 $(call Image/Build/LZMAKernel/Admboot,easy-5120,gz)
149 $(call Image/Build/LZMAKernel/Admboot,easy-83000,gz)
150 $(call Image/Build/LZMAKernel/Admboot,cas-630,gz)
151 $(call Image/Build/LZMAKernel/Admboot,cas-670,gz)
152 $(call Image/Build/LZMAKernel/Admboot,cas-700,gz)
153 $(call Image/Build/LZMAKernel/Admboot,cas-771,gz)
154 $(call Image/Build/LZMAKernel/Admboot,cas-790,gz)
155 $(call Image/Build/LZMAKernel/Admboot,cas-861,gz)
156 endef
157
158 $(eval $(call BuildImage))