source: branches/backfire/target/linux/au1000/image/Makefile @ 21208

Last change on this file since 21208 was 21208, checked in by nico, 6 years ago

[backfire] merge r20834, r20840, r20854 & r20855

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1#
2# Copyright (C) 2006-2010 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7include $(TOPDIR)/rules.mk
8include $(INCLUDE_DIR)/image.mk
9
10LOADADDR = 0x81000000           # RAM start + 16M
11KERNEL_ENTRY = 0x80100000
12RAMSIZE = 0x00100000            # 1MB
13
14JFFS2_BLOCKSIZE = 128k
15
16FLASH_KERNEL := 0xBFD00000
17FLASH_FS     := 0xBE000000
18
19LOADER_MAKEOPTS= \
20                KDIR=$(KDIR) \
21                LOADADDR=$(LOADADDR) \
22                KERNEL_ENTRY=$(KERNEL_ENTRY) \
23                RAMSIZE=$(RAMSIZE)
24
25define Build/Clean
26        $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean
27endef
28
29DROP_SECTIONS := .reginfo .mdebug .comment .note .pdr .options .MIPS.options
30OBJCOPY_SREC := $(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,$(DROP_SECTIONS))
31OBJCOPY_BIN := $(TARGET_CROSS)objcopy -S -O binary $(addprefix --remove-section=,$(DROP_SECTIONS))
32
33define Image/Prepare
34        cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
35       
36        # Build RAM image
37        $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
38                $(LOADER_MAKEOPTS) \
39                clean compile
40        $(OBJCOPY_SREC) $(KDIR)/loader.elf $(KDIR)/kernel.ram.srec
41       
42        # Build Flash image
43        $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
44                $(LOADER_MAKEOPTS) \
45                IMAGE_COPY=1 \
46                LOADER_ENTRY=$(FLASH_KERNEL) \
47                LOADER_TYPE=_flash \
48                clean compile
49        $(OBJCOPY_SREC) $(KDIR)/loader_flash.elf $(KDIR)/kernel.flash.srec
50        $(OBJCOPY_BIN) $(KDIR)/loader_flash.elf $(KDIR)/kernel.flash.bin
51endef
52
53define Image/Build/Initramfs
54        $(OBJCOPY_SREC) $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.srec
55endef
56
57define Image/Build
58        $(TARGET_CROSS)objcopy -O srec -I binary --adjust-vma $(FLASH_FS) $(KDIR)/root.$(1) $(KDIR)/root.$(1).srec
59        grep -v S7 $(KDIR)/root.$(1).srec > $(BIN_DIR)/$(IMG_PREFIX)-$(1).srec
60        grep -v S0 $(KDIR)/kernel.flash.srec >> $(BIN_DIR)/$(IMG_PREFIX)-$(1).srec
61        $(INSTALL_BIN) $(KDIR)/kernel.flash.bin $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.bin
62        $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs
63        $(CP) $(KDIR)/kernel.flash.srec $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-flash.srec
64        $(CP) $(KDIR)/kernel.ram.srec $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-ram.srec
65ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
66        $(call Image/Build/Initramfs)
67endif
68endef
69
70$(eval $(call BuildImage))
Note: See TracBrowser for help on using the repository browser.