Resync kernel config, make kernel.{flash,ram}.srec available
[openwrt/svn-archive/archive.git] / target / linux / au1000 / 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
10 LOADADDR = 0x81000000 # RAM start + 16M
11 KERNEL_ENTRY = 0x80100000
12 RAMSIZE = 0x00100000 # 1MB
13
14 FLASH_KERNEL := 0xBFD00000
15 FLASH_FS := 0xBE000000
16
17 LOADER_MAKEOPTS= \
18 KDIR=$(KDIR) \
19 LOADADDR=$(LOADADDR) \
20 KERNEL_ENTRY=$(KERNEL_ENTRY) \
21 RAMSIZE=$(RAMSIZE)
22
23 define Build/Clean
24 $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean
25 endef
26
27 DROP_SECTIONS := .reginfo .mdebug .comment .note .pdr .options .MIPS.options
28 OBJCOPY_SREC := $(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,$(DROP_SECTIONS))
29 OBJCOPY_BIN := $(TARGET_CROSS)objcopy -S -O binary $(addprefix --remove-section=,$(DROP_SECTIONS))
30
31 define Image/Prepare
32 cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
33
34 # Build RAM image
35 $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
36 $(LOADER_MAKEOPTS) \
37 clean compile
38 $(OBJCOPY_SREC) $(KDIR)/loader.elf $(KDIR)/kernel.ram.srec
39
40 # Build Flash image
41 $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
42 $(LOADER_MAKEOPTS) \
43 IMAGE_COPY=1 \
44 LOADER_ENTRY=$(FLASH_KERNEL) \
45 LOADER_TYPE=_flash \
46 clean compile
47 $(OBJCOPY_SREC) $(KDIR)/loader_flash.elf $(KDIR)/kernel.flash.srec
48 $(OBJCOPY_BIN) $(KDIR)/loader_flash.elf $(KDIR)/kernel.flash.bin
49 endef
50
51 define Image/Build/Initramfs
52 $(OBJCOPY_SREC) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux.srec
53 endef
54
55 define Image/Build
56 $(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma $(FLASH_FS) $(KDIR)/root.$(1) $(KDIR)/root.$(1).srec
57 grep -v S7 $(KDIR)/root.$(1).srec > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
58 grep -v S0 $(KDIR)/kernel.flash.srec >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
59 $(CP) $(KDIR)/kernel.flash.bin $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux.bin
60 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).fs
61 $(CP) $(KDIR)/kernel.flash.srec $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux-flash.srec
62 $(CP) $(KDIR)/kernel.ram.srec $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux-ram.srec
63 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
64 $(call Image/Build/Initramfs)
65 endif
66 endef
67
68 $(eval $(call BuildImage))