2018-05-06 08:20:11 +00:00
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
include $(INCLUDE_DIR)/image.mk
|
|
|
|
|
|
|
|
KERNEL_LOADADDR = 0x80060000
|
|
|
|
|
2020-03-09 12:14:06 +00:00
|
|
|
DEVICE_VARS += LOADER_FLASH_OFFS LOADER_TYPE
|
2021-02-25 03:35:37 +00:00
|
|
|
DEVICE_VARS += LOADER_FLASH_MAX LOADER_KERNEL_MAGIC
|
2021-02-14 09:16:33 +00:00
|
|
|
DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID
|
|
|
|
DEVICE_VARS += RAS_BOARD RAS_ROOTFS_SIZE RAS_VERSION
|
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 $@)" \
|
|
|
|
$(1) compile loader.$(LOADER_TYPE)
|
|
|
|
mv "$@.$(LOADER_TYPE)" "$@"
|
|
|
|
rm -rf $@.src
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/loader-kernel
|
2021-07-31 20:56:29 +00:00
|
|
|
$(call Build/loader-common, \
|
|
|
|
LOADER_DATA="$@" \
|
|
|
|
BOARD="$(DEVICE_NAME)" )
|
2018-05-06 08:20:11 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/loader-okli-compile
|
2021-02-25 03:35:37 +00:00
|
|
|
$(call Build/loader-common, \
|
|
|
|
FLASH_OFFS=$(LOADER_FLASH_OFFS) \
|
|
|
|
FLASH_MAX=$(LOADER_FLASH_MAX) \
|
2021-07-31 20:56:29 +00:00
|
|
|
KERNEL_MAGIC=$(LOADER_KERNEL_MAGIC) \
|
|
|
|
BOARD="$(DEVICE_NAME)" )
|
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
|
|
|
|
|
2020-08-03 21:07:21 +00:00
|
|
|
define Build/append-loader-okli-uimage
|
|
|
|
cat "$(KDIR)/loader-$(word 1,$(1)).uImage" >> "$@"
|
|
|
|
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
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
2019-12-20 00:12:42 +00:00
|
|
|
DEVICE_DTS = $$(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
|
2021-05-08 21:34:30 +00:00
|
|
|
LOADER_KERNEL_MAGIC :=
|
|
|
|
LOADER_FLASH_MAX :=
|
|
|
|
LOADER_FLASH_OFFS :=
|
|
|
|
LOADER_TYPE :=
|
2018-05-06 08:20:11 +00:00
|
|
|
COMPILE :=
|
|
|
|
IMAGES := sysupgrade.bin
|
2018-05-07 20:41:04 +00:00
|
|
|
IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \
|
2021-06-20 16:54:36 +00:00
|
|
|
append-rootfs | pad-rootfs | check-size | append-metadata
|
2018-05-06 08:20:11 +00:00
|
|
|
endef
|
|
|
|
|
2021-09-26 14:07:44 +00:00
|
|
|
define Device/loader-okli-uimage
|
|
|
|
LOADER_TYPE := bin
|
|
|
|
COMPILE := loader-$(1).bin loader-$(1).uImage
|
|
|
|
COMPILE/loader-$(1).bin := loader-okli-compile
|
2022-12-03 14:25:12 +00:00
|
|
|
COMPILE/loader-$(1).uImage := loader-okli-compile | pad-to 64k | \
|
2021-09-26 14:07:44 +00:00
|
|
|
lzma | uImage lzma
|
|
|
|
endef
|
|
|
|
|
2020-06-07 11:11:15 +00:00
|
|
|
include $(SUBTARGET).mk
|
|
|
|
|
2018-05-06 08:20:11 +00:00
|
|
|
ifeq ($(SUBTARGET),generic)
|
2020-06-07 11:11:15 +00:00
|
|
|
include generic-tp-link.mk
|
|
|
|
include generic-ubnt.mk
|
2018-05-29 08:02:59 +00:00
|
|
|
endif
|
2020-06-07 11:11:15 +00:00
|
|
|
|
2018-05-30 13:18:50 +00:00
|
|
|
ifeq ($(SUBTARGET),tiny)
|
2020-06-07 11:11:15 +00:00
|
|
|
include tiny-netgear.mk
|
|
|
|
include tiny-tp-link.mk
|
2021-12-25 08:19:52 +00:00
|
|
|
include tiny-ubnt.mk
|
2018-05-30 13:18:50 +00:00
|
|
|
endif
|
2020-06-07 11:11:15 +00:00
|
|
|
|
2018-05-06 08:20:11 +00:00
|
|
|
$(eval $(call BuildImage))
|