build:next: fix ext_flash_release target

The intent was that ext_flash_target build a tarball with all the bits
needed to flash a Nexus board. When running on Renode the builtins
are built but not packaged as they are loaded directly into memory. For
Nexus we need to package the builtins so they can be written to flash
from where they are loaded by tock.

Change-Id: I5d47b1ab9b8a58f18edd42b0930764552bca5d12
diff --git a/platforms/nexus/sim.mk b/platforms/nexus/sim.mk
index 4c85b3a..d4e8ab0 100644
--- a/platforms/nexus/sim.mk
+++ b/platforms/nexus/sim.mk
@@ -20,6 +20,7 @@
 
 # NB: $(CANTRIP_ROOTSERVER_*) is built together with $(CANTRIP_KERNEL_*)
 
+# NB: debug builds are too big to run on Nexus so an ext_flash_debug target is pointless
 $(OUT)/ext_flash_debug.tar: $(MATCHA_BUNDLE_DEBUG) $(CANTRIP_KERNEL_DEBUG) $(CANTRIP_ROOTSERVER_DEBUG) | $(OUT)/tmp
 	cp -f $(MATCHA_BUNDLE_DEBUG) $(OUT)/tmp/matcha-tock-bundle
 	${C_PREFIX}strip $(OUT)/tmp/matcha-tock-bundle
@@ -35,7 +36,13 @@
 	ln -sf $(CANTRIP_KERNEL_RELEASE) $(OUT)/tmp/kernel
 	ln -sf $(CANTRIP_ROOTSERVER_RELEASE) $(OUT)/tmp/capdl-loader
 	tar -C $(OUT)/tmp -cvhf $(OUT)/ext_flash_release.tar matcha-tock-bundle.bin kernel capdl-loader
-ext_flash_release: ${OUT}/ext_flash_release.tar
+
+# NB: Package the builtins bundle so it can be written to a carveout in
+#     in SMC memory; this is temporary until the SEC supports returning
+#     the builtins from flash.
+ext_flash_release: ${OUT}/ext_flash_release.tar $(CANTRIP_OUT_RELEASE)/ext_builtins.cpio
+	ln -sf $(CANTRIP_OUT_RELEASE)/ext_builtins.cpio $(OUT)/tmp/cantrip-builtins
+	tar -C $(OUT)/tmp -rvhf $(OUT)/ext_flash_release.tar cantrip-builtins
 
 # Dredge the platform configuration for the physical address where the
 # cpio archive is expected.