414873189fc44236cc9c13bd7fd04356e7d39cd5
[openwrt/svn-archive/archive.git] / openwrt / target / linux / image / au1000 / Makefile
1 include $(TOPDIR)/rules.mk
2
3 LOADADDR = 0x8108c8f4 # 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 ifeq ($(FS),jffs2-8MB)
35
36 $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin: $(KDIR)/root.$(FS)
37 $(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/root.$(FS) $(KDIR)/root.srec
38 grep -v S7 $(KDIR)/root.srec > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
39 grep -v S0 $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.flash.srec >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
40
41 install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin
42 endif
43
44 ifeq ($(FS),tgz)
45
46 $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz: $(KDIR)/root.tar.gz
47 $(CP) $^ $@
48
49 install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tar.gz
50
51 endif
52
53 ifeq ($(FS),squashfs)
54 $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin: $(KDIR)/root.$(FS)
55 $(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma 0xbe000000 $(KDIR)/root.$(FS) $(KDIR)/root.srec
56 grep -v S7 $(KDIR)/root.srec > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
57 grep -v S0 $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.flash.srec >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).img
58
59 endif
60
61 install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FSNAME).bin
62 endif
63
64 $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz: $(KDIR)/zImage.flash
65 $(CP) $^ $@
66
67 ifeq ($(IB),)
68 clean: lzma-loader-clean
69 prepare: lzma-loader-prepare
70 compile: lzma-loader-compile
71 else
72 clean:
73 prepare:
74 compile:
75 endif
76 install-ib:
77 mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin
78 mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)
79 $(CP) $(KDIR)/loader.elf $(IB_DIR)/build_$(ARCH)/
80 $(CP) $(KDIR)/vmlinux.lzma $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/
81 $(TARGET_CROSS)objcopy -O srec $(KDIR)/loader.elf $(KDIR)/loader.srec
82 grep -v S0 $(KDIR)/loader.srec > $(KDIR)/kernel.srec