simplify and fix adm5120 image building, fix broken FEATURES handling
[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 = $(NO_TRACE_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/cmdline/yaffs2
81 root=/dev/mtdblock1 rootfstype=yaffs2 init=/etc/preinit
82 endef
83
84 define Image/Build/RouterBoard
85 $(CP) $(KDIR)/vmlinux.elf $(IMGNAME)-rb1xx-vmlinux
86 $(STAGING_DIR)/bin/patch-cmdline $(KDIR)/vmlinux.elf '$(strip $(call Image/cmdline/yaffs2)) '
87 endef
88
89 define Image/Build/jffs2-64k
90 $(call Image/Build/Compex,$(1),wp54g-wrt,$(patsubst jffs2-%,jffs2,$(1)),WP54G-WRT)
91 ifeq ($(CONFIG_DEVEL),y)
92 $(call Image/Build/Edimax,$(1),br-6104k,$(patsubst jffs2-%,jffs2,$(1)),BR-6104K)
93 $(call Image/Build/Edimax,$(1),br-6104kp,$(patsubst jffs2-%,jffs2,$(1)),BR-6104KP)
94 $(call Image/Build/Edimax,$(1),br-6114wg,$(patsubst jffs2-%,jffs2,$(1)),BR-6114WG)
95 $(call Image/Build/Edimax,$(1),br-6524k,$(patsubst jffs2-%,jffs2,$(1)),BR-6524K)
96 $(call Image/Build/Edimax,$(1),br-6524kp,$(patsubst jffs2-%,jffs2,$(1)),BR-6524KP)
97 $(call Image/Build/Edimax,$(1),br-6541k,$(patsubst jffs2-%,jffs2,$(1)),BR-6541K)
98 $(call Image/Build/Edimax,$(1),br-6541kp,$(patsubst jffs2-%,jffs2,$(1)),BR-6541KP)
99 $(call Image/Build/Edimax,$(1),ew-7207apg,$(patsubst jffs2-%,jffs2,$(1)),EW-7207APg)
100 $(call Image/Build/Edimax,$(1),ps-1205uwg,$(patsubst jffs2-%,jffs2,$(1)),PS-1205UWg)
101 $(call Image/Build/Edimax,$(1),ps-3205u,$(patsubst jffs2-%,jffs2,$(1)),PS-3205U)
102 $(call Image/Build/Edimax,$(1),ps-3205uwg,$(patsubst jffs2-%,jffs2,$(1)),PS-3205UWg)
103 $(call Image/Build/Edimax,$(1),br-6524wg,$(patsubst jffs2-%,jffs2,$(1)),BR-6524WG)
104 $(call Image/Build/Edimax,$(1),br-6524wp,$(patsubst jffs2-%,jffs2,$(1)),BR-6524WP)
105 $(call Image/Build/Infineon,$(1),easy-5120p-ata,$(patsubst jffs2-%,jffs2,$(1)))
106 $(call Image/Build/Infineon,$(1),easy-5120-rt,$(patsubst jffs2-%,jffs2,$(1)))
107 $(call Image/Build/Infineon,$(1),easy-5120-wvoip,$(patsubst jffs2-%,jffs2,$(1)))
108 $(call Image/Build/Infineon,$(1),easy-83000,$(patsubst jffs2-%,jffs2,$(1)))
109 $(call Image/Build/MyLoader,$(1),np27g,$(patsubst jffs2-%,jffs2,$(1)),NP27G)
110 $(call Image/Build/MyLoader,$(1),np28g,$(patsubst jffs2-%,jffs2,$(1)),NP28G)
111 $(call Image/Build/MyLoader,$(1),np28ghs,$(patsubst jffs2-%,jffs2,$(1)),NP28GHS)
112 $(call Image/Build/MyLoader,$(1),wp54g,$(patsubst jffs2-%,jffs2,$(1)),WP54G)
113 $(call Image/Build/MyLoader,$(1),wp54ag,$(patsubst jffs2-%,jffs2,$(1)),WP54AG)
114 $(call Image/Build/MyLoader,$(1),wpp54g,$(patsubst jffs2-%,jffs2,$(1)),WPP54G)
115 $(call Image/Build/MyLoader,$(1),wpp54ag,$(patsubst jffs2-%,jffs2,$(1)),WPP54AG)
116 endif
117 endef
118
119 define Image/Build/squashfs
120 $(call Image/Build/jffs2-64k,$(1))
121 endef
122
123 define Image/Build
124 $(call Image/Build/$(1),$(1))
125 endef
126
127 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
128 define Image/BuildKernel
129 $(call Image/Build/RouterBoard)
130 endef
131 endif
132
133 define Image/Build/LZMAKernel
134 $(LOADER_MAKE) TARGET_DIR=$(BIN_DIR) \
135 LOADER=openwrt-$(BOARD)-$(KERNEL)-ramfs-lzma-$(1).$(2) \
136 LOADER_DATA=$(KDIR)/vmlinux.lzma \
137 LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \
138 CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \
139 compile loader.$(2)
140 endef
141
142 define Image/Build/LZMAKernel/Compex
143 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0,y,$(1))
144 endef
145
146 define Image/Build/LZMAKernel/Generic
147 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0)
148 endef
149
150 define Image/Build/LZMAKernel/Admboot
151 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0x6D8,y,$(1))
152 endef
153
154 define Image/Build/Initramfs/RouterBoard
155 $(CP) $(KDIR)/vmlinux.elf $(IMGNAME)-ramfs-rb1xx.elf
156 endef
157
158 define Image/Build/Initramfs
159 $(call Image/Build/Initramfs/RouterBoard)
160 $(call Image/Build/LZMAKernel/Compex,wp54g-wrt,bin)
161 ifeq ($(CONFIG_DEVEL),y)
162 $(call Image/Build/LZMAKernel/Generic,generic,bin)
163 $(call Image/Build/LZMAKernel/Generic,np27g,bin)
164 $(call Image/Build/LZMAKernel/Generic,wp54g,bin)
165 $(call Image/Build/LZMAKernel/Admboot,br-6104k,gz)
166 $(call Image/Build/LZMAKernel/Admboot,easy-5120,gz)
167 $(call Image/Build/LZMAKernel/Admboot,easy-83000,gz)
168 $(call Image/Build/LZMAKernel/Admboot,cas-630,gz)
169 $(call Image/Build/LZMAKernel/Admboot,cas-670,gz)
170 $(call Image/Build/LZMAKernel/Admboot,cas-700,gz)
171 $(call Image/Build/LZMAKernel/Admboot,cas-771,gz)
172 $(call Image/Build/LZMAKernel/Admboot,cas-790,gz)
173 $(call Image/Build/LZMAKernel/Admboot,cas-861,gz)
174 endif
175 endef
176
177 $(eval $(call BuildImage))
This page took 0.056566 seconds and 5 git commands to generate.