credit where credit is due
[openwrt/svn-archive/archive.git] / openwrt / target / image / rb532 / 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
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/lzma-loader $(LOADER_MAKEOPTS) clean
24 endef
25
26 define Image/Prepare
27 cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
28 $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean compile
29 endef
30
31 define Image/BuildKernel
32 $(CP) $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux
33 endef
34
35 PARTITION1=\x80\x01\x01\x00\x27\x01\x20\x7b\x20\x00\x00\x00\xe0\x1e\x00\x00# 4 MB (kernel part)
36 PARTITION2=\x00\x00\x01\x7c\x83\x01\xa0\x64\x00\x1f\x00\x00\x40\x7a\x00\x00# 16 MB (rootfs part)
37
38 define Image/Build/jffs2-128k
39 ( \
40 echo -ne OWRT | dd bs=$$$$((0x1be)) conv=sync; \
41 ( \
42 echo -ne '$(strip $(PARTITION1))'; \
43 echo -ne '$(strip $(PARTITION2))'; \
44 ) | dd bs=$$$$((0x40)) conv=sync; \
45 echo -ne '\x55\xaa'; \
46 dd if=/dev/zero bs=$$$$((0x3e00)) conv=sync count=1; \
47 dd if=$(KDIR)/loader.elf bs=$$$$((0x3dc000)) conv=sync; \
48 cat $(KDIR)/root.$(1); \
49 echo -ne '\xde\xad\xc0\xde'; \
50 ) > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin
51 endef
52
53 define Image/Build
54 $(call Image/Build/$(1),$(1))
55 endef
56
57 $(eval $(call BuildImage))