2 # Copyright (C) 2006-2010 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
10 include $(TOPDIR)/rules.mk
11 include $(INCLUDE_DIR)/image.mk
13 LOADADDR = 0x81000000 # RAM start + 16M
14 KERNEL_ENTRY = 0x80100000
15 RAMSIZE = 0x00100000 # 1MB
17 FLASH_KERNEL := 0xBFD00000
18 FLASH_FS := 0xBE000000
22 LOADADDR=$(LOADADDR) \
23 KERNEL_ENTRY=$(KERNEL_ENTRY) \
27 $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean
30 DROP_SECTIONS := .reginfo .mdebug .comment .note .pdr .options .MIPS.options
31 OBJCOPY_SREC := $(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,$(DROP_SECTIONS))
32 OBJCOPY_BIN := $(TARGET_CROSS)objcopy -S -O binary $(addprefix --remove-section=,$(DROP_SECTIONS))
35 cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
38 $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
41 $(OBJCOPY_SREC) $(KDIR)/loader.elf $(KDIR)/kernel.ram.srec
44 $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
47 LOADER_ENTRY=$(FLASH_KERNEL) \
50 $(OBJCOPY_SREC) $(KDIR)/loader_flash.elf $(KDIR)/kernel.flash.srec
51 $(OBJCOPY_BIN) $(KDIR)/loader_flash.elf $(KDIR)/kernel.flash.bin
54 define Image/Build/Initramfs
55 $(OBJCOPY_SREC) $(KDIR)/vmlinux-initramfs.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs.srec
59 $(SCRIPT_DIR)/srecimage.pl $(KDIR)/root.$(1) $(KDIR)/root.$(1).srec $(FLASH_FS)
60 grep -v S7 $(KDIR)/root.$(1).srec > $(BIN_DIR)/$(IMG_PREFIX)-$(1).srec
61 grep -v S0 $(KDIR)/kernel.flash.srec >> $(BIN_DIR)/$(IMG_PREFIX)-$(1).srec
62 $(INSTALL_BIN) $(KDIR)/kernel.flash.bin $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.bin
63 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs
64 $(CP) $(KDIR)/kernel.flash.srec $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-flash.srec
65 $(CP) $(KDIR)/kernel.ram.srec $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-ram.srec
66 $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs $(TMP_DIR)/$(IMG_PREFIX)-root.fs
67 tar -C $(BIN_DIR) -cvzf $(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin \
68 $(IMG_PREFIX)-vmlinux.bin -C $(TMP_DIR) $(IMG_PREFIX)-root.fs
69 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
70 $(call Image/Build/Initramfs)
74 $(eval $(call BuildImage))