openwrtv4/target/linux/cns3xxx/image/Makefile
Felix Fietkau 0b3a64f862 cns3xxx: eliminate hardcoded kernel/rootfs partition split
This changes the sysupgrade format. To support upgrades from the old
firmware to the new one, legacy images are provided. Because of the old
partition split, these have to be specific to the NOR or SPI device.

The new sysupgrade images are suitable for begin put on flash directly,
and they are independent of NOR vs SPI flash variant.

Flashing back to old firmware is supported via using the old full-flash
images instead of the old sysupgrade images.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-09-19 14:27:26 +02:00

44 lines
1.5 KiB
Makefile

#
# Copyright (C) 2010-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
define Image/Prepare
mkimage -A arm -O linux -T kernel -C none -a 0x20008000 -e 0x20008000 -n 'OpenWrt Linux-$(LINUX_VERSION)' -d $(KDIR)/zImage $(KDIR)/uImage
endef
LEGACY_NOR_KERNEL_SIZE = 2048k
LEGACY_SPI_KERNEL_SIZE = 1536k
# Build sysupgrade image
define BuildFirmware/Legacy
dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin \
of=$(KDIR)/uImage.pad bs=$(3) count=1
dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin \
of=$(KDIR)/root.$(1).pad bs=$(3) skip=1
sh $(TOPDIR)/scripts/combined-image.sh \
$(KDIR)/uImage.pad \
$(KDIR)/root.$(1).pad \
$(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2)-legacy-sysupgrade.bin
endef
define Image/BuildKernel/Initramfs
mkimage -A arm -O linux -T kernel -C none -a 0x20008000 -e 0x20008000 -n 'OpenWrt Linux-$(LINUX_VERSION)' -d $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-initramfs-uImage
endef
define Image/Build
cat $(KDIR)/uImage $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin
$(call Image/Build/$(1),$(1))
$(call BuildFirmware/Legacy,$(1),laguna_spi,$(LEGACY_SPI_KERNEL_SIZE))
$(call BuildFirmware/Legacy,$(1),laguna_nor,$(LEGACY_NOR_KERNEL_SIZE))
endef
define Image/Build/squashfs
$(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin)
endef
$(eval $(call BuildImage))