3cdba39432dcbc5dc0389a476d3c85cc5cb6bc59
[openwrt-10.03/.git] / target / linux / rb532-2.6 / image / Makefile
1
2 # Copyright (C) 2006 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 include $(INCLUDE_DIR)/kernel.mk
10
11 LOADADDR = 0x81000000           # RAM start + 16M 
12 KERNEL_ENTRY = 0x80101000
13 RAMSIZE = 0x00100000            # 1MB
14 IMAGE_COPY = 1
15
16 LOADER_MAKEOPTS= \
17                 KDIR=$(KDIR) \
18                 LOADADDR=$(LOADADDR) \
19                 KERNEL_ENTRY=$(KERNEL_ENTRY) \
20                 RAMSIZE=$(RAMSIZE) \
21                 IMAGE_COPY=$(IMAGE_COPY)
22
23 define Build/Clean
24         $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean
25 endef
26
27 define Image/Prepare
28         cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
29         $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
30 endef
31
32 define Image/BuildKernel
33         $(CP) $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux
34 endef
35
36 define Image/cmdline/jffs2-64k
37 block2mtd.block2mtd=/dev/cfa2,65536 root=/dev/mtdblock0 rootfstype=jffs2 init=/etc/preinit
38 endef
39
40 define Image/cmdline/jffs2-128k
41 block2mtd.block2mtd=/dev/cfa2,131072 root=/dev/mtdblock0 rootfstype=jffs2 init=/etc/preinit
42 endef
43
44 define Image/cmdline/ext2
45 root=/dev/cfa2 rootfstype=ext2 init=/etc/preinit
46 endef
47
48 define Image/cmdline/squashfs
49 block2mtd.block2mtd=/dev/cfa2,65536 root=/dev/mtdblock0 rootfstype=squashfs init=/etc/preinit
50 endef
51
52 define Image/cmdline/yaffs2
53 root=/dev/mtdblock1 rootfstype=yaffs2 init=/etc/preinit
54 endef
55
56 define Image/Build
57         $(STAGING_DIR)/bin/patch-cmdline $(KDIR)/vmlinux.elf '$(strip $(call Image/cmdline/$(1))) '
58         ./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin 4 $(KDIR)/vmlinux.elf $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
59 endef
60
61 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
62   define Image/Prepare
63         $(STAGING_DIR)/bin/patch-cmdline $(KDIR)/vmlinux '$(strip $(call Image/cmdline/yaffs2)) '
64         cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
65         $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile   
66   endef
67   define Image/BuildKernel
68         $(CP) $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux
69   endef
70 endif
71
72 $(eval $(call BuildImage))