Add initial version of the new Image Builder
[openwrt.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/Compile
24 $(CC) -o $(STAGING_DIR)/bin/patch-cmdline $(PLATFORM_DIR)/src/patch-cmdline.c
25 endef
26
27 define Build/Clean
28 $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean
29 endef
30
31 define Image/Prepare
32 $(KERNEL_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)
33 cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
34 $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
35 cp $(LINUX_DIR)/vmlinux $(KDIR)/vmlinux.elf
36 endef
37
38 define Image/BuildKernel
39 $(CP) $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux
40 endef
41
42 define Image/cmdline/jffs2-64k
43 block2mtd.block2mtd=/dev/cfa2,65536 root=/dev/mtdblock0 rootfstype=jffs2
44 endef
45
46 define Image/cmdline/jffs2-128k
47 block2mtd.block2mtd=/dev/cfa2,131072 root=/dev/mtdblock0 rootfstype=jffs2
48 endef
49
50 define Image/cmdline/ext2
51 root=/dev/cfa2 rootfstype=ext2
52 endef
53
54 define Image/Build
55 $(STAGING_DIR)/bin/patch-cmdline $(KDIR)/vmlinux.elf '$(strip $(call Image/cmdline/$(1))) '
56 ./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin 4 $(LINUX_DIR)/vmlinux 16 $(KDIR)/root.$(1)
57 endef
58
59 $(eval $(call BuildImage))
This page took 0.042095 seconds and 5 git commands to generate.