rootfs: Allow caching of the raw rootfs

In flaky network environments, rebuilding the rootfs raw image becomes a
significant pain and in some cases, nearly impossible. This change allows us to
bypass the need to regenerate the raw rootfs every build and instead use a
rootfs placed in the cache directory.

Change-Id: Iaf0476ce835a379f2fdd69906f0cb3c0a190635d
diff --git a/ b/
index 92064b6..15e15e5 100644
--- a/
+++ b/
@@ -82,6 +82,10 @@
 	mkdir -p $(dir $(ROOTFS_RAW_IMG))
 	cp $< $<.sha256sum $(dir $(ROOTFS_RAW_IMG))
+else ifeq ($(shell test -f $(ROOTDIR)/cache/rootfs.raw.img && echo found),found)
+$(ROOTFS_RAW_IMG): $(ROOTDIR)/cache/rootfs.raw.img
+	cp $(ROOTDIR)/cache/rootfs.raw.img $(ROOTFS_RAW_IMG)
+	sha256sum $(ROOTFS_RAW_IMG) > $(ROOTFS_RAW_IMG).sha256sum
 $(ROOTFS_RAW_IMG): $(ROOTDIR)/build/ $(ROOTDIR)/build/ /usr/bin/qemu-aarch64-static
 	mkdir -p $(ROOTFS_DIR)