2006-06-27 08:35:46 +08:00
|
|
|
#
|
2010-04-13 07:15:56 +08:00
|
|
|
# Copyright (C) 2006-2010 OpenWrt.org
|
2006-06-27 08:35:46 +08:00
|
|
|
#
|
|
|
|
# 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-05-31 03:38:38 +08:00
|
|
|
|
2009-04-06 17:56:30 +08:00
|
|
|
ifdef CONFIG_PACKAGE_apex
|
|
|
|
define Image/Build/Linksys
|
2007-06-01 21:21:55 +08:00
|
|
|
BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/slugimage.pl \
|
2009-04-06 17:56:30 +08:00
|
|
|
-L $(BIN_DIR)/apex/apex-$(2)-armeb.bin \
|
2009-03-22 20:35:44 +08:00
|
|
|
-k $(BIN_DIR)/openwrt-$(2)-zImage \
|
2010-04-13 07:15:56 +08:00
|
|
|
-r rootfs:$(BIN_DIR)/$(IMG_PREFIX)-$(1).img \
|
2009-03-22 20:35:44 +08:00
|
|
|
-p -o $(BIN_DIR)/openwrt-$(2)-$(1).bin
|
2007-08-10 21:09:12 +08:00
|
|
|
BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/slugimage.pl \
|
2009-04-06 17:56:30 +08:00
|
|
|
-F -L $(BIN_DIR)/apex/apex-$(2)-16mb-armeb.bin \
|
2009-03-22 20:35:44 +08:00
|
|
|
-k $(BIN_DIR)/openwrt-$(2)-zImage \
|
2010-04-13 07:15:56 +08:00
|
|
|
-r rootfs:$(BIN_DIR)/$(IMG_PREFIX)-$(1).img \
|
2009-03-22 20:35:44 +08:00
|
|
|
-p -o $(BIN_DIR)/openwrt-$(2)-$(1)-16mb.bin
|
2009-04-06 17:56:30 +08:00
|
|
|
endef
|
|
|
|
endif
|
2009-03-22 20:35:44 +08:00
|
|
|
|
|
|
|
define Image/Build/Freecom
|
|
|
|
$(INSTALL_DIR) $(TARGET_DIR)/boot
|
|
|
|
# TODO: Add special CMDLINE shim for webupgrade image here
|
|
|
|
$(CP) $(BIN_DIR)/openwrt-$(2)-zImage $(TARGET_DIR)/zImage
|
2009-03-24 02:14:14 +08:00
|
|
|
$(TAR) cfj $(BIN_DIR)/openwrt-$(2)-$(1).img --numeric-owner --owner=0 --group=0 -C $(TARGET_DIR)/ .
|
2009-03-22 20:35:44 +08:00
|
|
|
$(STAGING_DIR_HOST)/bin/encode_crc $(BIN_DIR)/openwrt-$(2)-$(1).img $(BIN_DIR)/openwrt-$(2)-$(1)-webupgrade.img
|
2009-04-06 18:29:40 +08:00
|
|
|
rm -f $(TARGET_DIR)/zImage
|
2007-12-29 05:00:01 +08:00
|
|
|
endef
|
2007-06-01 21:21:55 +08:00
|
|
|
|
2006-08-06 18:42:12 +08:00
|
|
|
define Image/Prepare
|
2007-01-11 05:52:28 +08:00
|
|
|
cp $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/zImage
|
2006-08-06 18:42:12 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/BuildKernel
|
2010-04-13 07:15:56 +08:00
|
|
|
cp $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
|
2010-04-14 22:36:41 +08:00
|
|
|
BIN_DIR=$(BIN_DIR) IMG_PREFIX="$(IMG_PREFIX)" $(TOPDIR)/scripts/arm-magic.sh
|
2006-08-06 18:42:12 +08:00
|
|
|
endef
|
|
|
|
|
2012-10-18 06:03:46 +08:00
|
|
|
# Build sysupgrade image
|
|
|
|
define BuildFirmware/Generic
|
|
|
|
dd if=$(KDIR)/zImage of=$(KDIR)/zImage.pad bs=64k conv=sync; \
|
|
|
|
dd if=$(KDIR)/root.$(1) of=$(KDIR)/root.$(1).pad bs=128k conv=sync; \
|
|
|
|
sh $(TOPDIR)/scripts/combined-image.sh \
|
|
|
|
$(KDIR)/zImage.pad \
|
|
|
|
$(KDIR)/root.$(1).pad \
|
|
|
|
$(BIN_DIR)/$(IMG_PREFIX)-$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))-sysupgrade.bin
|
|
|
|
endef
|
|
|
|
|
2006-06-05 05:57:59 +08:00
|
|
|
define Image/Build
|
2006-08-06 18:42:12 +08:00
|
|
|
$(call Image/Build/$(1),$(1))
|
2012-10-18 06:03:46 +08:00
|
|
|
$(call BuildFirmware/Generic,$(1))
|
2006-08-06 18:42:12 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/jffs2-64k
|
2010-04-13 07:15:56 +08:00
|
|
|
dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=65536 conv=sync
|
2006-08-06 18:42:12 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/jffs2-128k
|
2010-04-13 07:15:56 +08:00
|
|
|
dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=131072 conv=sync
|
2010-09-05 05:48:49 +08:00
|
|
|
$(call Image/Build/Linksys,$(1),nslu2,$(1))
|
2009-03-22 20:35:44 +08:00
|
|
|
$(call Image/Build/Freecom,$(1),fsg3,$(1))
|
2007-03-05 08:21:30 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/squashfs
|
2009-03-22 20:35:44 +08:00
|
|
|
$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
|
2010-04-13 07:15:56 +08:00
|
|
|
dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=131072 conv=sync
|
2009-03-22 20:35:44 +08:00
|
|
|
$(call Image/Build/Linksys,$(1),nslu2,$(1))
|
|
|
|
$(call Image/Build/Freecom,$(1),fsg3,$(1))
|
2006-06-05 05:57:59 +08:00
|
|
|
endef
|
2006-05-31 03:38:38 +08:00
|
|
|
|
2006-06-05 05:57:59 +08:00
|
|
|
$(eval $(call BuildImage))
|