move target/linux/image to target/image
[openwrt.git] / target / image / rb532 / Makefile
1 include $(TOPDIR)/rules.mk
2 include $(INCLUDE_DIR)/image.mk
3
4 LOADADDR = 0x81000000           # RAM start + 16M 
5 KERNEL_ENTRY = 0x80101000
6 RAMSIZE = 0x00100000            # 1MB
7 IMAGE_COPY = 1
8
9 LOADER_MAKEOPTS= \
10                 KDIR=$(KDIR) \
11                 LOADADDR=$(LOADADDR) \
12                 KERNEL_ENTRY=$(KERNEL_ENTRY) \
13                 RAMSIZE=$(RAMSIZE) \
14                 IMAGE_COPY=$(IMAGE_COPY)
15
16 define Build/Clean
17         $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean
18 endef
19
20 define Image/Prepare
21         cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
22         $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean compile
23 endef
24
25 define Image/BuildKernel
26         $(CP) $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux
27 endef
28
29 PARTITION1=\x80\x01\x01\x00\x27\x01\x20\x7b\x20\x00\x00\x00\xe0\x1e\x00\x00# 4 MB  (kernel part)
30 PARTITION2=\x00\x00\x01\x7c\x83\x01\xa0\x64\x00\x1f\x00\x00\x40\x7a\x00\x00# 16 MB (rootfs part)
31
32 define Image/Build/jffs2-128k
33         ( \
34                 echo -ne OWRT | dd bs=$$$$((0x1be)) conv=sync; \
35                 ( \
36                         echo -ne '$(strip $(PARTITION1))'; \
37                         echo -ne '$(strip $(PARTITION2))'; \
38                 ) | dd bs=$$$$((0x40)) conv=sync; \
39                 echo -ne '\x55\xaa'; \
40                 dd if=/dev/zero bs=$$$$((0x3e00)) conv=sync count=1; \
41                 dd if=$(KDIR)/loader.elf bs=$$$$((0x3dc000)) conv=sync; \
42                 cat $(KDIR)/root.$(1); \
43                 echo -ne '\xde\xad\xc0\xde'; \
44         ) > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin
45 endef
46
47 define Image/Build
48         $(call Image/Build/$(1),$(1))
49 endef
50
51 $(eval $(call BuildImage))