[adm5120] lzma-loader improvements
[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
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-5120,$(patsubst jffs2-%,jffs2,$(1)))
109 $(call Image/Build/Infineon,$(1),easy-5120-rt,$(patsubst jffs2-%,jffs2,$(1)))
110 $(call Image/Build/Infineon,$(1),easy-5120p-ata,$(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 ifeq ($(1),tgz)
123 $(call Image/Build/RouterBoard)
124 endif
125 endef
126
127 define Image/Build/LZMAKernel
128 $(LOADER_MAKE) TARGET_DIR=$(BIN_DIR) \
129 LOADER=openwrt-$(BOARD)-$(KERNEL)-ramfs-lzma-$(1).$(2) \
130 LOADER_DATA=$(KDIR)/vmlinux.lzma \
131 LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \
132 CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \
133 compile loader.$(2)
134 endef
135
136 define Image/Build/LZMAKernel/Compex
137 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0,y,$(1))
138 endef
139
140 define Image/Build/LZMAKernel/Generic
141 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0)
142 endef
143
144 define Image/Build/LZMAKernel/Admboot
145 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0x6D8,y,$(1))
146 endef
147
148 define Image/Build/Initramfs/RouterBoard
149 $(CP) $(KDIR)/vmlinux.elf $(IMGNAME)-ramfs-rb1xx.elf
150 endef
151
152 define Image/Build/Initramfs
153 $(call Image/Build/Initramfs/RouterBoard)
154 $(call Image/Build/LZMAKernel/Compex,wp54g-wrt,bin)
155 ifeq ($(CONFIG_DEVEL),y)
156 $(call Image/Build/LZMAKernel/Generic,generic,bin)
157 $(call Image/Build/LZMAKernel/Generic,np27g,bin)
158 $(call Image/Build/LZMAKernel/Generic,wp54g,bin)
159 $(call Image/Build/LZMAKernel/Admboot,br-6104k,gz)
160 $(call Image/Build/LZMAKernel/Admboot,easy-5120,gz)
161 $(call Image/Build/LZMAKernel/Admboot,easy-83000,gz)
162 $(call Image/Build/LZMAKernel/Admboot,cas-630,gz)
163 $(call Image/Build/LZMAKernel/Admboot,cas-670,gz)
164 $(call Image/Build/LZMAKernel/Admboot,cas-700,gz)
165 $(call Image/Build/LZMAKernel/Admboot,cas-771,gz)
166 $(call Image/Build/LZMAKernel/Admboot,cas-790,gz)
167 $(call Image/Build/LZMAKernel/Admboot,cas-861,gz)
168 endif
169 endef
170
171 $(eval $(call BuildImage))
This page took 0.071743 seconds and 5 git commands to generate.