ramips: image: cleanup and sort templates/profiles
[openwrt.git] / target / linux / adm5120 / image / Makefile
1 #
2 # Copyright (C) 2006-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 LOADER_MAKE := $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR)
11 JFFS2BLOCK := $(KDIR)/jffs2.block
12 JFFS2MARK := $(KDIR)/jffs2.mark
13
14 define imgname
15 $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(patsubst jffs2-%,jffs2,$(1))
16 endef
17
18 VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux
19 fs_squash:=squashfs-only
20 fs_all:=all
21 fs_4k:=4k
22 fs_64k:=64k
23 fs_128k:=128k
24 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
25 fs_squash:=initramfs
26 fs_all:=initramfs
27 fs_4k:=initramfs
28 fs_64k:=initramfs
29 fs_128k:=initramfs
30 VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs
31 endif
32
33 define Build/Clean
34 $(LOADER_MAKE) clean
35 endef
36
37 define Image/Prepare
38 cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
39 rm -f $(JFFS2BLOCK)
40 touch $(JFFS2BLOCK)
41 $(call prepare_generic_squashfs,$(JFFS2BLOCK))
42 rm -f $(JFFS2MARK)
43 touch $(JFFS2MARK)
44 $(call add_jffs2_mark,$(JFFS2MARK))
45 endef
46
47 define Image/Build/Loader
48 $(LOADER_MAKE) LOADER=loader-$(1).$(2) LOADER_DATA="" \
49 LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \
50 CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \
51 compile loader.$(2)
52 endef
53
54 define Image/Build/LZMAKernel
55 $(LOADER_MAKE) TARGET_DIR=$(BIN_DIR) \
56 LOADER=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-ramfs.$(2) \
57 LOADER_DATA=$(KDIR)/vmlinux.lzma \
58 LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \
59 CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \
60 compile loader.$(2)
61 endef
62
63 define Image/Build/LZMAKernel/Generic
64 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0)
65 endef
66
67 define Image/Build/LZMAKernel/Admboot
68 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0x6D8,y,$(1))
69 endef
70
71 define Image/Build/LZMAKernel/Cellvision
72 $(call Image/Build/LZMAKernel,$(1),$(3),0x80500000,0x6D8,y,$(2))
73 endef
74
75 define Image/Build/LZMAKernel/KArgs
76 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0,y,$(1))
77 endef
78
79 define trxalign/jffs2-128k
80 -a 0x20000 -f $(KDIR)/root.jffs2-128k
81 endef
82
83 define trxalign/jffs2-64k
84 -a 0x10000 -f $(KDIR)/root.jffs2-64k
85 endef
86
87 define trxalign/squashfs
88 -a 1024 -f $(KDIR)/root.squashfs -a 0x10000 -A $(JFFS2BLOCK)
89 endef
90
91 define Image/Build/TRX
92 $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \
93 $(call trxalign/$(2))
94 endef
95
96 define Image/Build/TRXNoloader
97 $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
98 $(call trxalign/$(2))
99 endef
100
101 include $(SUBTARGET).mk
102
103 define Image/Build
104 $(call Image/Build/Profile/$(PROFILE),$(1))
105 endef
106
107 define Image/Build/Initramfs
108 $(call Image/Build/Profile/$(PROFILE),Initramfs)
109 endef
110
111 define Image/BuildKernel
112 cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
113 cp $(KDIR)/vmlinux $(VMLINUX).bin
114 endef
115
116 $(eval $(call BuildImage))
This page took 0.039502 seconds and 5 git commands to generate.