From: Álvaro Fernández Rojas <noltari@gmail.com>
Date: Wed, 3 Jun 2020 09:20:58 +0000 (+0200)
Subject: bcm63xx: ad1018: remove cfe.bin image support
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=231f728f69e0451c44998187cc36ebb0ab9e9ea7;p=openwrt%2Fstaging%2Fldir.git

bcm63xx: ad1018: remove cfe.bin image support

Apparently, Sercomm allows loading a BCM WFI image via CFE, but this image
destroys "serial" and "protect" nand partitions, which is wrong.
It will also set both bootflags to the same value, which causes booting
issues with cferam (cferom will alternatively boot from cferam1 or cferam2
each time the device is rebooted).
Now that OEM Sercomm images are supported it's time to remove this hacky
cfe.bin image support.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---

diff --git a/target/linux/bcm63xx/image/Makefile b/target/linux/bcm63xx/image/Makefile
index eb4b78b06a..d7e2432bdb 100644
--- a/target/linux/bcm63xx/image/Makefile
+++ b/target/linux/bcm63xx/image/Makefile
@@ -96,31 +96,6 @@ define Image/FileSystemStrip
 $(firstword $(subst +,$(space),$(subst root.,,$(notdir $(1)))))
 endef
 
-define Build/ad1018-jffs2-cferam
-	mv $@ $@.kernel
-
-	rm -rf $@-cferam
-	mkdir -p $@-cferam
-
-	# CFE RAM JFFS2 partition
-	cp $(KDIR)/bcm63xx-cfe/$(CFE_RAM_FILE) $@-cferam/$(CFE_RAM_JFFS2_NAME)
-	$(call Build/cfe-jffs2,$@-cferam)
-	mv $@ $@.cferam
-
-	# First block of CFE RAM 1 will be destroyed by MMAP
-	dd if=$@.cferam bs=$(BLOCKSIZE) count=1 > $@
-	dd if=$@.cferam >> $@
-	$(call Build/pad-to,896k)
-
-	# CFE RAM 2
-	dd if=$@.cferam >> $@
-
-	# Append kernel @ 4M
-	$(call Build/pad-to,4096k)
-	dd if=$@.kernel >> $@
-	rm -f $@.kernel
-endef
-
 define Build/cfe-bin
 	$(STAGING_DIR_HOST)/bin/imagetag -i $(IMAGE_KERNEL) -f $(IMAGE_ROOTFS) \
 		--output $@ --boardid $(CFE_BOARD_ID) --chipid $(CHIP_ID) \
diff --git a/target/linux/bcm63xx/image/bcm63xx_nand.mk b/target/linux/bcm63xx/image/bcm63xx_nand.mk
index 74f23f52af..7b2039c988 100644
--- a/target/linux/bcm63xx/image/bcm63xx_nand.mk
+++ b/target/linux/bcm63xx/image/bcm63xx_nand.mk
@@ -39,7 +39,7 @@ endef
 
 define Device/sercomm-nand
   $(Device/bcm63xx-nand)
-  IMAGES += factory.img
+  IMAGES = factory.img sysupgrade.bin
   IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | cfe-sercomm-part | gzip | cfe-sercomm-load | cfe-sercomm-crypto
   SERCOM_PID :=
   SERCOMM_VERSION :=
@@ -125,7 +125,6 @@ TARGET_DEVICES += netgear_dgnd3700-v2
 ### Sercomm ###
 define Device/sercomm_ad1018
   $(Device/sercomm-nand)
-  IMAGE/cfe.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | ad1018-jffs2-cferam | append-ubi | cfe-wfi-tag
   DEVICE_VENDOR := Sercomm
   DEVICE_MODEL := AD1018
   CHIP_ID := 6328