2018-05-06 08:20:11 +00:00
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
include $(INCLUDE_DIR)/image.mk
|
|
|
|
|
|
|
|
KERNEL_LOADADDR = 0x80060000
|
|
|
|
|
2018-05-07 19:09:44 +00:00
|
|
|
DEVICE_VARS += IMAGE_SIZE LOADER_FLASH_OFFS LOADER_TYPE ATH_SOC
|
2018-05-06 08:20:11 +00:00
|
|
|
|
|
|
|
define Build/loader-common
|
|
|
|
rm -rf $@.src
|
|
|
|
$(MAKE) -C lzma-loader \
|
|
|
|
PKG_BUILD_DIR="$@.src" \
|
|
|
|
TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \
|
|
|
|
LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
|
|
|
|
$(1) compile loader.$(LOADER_TYPE)
|
|
|
|
mv "$@.$(LOADER_TYPE)" "$@"
|
|
|
|
rm -rf $@.src
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/loader-kernel
|
|
|
|
$(call Build/loader-common,LOADER_DATA="$@")
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/loader-kernel-cmdline
|
2018-05-07 19:09:44 +00:00
|
|
|
$(call Build/loader-common,LOADER_DATA="$@")
|
2018-05-06 08:20:11 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
|
|
define Build/loader-okli-compile
|
2018-05-07 19:09:44 +00:00
|
|
|
$(call Build/loader-common,FLASH_OFFS=$(LOADER_FLASH_OFFS) FLASH_MAX=0)
|
2018-05-06 08:20:11 +00:00
|
|
|
endef
|
|
|
|
|
2018-06-06 19:01:32 +00:00
|
|
|
# Arguments: <output name> <kernel offset>
|
2018-05-06 08:20:11 +00:00
|
|
|
define Build/loader-okli
|
2018-06-06 19:01:32 +00:00
|
|
|
dd if=$(KDIR)/loader-$(word 1,$(1)).$(LOADER_TYPE) bs=$(word 2,$(1)) conv=sync of="$@.new"
|
2018-05-06 08:20:11 +00:00
|
|
|
cat "$@" >> "$@.new"
|
|
|
|
mv "$@.new" "$@"
|
|
|
|
endef
|
|
|
|
|
2019-08-04 14:13:45 +00:00
|
|
|
define Build/append-loader-okli
|
|
|
|
cat "$(KDIR)/loader-$(word 1,$(1)).$(LOADER_TYPE)" >> "$@"
|
|
|
|
endef
|
|
|
|
|
2018-04-26 18:04:48 +00:00
|
|
|
define Build/relocate-kernel
|
|
|
|
rm -rf $@.relocate
|
|
|
|
$(CP) ../../generic/image/relocate $@.relocate
|
|
|
|
$(MAKE) -j1 -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
|
|
|
|
( \
|
|
|
|
dd if=$@.relocate/loader.bin bs=32 conv=sync && \
|
|
|
|
perl -e '@s = stat("$@"); print pack("N", @s[7])' && \
|
|
|
|
cat "$@" \
|
|
|
|
) > "$@.new"
|
|
|
|
mv "$@.new" "$@"
|
|
|
|
rm -rf $@.relocate
|
|
|
|
endef
|
|
|
|
|
2018-05-06 08:20:11 +00:00
|
|
|
|
|
|
|
define Device/Default
|
|
|
|
ATH_SOC :=
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
|
|
|
DEVICE_DTS = $$(ATH_SOC)_$(1)
|
2018-05-07 19:09:44 +00:00
|
|
|
PROFILES = Default
|
2018-05-06 08:20:11 +00:00
|
|
|
MTDPARTS :=
|
|
|
|
BLOCKSIZE := 64k
|
|
|
|
KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
|
|
|
|
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
|
|
|
|
COMPILE :=
|
2018-05-07 20:41:04 +00:00
|
|
|
SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
|
2018-05-06 08:20:11 +00:00
|
|
|
IMAGES := sysupgrade.bin
|
2018-05-07 20:41:04 +00:00
|
|
|
IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \
|
|
|
|
append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
|
2018-05-06 08:20:11 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
ifeq ($(SUBTARGET),generic)
|
|
|
|
include ./generic.mk
|
2018-05-07 19:09:44 +00:00
|
|
|
include ./generic-tp-link.mk
|
2018-05-06 08:20:11 +00:00
|
|
|
include ./generic-ubnt.mk
|
|
|
|
endif
|
2018-05-29 08:02:59 +00:00
|
|
|
ifeq ($(SUBTARGET),nand)
|
|
|
|
include ./nand.mk
|
|
|
|
endif
|
2018-05-30 13:18:50 +00:00
|
|
|
ifeq ($(SUBTARGET),tiny)
|
2018-08-06 16:59:23 +00:00
|
|
|
include ./tiny.mk
|
2018-06-20 14:21:07 +00:00
|
|
|
include ./tiny-netgear.mk
|
2018-05-30 13:18:50 +00:00
|
|
|
include ./tiny-tp-link.mk
|
|
|
|
endif
|
2018-05-06 08:20:11 +00:00
|
|
|
$(eval $(call BuildImage))
|