fd805eef7247429f9182b02d86c7d3c93c170ad8
[openwrt/svn-archive/archive.git] / openwrt / target / linux / image / au1000 / Makefile
1 include $(TOPDIR)/rules.mk
2
3 LOADADDR = 0x8008c8f4 # RAM start + 16M
4 KERNEL_ENTRY = 0x80100000
5 RAMSIZE = 0x04000000 # 1MB
6
7 LOADER_MAKEOPTS= \
8 KDIR=$(KDIR) \
9 LOADADDR=$(LOADADDR) \
10 KERNEL_ENTRY=$(KERNEL_ENTRY) \
11 RAMSIZE=$(RAMSIZE)
12
13 KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
14
15 lzma-loader-clean:
16 $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) clean
17
18 lzma-loader-prepare:
19 $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) prepare
20
21 lzma-loader-compile: $(KDIR)/vmlinux.lzma lzma-loader-prepare
22 $(MAKE) -C ../generic/lzma-loader $(LOADER_MAKEOPTS) compile
23
24 ifeq ($(IB),)
25 $(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux
26 cat $^ | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $@ || (rm -f $@ && false)
27
28 install: $(KDIR)/vmlinux.lzma
29 endif
30
31 ifeq ($(KERNEL),2.6)
32 FSNAME:=$(patsubst jffs2-%,jffs2,$(FS))
33
34 $(KDIR)/vmlinux.srec: $(KDIR)/vmlinux
35 $(TARGET_CROSS)objcopy -O srec $(LINUX_DIR)/vmlinux $(KDIR)/vmlinux.srec
36
37 ifeq ($(FS),jffs2-4MB)
38
39 $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin: $(KDIR)/root.$(FS) $(KDIR)/vmlinux.srec
40 $(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/root.$(FS) $(KDIR)/root.srec
41 grep -v S7 $(KDIR)/root.srec > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
42 grep -v S0 $(KDIR)/vmlinux.srec >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
43
44 install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin
45 endif
46
47 ifeq ($(FS),jffs2-8MB)
48
49 $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin: $(KDIR)/root.$(FS) $(KDIR)/vmlinux.srec
50 $(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/root.$(FS) $(KDIR)/root.srec
51 grep -v S7 $(KDIR)/root.srec > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
52 grep -v S0 $(KDIR)/vmlinux.srec >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
53
54 install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin
55 endif
56
57 ifeq ($(FS),tgz)
58
59 $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz: $(KDIR)/root.tar.gz
60 $(CP) $^ $@
61
62 install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz
63
64 endif
65
66 ifeq ($(FS),squashfs)
67 $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin: $(KDIR)/root.$(FS) $(KDIR)/vmlinux.srec
68 $(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/root.$(FS) $(KDIR)/root.srec
69 grep -v S7 $(KDIR)/root.srec > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
70
71 endif
72
73 install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin
74 endif
75
76 $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz: $(KDIR)/vmlinux
77 $(CP) $^ $@
78
79 ifeq ($(IB),)
80 clean: lzma-loader-clean
81 prepare: lzma-loader-prepare
82 compile: lzma-loader-compile
83 else
84 clean:
85 prepare:
86 compile:
87 endif
88 install-ib:
89 mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin
90 mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)
91 $(CP) $(KDIR)/loader.elf $(IB_DIR)/build_$(ARCH)/
92 $(CP) $(KDIR)/vmlinux.lzma $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/
93 $(TARGET_CROSS)objcopy -O srec $(KDIR)/loader.elf $(KDIR)/loader.srec
94 grep -v S0 $(KDIR)/loader.srec > $(KDIR)/kernel.srec