[lantiq]
[openwrt.git] / target / linux / lantiq / image / Makefile
1 #
2 # Copyright (C) 2010 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 JFFS2_BLOCKSIZE = 64k 128k 256k
11
12 xway_cmdline=-console=ttyS1,115200 rootfstype=squashfs,jffs2
13 falcon_cmdline=-console=ttyS0,115200 rootfstype=squashfs,jffs2
14
15 define CompressLzma
16 $(STAGING_DIR_HOST)/bin/lzma e $(1) $(2)
17 endef
18
19 define PatchKernelLzma
20 cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1)
21 $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip $(2))'
22 $(call CompressLzma,$(KDIR)/vmlinux-$(1),$(KDIR)/vmlinux-$(1).lzma)
23 endef
24
25 define MkImageLzma
26 mkimage -A mips -O linux -T kernel -a 0x80002000 -C lzma \
27 -e 0x80002000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
28 -d $(KDIR)/vmlinux-$(1).lzma $(KDIR)/uImage-$(1)
29 endef
30
31 define Image/Build/squashfs
32 cat $(KDIR)/uImage-$(2) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
33 $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image)
34 endef
35
36 define Image/Build/jffs2-64k
37 dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=64k conv=sync
38 cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
39 endef
40
41 define Image/Build/jffs2-128k
42 dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=128k conv=sync
43 cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
44 endef
45
46 define Image/Build/jffs2-256k
47 dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=256k conv=sync
48 cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
49 endef
50
51 define Image/BuildKernel/Template
52 $(call PatchKernelLzma,$(1),$(if $(2),$(2) machtype=$(1),))
53 $(call MkImageLzma,$(1))
54 $(CP) $(KDIR)/uImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage
55 endef
56
57 ifeq ($(CONFIG_TARGET_lantiq_xway),y)
58 define Image/BuildKernel/Profile/EASY50712
59 $(call Image/BuildKernel/Template,EASY50712,$(xway_cmdline))
60 endef
61
62 define Image/Build/Profile/EASY50712
63 $(call Image/Build/$(1),$(1),EASY50712)
64 endef
65
66 define Image/BuildKernel/Profile/EASY50812
67 $(call Image/BuildKernel/Template,EASY50812,$(xway_cmdline))
68 endef
69
70 define Image/Build/Profile/EASY50812
71 $(call Image/Build/$(1),$(1),EASY50812)
72 endef
73
74 define Image/BuildKernel/Profile/ARV3527P
75 $(call Image/BuildKernel/Template,ARV3527P,$(xway_cmdline))
76 endef
77
78 define Image/Build/Profile/ARV3527P
79 $(call Image/Build/$(1),$(1),ARV3527P)
80 endef
81
82 define Image/BuildKernel/Profile/ARV4510PW
83 $(call Image/BuildKernel/Template,ARV4510PW,$(xway_cmdline))
84 endef
85
86 define Image/Build/Profile/ARV4510PW
87 $(call Image/Build/$(1),$(1),ARV4510PW)
88 endef
89
90 define Image/BuildKernel/Profile/ARV4518PW
91 $(call Image/BuildKernel/Template,ARV4518PW,$(xway_cmdline))
92 endef
93
94 define Image/Build/Profile/ARV4518PW
95 $(call Image/Build/$(1),$(1),ARV4518PW)
96 endef
97
98 define Image/BuildKernel/Profile/ARV4520PW
99 $(call Image/BuildKernel/Template,ARV4520PW,$(xway_cmdline))
100 endef
101
102 define Image/Build/Profile/ARV4520PW
103 $(call Image/Build/$(1),$(1),ARV4520PW)
104 endef
105
106 define Image/BuildKernel/Profile/ARV4525PW
107 $(call Image/BuildKernel/Template,ARV4525PW,$(xway_cmdline))
108 endef
109
110 define Image/Build/Profile/ARV4525PW
111 $(call Image/Build/$(1),$(1),ARV4525PW)
112 endef
113
114 define Image/BuildKernel/Profile/ARV452CPW
115 $(call Image/BuildKernel/Template,ARV452CPW,$(xway_cmdline))
116 endef
117
118 define Image/Build/Profile/ARV452CPW
119 $(call Image/Build/$(1),$(1),ARV452CPW)
120 endef
121
122 define Image/BuildKernel/Profile/ARV752DPW22
123 $(call Image/BuildKernel/Template,ARV752DPW22,$(xway_cmdline))
124 endef
125
126 define Image/Build/Profile/ARV752DPW22
127 $(call Image/Build/$(1),$(1),ARV752DPW22)
128 endef
129
130 define Image/BuildKernel/Profile/Generic
131 $(call Image/BuildKernel/Template,EASY4010,$(xway_cmdline))
132 $(call Image/BuildKernel/Template,EASY50712,$(xway_cmdline))
133 $(call Image/BuildKernel/Template,EASY50812,$(xway_cmdline))
134 $(call Image/BuildKernel/Template,ARV3527P,$(xway_cmdline))
135 $(call Image/BuildKernel/Template,ARV4510PW,$(xway_cmdline))
136 $(call Image/BuildKernel/Template,ARV4518PW,$(xway_cmdline))
137 $(call Image/BuildKernel/Template,ARV4520PW,$(xway_cmdline))
138 $(call Image/BuildKernel/Template,ARV452CPW,$(xway_cmdline))
139 $(call Image/BuildKernel/Template,ARV4525PW,$(xway_cmdline))
140 $(call Image/BuildKernel/Template,ARV7518PW,$(xway_cmdline))
141 $(call Image/BuildKernel/Template,ARV752DPW,$(xway_cmdline))
142 $(call Image/BuildKernel/Template,ARV752DPW22,$(xway_cmdline))
143 $(call Image/BuildKernel/Template,NONE)
144 endef
145
146 define Image/Build/Profile/Generic
147 $(call Image/Build/$(1),$(1),EASY4010)
148 $(call Image/Build/$(1),$(1),EASY50712)
149 $(call Image/Build/$(1),$(1),EASY50812)
150 $(call Image/Build/$(1),$(1),ARV3527P)
151 $(call Image/Build/$(1),$(1),ARV4510PW)
152 $(call Image/Build/$(1),$(1),ARV4518PW)
153 $(call Image/Build/$(1),$(1),ARV4520PW)
154 $(call Image/Build/$(1),$(1),ARV452CPW)
155 $(call Image/Build/$(1),$(1),ARV4525PW)
156 $(call Image/Build/$(1),$(1),ARV7518PW)
157 $(call Image/Build/$(1),$(1),ARV752DPW)
158 $(call Image/Build/$(1),$(1),ARV752DPW22)
159 $(call Image/Build/$(1),$(1),NONE)
160 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs
161 endef
162 endif
163
164 ifeq ($(CONFIG_TARGET_lantiq_falcon),y)
165 define Image/BuildKernel/Profile/Generic
166 $(call Image/BuildKernel/Template,EASY98000,$(falcon_cmdline))
167 $(call Image/BuildKernel/Template,EASY98020,$(falcon_cmdline))
168 $(call Image/BuildKernel/Template,NONE)
169 endef
170
171 define Image/Build/Profile/Generic
172 $(call Image/Build/$(1),$(1),EASY98000)
173 $(call Image/Build/$(1),$(1),EASY98020)
174 $(call Image/Build/$(1),$(1),NONE)
175 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs
176 endef
177 endif
178
179 define Image/BuildKernel
180 $(call Image/BuildKernel/Profile/$(PROFILE))
181 endef
182
183 define Image/Build
184 $(call Image/Build/Profile/$(PROFILE),$(1))
185 endef
186
187 $(eval $(call BuildImage))
This page took 0.061222 seconds and 5 git commands to generate.