ee70b6b1aaab611bd9f7e021546e2bf3aa9932ac
[openwrt/svn-archive/archive.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
90 # this line is here intentionally
91 ifneq ($(1),jffs2-256k)
92 ifneq ($(1),jffs2-128k)
93 $(call Image/Build/Compex,$(1),wp54g-wrt,$(patsubst jffs2-%,jffs2,$(1)),WP54G-WRT)
94 ifeq ($(CONFIG_DEVEL),y)
95 $(call Image/Build/Edimax,$(1),br-6104k,$(patsubst jffs2-%,jffs2,$(1)),BR-6104K)
96 $(call Image/Build/Edimax,$(1),br-6104kp,$(patsubst jffs2-%,jffs2,$(1)),BR-6104KP)
97 $(call Image/Build/Edimax,$(1),br-6114wg,$(patsubst jffs2-%,jffs2,$(1)),BR-6114WG)
98 $(call Image/Build/Edimax,$(1),br-6524k,$(patsubst jffs2-%,jffs2,$(1)),BR-6524K)
99 $(call Image/Build/Edimax,$(1),br-6524kp,$(patsubst jffs2-%,jffs2,$(1)),BR-6524KP)
100 $(call Image/Build/Edimax,$(1),br-6541k,$(patsubst jffs2-%,jffs2,$(1)),BR-6541K)
101 $(call Image/Build/Edimax,$(1),br-6541kp,$(patsubst jffs2-%,jffs2,$(1)),BR-6541KP)
102 $(call Image/Build/Edimax,$(1),ew-7207apg,$(patsubst jffs2-%,jffs2,$(1)),EW-7207APg)
103 $(call Image/Build/Edimax,$(1),ps-1205uwg,$(patsubst jffs2-%,jffs2,$(1)),PS-1205UWg)
104 $(call Image/Build/Edimax,$(1),ps-3205u,$(patsubst jffs2-%,jffs2,$(1)),PS-3205U)
105 $(call Image/Build/Edimax,$(1),ps-3205uwg,$(patsubst jffs2-%,jffs2,$(1)),PS-3205UWg)
106 $(call Image/Build/Edimax,$(1),br-6524wg,$(patsubst jffs2-%,jffs2,$(1)),BR-6524WG)
107 $(call Image/Build/Edimax,$(1),br-6524wp,$(patsubst jffs2-%,jffs2,$(1)),BR-6524WP)
108 $(call Image/Build/Infineon,$(1),easy-5120p-ata,$(patsubst jffs2-%,jffs2,$(1)))
109 $(call Image/Build/Infineon,$(1),easy-5120-rt,$(patsubst jffs2-%,jffs2,$(1)))
110 $(call Image/Build/Infineon,$(1),easy-5120-wvoip,$(patsubst jffs2-%,jffs2,$(1)))
111 $(call Image/Build/Infineon,$(1),easy-83000,$(patsubst jffs2-%,jffs2,$(1)))
112 $(call Image/Build/MyLoader,$(1),np27g,$(patsubst jffs2-%,jffs2,$(1)),NP27G)
113 $(call Image/Build/MyLoader,$(1),np28g,$(patsubst jffs2-%,jffs2,$(1)),NP28G)
114 $(call Image/Build/MyLoader,$(1),np28ghs,$(patsubst jffs2-%,jffs2,$(1)),NP28GHS)
115 $(call Image/Build/MyLoader,$(1),wp54g,$(patsubst jffs2-%,jffs2,$(1)),WP54G)
116 $(call Image/Build/MyLoader,$(1),wp54ag,$(patsubst jffs2-%,jffs2,$(1)),WP54AG)
117 $(call Image/Build/MyLoader,$(1),wpp54g,$(patsubst jffs2-%,jffs2,$(1)),WPP54G)
118 $(call Image/Build/MyLoader,$(1),wpp54ag,$(patsubst jffs2-%,jffs2,$(1)),WPP54AG)
119 endif
120 endif
121 endif
122 endef
123
124 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
125 define Image/BuildKernel
126 $(call Image/Build/RouterBoard)
127 endef
128 endif
129
130 define Image/Build/LZMAKernel
131 $(LOADER_MAKE) TARGET_DIR=$(BIN_DIR) \
132 LOADER=openwrt-$(BOARD)-$(KERNEL)-ramfs-lzma-$(1).$(2) \
133 LOADER_DATA=$(KDIR)/vmlinux.lzma \
134 LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \
135 CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \
136 compile loader.$(2)
137 endef
138
139 define Image/Build/LZMAKernel/Compex
140 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0,y,$(1))
141 endef
142
143 define Image/Build/LZMAKernel/Generic
144 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0)
145 endef
146
147 define Image/Build/LZMAKernel/Admboot
148 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0x6D8,y,$(1))
149 endef
150
151 define Image/Build/Initramfs/RouterBoard
152 $(CP) $(KDIR)/vmlinux.elf $(IMGNAME)-ramfs-rb1xx.elf
153 endef
154
155 define Image/Build/Initramfs
156 $(call Image/Build/Initramfs/RouterBoard)
157 $(call Image/Build/LZMAKernel/Compex,wp54g-wrt,bin)
158 ifeq ($(CONFIG_DEVEL),y)
159 $(call Image/Build/LZMAKernel/Generic,generic,bin)
160 $(call Image/Build/LZMAKernel/Generic,np27g,bin)
161 $(call Image/Build/LZMAKernel/Generic,wp54g,bin)
162 $(call Image/Build/LZMAKernel/Admboot,br-6104k,gz)
163 $(call Image/Build/LZMAKernel/Admboot,easy-5120,gz)
164 $(call Image/Build/LZMAKernel/Admboot,easy-83000,gz)
165 $(call Image/Build/LZMAKernel/Admboot,cas-630,gz)
166 $(call Image/Build/LZMAKernel/Admboot,cas-670,gz)
167 $(call Image/Build/LZMAKernel/Admboot,cas-700,gz)
168 $(call Image/Build/LZMAKernel/Admboot,cas-771,gz)
169 $(call Image/Build/LZMAKernel/Admboot,cas-790,gz)
170 $(call Image/Build/LZMAKernel/Admboot,cas-861,gz)
171 endif
172 endef
173
174 $(eval $(call BuildImage))