2008-09-07 13:28:07 +00:00
|
|
|
#
|
2011-08-04 19:41:16 +00:00
|
|
|
# Copyright (C) 2008-2011 OpenWrt.org
|
2008-07-21 17:08:14 +00:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
2015-08-05 13:55:52 +00:00
|
|
|
|
|
|
|
JFFS2_BLOCKSIZE = 64k 128k 256k
|
|
|
|
|
2008-07-21 17:08:14 +00:00
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
include $(INCLUDE_DIR)/image.mk
|
|
|
|
|
2013-11-01 18:33:22 +00:00
|
|
|
IMAGE_PROFILE:=$(if $(PROFILE),$(PROFILE),Default)
|
|
|
|
|
2015-01-10 15:27:00 +00:00
|
|
|
KERNEL_LOADADDR = 0x80060000
|
|
|
|
|
2016-03-23 12:52:44 +00:00
|
|
|
DEVICE_VARS += NETGEAR_KERNEL_MAGIC NETGEAR_BOARD_ID NETGEAR_HW_ID CMDLINE CONSOLE IMAGE_SIZE BOARDNAME LOADER_FLASH_OFFS LOADER_TYPE
|
2015-01-10 15:27:07 +00:00
|
|
|
|
2016-05-22 21:10:02 +00:00
|
|
|
ifeq ($(SUBTARGET),generic)
|
2016-05-22 20:57:32 +00:00
|
|
|
include ./tp-link.mk
|
2016-05-22 21:06:59 +00:00
|
|
|
include ./ubnt.mk
|
2016-05-22 21:10:02 +00:00
|
|
|
include ./generic.mk
|
|
|
|
endif
|
2016-05-22 21:10:54 +00:00
|
|
|
ifeq ($(SUBTARGET),nand)
|
|
|
|
include ./nand.mk
|
|
|
|
endif
|
2016-05-22 21:04:50 +00:00
|
|
|
include ./legacy.mk
|
2016-05-22 20:57:32 +00:00
|
|
|
|
2015-01-10 15:27:07 +00:00
|
|
|
define Build/netgear-squashfs
|
|
|
|
rm -rf $@.fs $@.squashfs
|
|
|
|
mkdir -p $@.fs/image
|
|
|
|
cp $@ $@.fs/image/uImage
|
|
|
|
$(STAGING_DIR_HOST)/bin/mksquashfs-lzma \
|
|
|
|
$@.fs $@.squashfs \
|
2016-01-31 23:29:41 +00:00
|
|
|
-noappend -root-owned -be -b 65536 \
|
|
|
|
$(if $(SOURCE_DATE_EPOCH),-fixed-time $(SOURCE_DATE_EPOCH))
|
|
|
|
|
2015-01-10 15:27:07 +00:00
|
|
|
dd if=/dev/zero bs=1k count=1 >> $@.squashfs
|
|
|
|
mkimage \
|
|
|
|
-A mips -O linux -T filesystem -C none \
|
|
|
|
-M $(NETGEAR_KERNEL_MAGIC) \
|
|
|
|
-a 0xbf070000 -e 0xbf070000 \
|
|
|
|
-n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
|
|
|
|
-d $@.squashfs $@
|
|
|
|
rm -rf $@.squashfs $@.fs
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/netgear-uImage
|
|
|
|
$(call Build/uImage,$(1) -M $(NETGEAR_KERNEL_MAGIC))
|
|
|
|
endef
|
|
|
|
|
2015-05-11 09:08:33 +00:00
|
|
|
define Build/loader-common
|
|
|
|
rm -rf $@.src
|
|
|
|
$(MAKE) -C lzma-loader \
|
|
|
|
PKG_BUILD_DIR="$@.src" \
|
|
|
|
TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \
|
2016-03-23 12:52:47 +00:00
|
|
|
BOARD="$(BOARDNAME)" \
|
2015-05-11 09:08:33 +00:00
|
|
|
LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
|
2016-03-23 12:52:44 +00:00
|
|
|
$(1) compile loader.$(LOADER_TYPE)
|
|
|
|
mv "$@.$(LOADER_TYPE)" "$@"
|
2015-05-11 09:08:33 +00:00
|
|
|
rm -rf $@.src
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/loader-okli-compile
|
2016-03-23 12:52:47 +00:00
|
|
|
$(call Build/loader-common,FLASH_OFFS=$(LOADER_FLASH_OFFS) FLASH_MAX=0 KERNEL_CMDLINE="$(CMDLINE)")
|
2015-05-11 09:08:33 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/loader-kernel
|
|
|
|
$(call Build/loader-common,LOADER_DATA="$@")
|
|
|
|
endef
|
|
|
|
|
2016-03-23 12:52:47 +00:00
|
|
|
define Build/loader-kernel-cmdline
|
|
|
|
$(call Build/loader-common,LOADER_DATA="$@" KERNEL_CMDLINE="$(CMDLINE)")
|
|
|
|
endef
|
|
|
|
|
2015-05-11 09:08:33 +00:00
|
|
|
define Build/loader-okli
|
|
|
|
dd if=$(KDIR)/loader-$(1).gz bs=7680 conv=sync of="$@.new"
|
|
|
|
cat "$@" >> "$@.new"
|
|
|
|
mv "$@.new" "$@"
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/copy-file
|
|
|
|
cat "$(1)" > "$@"
|
|
|
|
endef
|
|
|
|
|
2015-01-10 15:27:00 +00:00
|
|
|
define Device/Default
|
|
|
|
BOARDNAME :=
|
|
|
|
DEVICE_PROFILE = $$(BOARDNAME)
|
|
|
|
PROFILES = Default Minimal $$(DEVICE_PROFILE)
|
|
|
|
MTDPARTS :=
|
|
|
|
BLOCKSIZE := 64k
|
|
|
|
FILESYSTEMS = $(filter-out jffs2-%,$(TARGET_FILESYSTEMS)) jffs2-$$(BLOCKSIZE)
|
2015-01-10 18:48:14 +00:00
|
|
|
CONSOLE = ttyS0,115200
|
|
|
|
CMDLINE = $$(if $$(BOARDNAME),board=$$(BOARDNAME)) $$(if $$(MTDPARTS),mtdparts=$$(MTDPARTS)) $$(if $$(CONSOLE),console=$$(CONSOLE))
|
2015-01-10 15:27:00 +00:00
|
|
|
KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
|
2015-05-11 09:08:33 +00:00
|
|
|
COMPILE :=
|
2015-01-10 15:27:00 +00:00
|
|
|
IMAGES := sysupgrade.bin
|
|
|
|
IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
|
|
|
|
endef
|
|
|
|
|
2008-07-21 17:08:14 +00:00
|
|
|
$(eval $(call BuildImage))
|