2006-06-27 08:35:46 +08:00
|
|
|
#
|
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
2006-06-21 11:13:25 +08:00
|
|
|
include $(TOPDIR)/rules.mk
|
2006-06-21 10:32:39 +08:00
|
|
|
include $(INCLUDE_DIR)/image.mk
|
2006-10-26 09:08:41 +08:00
|
|
|
include $(INCLUDE_DIR)/kernel.mk
|
2006-06-16 05:43:59 +08: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-19 02:30:29 +08:00
|
|
|
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean
|
2006-06-16 05:43:59 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Prepare
|
2007-08-07 08:04:25 +08:00
|
|
|
cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
2007-01-11 05:52:28 +08:00
|
|
|
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
|
2006-06-16 05:43:59 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/BuildKernel
|
2007-11-11 07:08:11 +08:00
|
|
|
$(CP) $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-vmlinux
|
2006-06-16 05:43:59 +08:00
|
|
|
endef
|
|
|
|
|
2006-10-26 09:08:41 +08:00
|
|
|
define Image/cmdline/jffs2-64k
|
2007-03-04 06:36:45 +08:00
|
|
|
block2mtd.block2mtd=/dev/cfa2,65536 root=/dev/mtdblock0 rootfstype=jffs2 init=/etc/preinit
|
2006-10-26 09:08:41 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/cmdline/jffs2-128k
|
2007-03-04 06:36:45 +08:00
|
|
|
block2mtd.block2mtd=/dev/cfa2,131072 root=/dev/mtdblock0 rootfstype=jffs2 init=/etc/preinit
|
2006-10-26 09:08:41 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/cmdline/ext2
|
2007-03-04 06:36:45 +08:00
|
|
|
root=/dev/cfa2 rootfstype=ext2 init=/etc/preinit
|
2006-10-26 09:08:41 +08:00
|
|
|
endef
|
|
|
|
|
2007-06-12 06:58:44 +08:00
|
|
|
define Image/cmdline/squashfs
|
2007-06-21 23:52:07 +08:00
|
|
|
block2mtd.block2mtd=/dev/cfa2,65536 root=/dev/mtdblock0 rootfstype=squashfs init=/etc/preinit
|
2007-06-12 06:58:44 +08:00
|
|
|
endef
|
|
|
|
|
2007-07-20 22:33:15 +08:00
|
|
|
define Image/cmdline/yaffs2
|
2007-07-19 22:53:24 +08:00
|
|
|
root=/dev/mtdblock1 rootfstype=yaffs2 init=/etc/preinit
|
|
|
|
endef
|
|
|
|
|
2006-10-26 09:08:41 +08:00
|
|
|
define Image/Build
|
2007-08-07 08:04:25 +08:00
|
|
|
$(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux.elf '$(strip $(call Image/cmdline/$(1))) '
|
2007-11-11 07:08:11 +08:00
|
|
|
./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(1).bin 4 $(KDIR)/vmlinux.elf $(CONFIG_TARGET_ROOTFS_FSPART) $(KDIR)/root.$(1)
|
2006-06-16 05:43:59 +08:00
|
|
|
endef
|
|
|
|
|
2007-07-20 22:33:15 +08:00
|
|
|
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
|
|
|
|
define Image/Prepare
|
2007-08-07 08:04:25 +08: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 22:33:15 +08:00
|
|
|
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
|
|
|
|
endef
|
|
|
|
define Image/BuildKernel
|
2007-11-11 07:08:11 +08:00
|
|
|
$(CP) $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-vmlinux
|
2007-07-20 22:33:15 +08:00
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2006-06-16 05:43:59 +08:00
|
|
|
$(eval $(call BuildImage))
|