710e82be5c345dc4285b3eeb58beb63098848dcd
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / 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 LOADER_MAKE := $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR)
11 IMGNAME := $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)
12 JFFS2EOF := $(KDIR)/jffs2.eof
13
14 define imgname
15 $(IMGNAME)-$(2)-$(patsubst jffs2-%,jffs2,$(1))
16 endef
17
18 define Build/Clean
19 $(LOADER_MAKE) clean
20 endef
21
22 define Image/Prepare
23 cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
24 rm -f $(JFFS2EOF)
25 touch $(JFFS2EOF)
26 $(call prepare_generic_squashfs,$(JFFS2EOF))
27 endef
28
29 define Image/Build/Loader
30 $(LOADER_MAKE) LOADER=loader-$(1).$(2) LOADER_DATA="" \
31 LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \
32 CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \
33 compile loader.$(2)
34 endef
35
36 define Image/Build/LZMAKernel
37 $(LOADER_MAKE) TARGET_DIR=$(BIN_DIR) \
38 LOADER=openwrt-$(BOARD)-$(KERNEL)-$(1)-ramfs.$(2) \
39 LOADER_DATA=$(KDIR)/vmlinux.lzma \
40 LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \
41 CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \
42 compile loader.$(2)
43 endef
44
45 define Image/Build/LZMAKernel/Generic
46 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0)
47 endef
48
49 define Image/Build/LZMAKernel/Admboot
50 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0x6D8,y,$(1))
51 endef
52
53 define Image/Build/LZMAKernel/KArgs
54 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0,y,$(1))
55 endef
56
57 define trxalign/jffs2-128k
58 -a 0x20000 -f $(KDIR)/root.jffs2-128k
59 endef
60
61 define trxalign/jffs2-64k
62 -a 0x10000 -f $(KDIR)/root.jffs2-64k
63 endef
64
65 define trxalign/squashfs
66 -a 1024 -f $(KDIR)/root.squashfs -a 0x10000 -A $(JFFS2EOF)
67 endef
68
69 define Image/Build/TRX
70 $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \
71 $(call trxalign/$(2))
72 endef
73
74 define Image/Build/TRXNoloader
75 $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
76 $(call trxalign/$(2))
77 endef
78
79 include $(SUBTARGET).mk
80
81 define Image/Build
82 $(call Image/Build/Profile/$(PROFILE),$(1))
83 endef
84
85 define Image/Build/Initramfs
86 $(call Image/Build/Profile/$(PROFILE),Initramfs)
87 endef
88
89 $(eval $(call BuildImage))