[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_SOC_LANTIQ_XWAY),y)
58 define Image/BuildKernel
59 $(call Image/BuildKernel/Template,EASY4010,$(xway_cmdline))
60 $(call Image/BuildKernel/Template,EASY50712,$(xway_cmdline))
61 $(call Image/BuildKernel/Template,EASY50812,$(xway_cmdline))
62 $(call Image/BuildKernel/Template,ARV452,$(xway_cmdline))
63 $(call Image/BuildKernel/Template,ARV752DPW22,$(xway_cmdline))
64 $(call Image/BuildKernel/Template,NONE)
65 endef
66
67 define Image/Build
68 $(call Image/Build/$(1),$(1),EASY4010)
69 $(call Image/Build/$(1),$(1),EASY50712)
70 $(call Image/Build/$(1),$(1),EASY50812)
71 $(call Image/Build/$(1),$(1),ARV452)
72 $(call Image/Build/$(1),$(1),ARV752DPW22)
73 $(call Image/Build/$(1),$(1),NONE)
74 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs
75 endef
76 endif
77
78 ifeq ($(CONFIG_SOC_LANTIQ_FALCON),y)
79 define Image/BuildKernel
80 $(call Image/BuildKernel/Template,EASY98000,$(falcon_cmdline))
81 $(call Image/BuildKernel/Template,NONE)
82 endef
83
84 define Image/Build
85 $(call Image/Build/$(1),$(1),EASY98000)
86 $(call Image/Build/$(1),$(1),NONE)
87 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs
88 endef
89 endif
90
91 $(eval $(call BuildImage))
This page took 0.043712 seconds and 5 git commands to generate.