2006-06-27 00:35:46 +00:00
|
|
|
#
|
2010-04-12 23:15:56 +00:00
|
|
|
# Copyright (C) 2006-2010 OpenWrt.org
|
2006-06-27 00:35:46 +00:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
2006-06-21 03:13:25 +00:00
|
|
|
include $(TOPDIR)/rules.mk
|
2006-06-21 02:32:39 +00:00
|
|
|
include $(INCLUDE_DIR)/image.mk
|
2006-06-15 21:43:59 +00:00
|
|
|
|
|
|
|
LOADADDR = 0x81000000 # RAM start + 16M
|
|
|
|
KERNEL_ENTRY = 0x80101000
|
|
|
|
RAMSIZE = 0x00100000 # 1MB
|
|
|
|
IMAGE_COPY = 1
|
|
|
|
|
|
|
|
LOADER_MAKEOPTS= \
|
|
|
|
KDIR=$(KDIR) \
|
|
|
|
LOADADDR=$(LOADADDR) \
|
|
|
|
KERNEL_ENTRY=$(KERNEL_ENTRY) \
|
|
|
|
RAMSIZE=$(RAMSIZE) \
|
|
|
|
IMAGE_COPY=$(IMAGE_COPY)
|
|
|
|
|
|
|
|
define Build/Clean
|
2006-12-18 18:30:29 +00:00
|
|
|
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean
|
2006-06-15 21:43:59 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Prepare
|
2007-08-07 00:04:25 +00:00
|
|
|
cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
2007-01-10 21:52:28 +00:00
|
|
|
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
|
2006-06-15 21:43:59 +00:00
|
|
|
endef
|
|
|
|
|
2011-05-04 08:47:00 +00:00
|
|
|
VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-kernel
|
|
|
|
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
|
|
|
|
VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs
|
|
|
|
endif
|
|
|
|
|
2006-06-15 21:43:59 +00:00
|
|
|
define Image/BuildKernel
|
2011-05-04 08:47:00 +00:00
|
|
|
$(CP) $(KDIR)/loader.elf $(VMLINUX)
|
2006-06-15 21:43:59 +00:00
|
|
|
endef
|
|
|
|
|
2006-10-26 01:08:41 +00:00
|
|
|
define Image/cmdline/jffs2-64k
|
2009-05-14 10:20:53 +00:00
|
|
|
block2mtd.block2mtd=/dev/sda2,65536 root=/dev/mtdblock0 rootfstype=jffs2
|
2006-10-26 01:08:41 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/cmdline/jffs2-128k
|
2009-05-14 10:20:53 +00:00
|
|
|
block2mtd.block2mtd=/dev/sda2,131072 root=/dev/mtdblock0 rootfstype=jffs2
|
2006-10-26 01:08:41 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/cmdline/ext2
|
2009-05-14 10:20:53 +00:00
|
|
|
root=/dev/sda2 rootfstype=ext2
|
2006-10-26 01:08:41 +00:00
|
|
|
endef
|
|
|
|
|
2007-06-11 22:58:44 +00:00
|
|
|
define Image/cmdline/squashfs
|
2009-05-14 10:20:53 +00:00
|
|
|
block2mtd.block2mtd=/dev/sda2,65536 root=/dev/mtdblock0 rootfstype=squashfs
|
2007-06-11 22:58:44 +00:00
|
|
|
endef
|
|
|
|
|
2007-07-20 14:33:15 +00:00
|
|
|
define Image/cmdline/yaffs2
|
2009-05-14 10:20:53 +00:00
|
|
|
root=/dev/mtdblock1 rootfstype=yaffs2
|
2007-07-19 14:53:24 +00:00
|
|
|
endef
|
|
|
|
|
2006-10-26 01:08:41 +00:00
|
|
|
define Image/Build
|
2010-04-12 23:15:56 +00:00
|
|
|
$(CP) $(KDIR)/vmlinux.elf $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel
|
|
|
|
$(STAGING_DIR_HOST)/bin/patch-cmdline $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel '$(strip $(call Image/cmdline/$(1))) '
|
2010-05-05 01:59:43 +00:00
|
|
|
./gen_image.sh $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).bin 4 $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1)
|
2006-06-15 21:43:59 +00:00
|
|
|
endef
|
|
|
|
|
2007-07-20 14:33:15 +00:00
|
|
|
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
|
|
|
|
define Image/Prepare
|
2007-08-07 00:04:25 +00:00
|
|
|
$(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux '$(strip $(call Image/cmdline/yaffs2)) '
|
|
|
|
cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
2007-07-20 14:33:15 +00:00
|
|
|
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
|
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2006-06-15 21:43:59 +00:00
|
|
|
$(eval $(call BuildImage))
|