move target/image/platform to target/linux/platform/image
[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/Clean
24 $(MAKE) -C ../../generic-2.6/image/lzma-loader $(LOADER_MAKEOPTS) clean
25 endef
26
27 CMDLINE_SIZE=512
28 CMDLINE_OFFSET=4112
29
30 define Image/Prepare
31 echo 'root=/dev/cfa2 ' | \
32 dd bs=$(CMDLINE_SIZE) count=1 conv=sync | \
33 dd of=$(LINUX_DIR)/vmlinux bs=$(CMDLINE_OFFSET) conv=notrunc seek=1
34 $(KERNEL_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)
35 endef
36
37 define Image/BuildKernel
38 cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
39 $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean compile
40 $(CP) $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux
41 endef
42
43 PARTITION1=\x80\x01\x01\x00\x27\x01\x20\x7b\x20\x00\x00\x00\xe0\x1e\x00\x00# 4 MB (kernel part)
44 PARTITION2=\x00\x00\x01\x7c\x83\x01\xa0\x64\x00\x1f\x00\x00\x40\x7a\x00\x00# 16 MB (rootfs part)
45
46 define Image/cmdline/jffs2-64k
47 block2mtd.block2mtd=/dev/cfa2,65536 root=/dev/mtdblock0 rootfstype=jffs2
48 endef
49
50 define Image/cmdline/jffs2-128k
51 block2mtd.block2mtd=/dev/cfa2,131072 root=/dev/mtdblock0 rootfstype=jffs2
52 endef
53
54 define Image/cmdline/ext2
55 root=/dev/cfa2 rootfstype=ext2
56 endef
57
58 define Image/Build
59 echo '$(strip $(call Image/cmdline/$(1))) ' | \
60 dd bs=$(CMDLINE_SIZE) count=1 conv=sync | \
61 dd of=$(LINUX_DIR)/vmlinux bs=$(CMDLINE_OFFSET) conv=notrunc seek=1
62 ( \
63 echo -ne OWRT | dd bs=$$$$((0x1be)) conv=sync; \
64 ( \
65 echo -ne '$(strip $(PARTITION1))'; \
66 echo -ne '$(strip $(PARTITION2))'; \
67 ) | dd bs=$$$$((0x40)) conv=sync; \
68 echo -ne '\x55\xaa'; \
69 dd if=/dev/zero bs=$$$$((0x3e00)) conv=sync count=1; \
70 dd if=$(LINUX_DIR)/vmlinux bs=$$$$((0x3dc000)) conv=sync; \
71 cat $(KDIR)/root.$(1); \
72 echo -ne '\xde\xad\xc0\xde'; \
73 ) > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin
74 endef
75
76 $(eval $(call BuildImage))
This page took 0.042849 seconds and 5 git commands to generate.