rb532: convert to new loopback based overlay support
[oweals/openwrt.git] / target / linux / rb532 / 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 LOADADDR = 0x81000000           # RAM start + 16M
11 KERNEL_ENTRY = 0x80101000
12 RAMSIZE = 0x00100000            # 1MB
13 IMAGE_COPY = 1
14
15 LOADER_MAKEOPTS= \
16                 KDIR=$(KDIR) \
17                 LOADADDR=$(LOADADDR) \
18                 KERNEL_ENTRY=$(KERNEL_ENTRY) \
19                 RAMSIZE=$(RAMSIZE) \
20                 IMAGE_COPY=$(IMAGE_COPY)
21
22 define Build/Clean
23         $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean
24 endef
25
26 define Image/Prepare
27         cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
28         $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
29 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
30         $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-initramfs '$(strip $(call Image/cmdline/yaffs2)) '
31         cat $(KDIR)/vmlinux-initramfs | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
32         $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
33         $(CP) $(KDIR)/loader.elf $(KDIR)/loader-initramfs.elf
34 endif
35 endef
36
37 VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-kernel
38
39 define Image/BuildKernel
40         $(CP) $(KDIR)/loader.elf $(VMLINUX)
41 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
42         $(CP) $(KDIR)/loader-initramfs.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs
43 endif
44 endef
45
46 define Image/cmdline/yaffs2
47 root=/dev/mtdblock1 rootfstype=yaffs2
48 endef
49
50 define Image/Build/squashfs
51         dd if=/dev/zero bs=128k count=1 >> $(KDIR)/root.squashfs
52 endef
53
54 define Image/Build
55         $(call Image/Build/$(1),$(1))
56         $(CP) $(KDIR)/vmlinux.elf $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel
57         $(STAGING_DIR_HOST)/bin/patch-cmdline $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel 'root=/dev/sda2 '
58         ./gen_image.sh $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).bin \
59                 5 $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel \
60                 $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1) \
61                 128
62 endef
63
64 $(eval $(call BuildImage))