Use KConfig for /cfg filesystem size

Because clearfog and Epia have vastly differing flash sizes, we will
have to specify the desired size of the /cfg filesystem template that we
are making. Let's convert this to a "package" so that we have easy
access to the Kconfig tools -- even though it really isn't about any
"package" per se. On a flip side, this should allow for proper
parallelization of image building, yay!

Change-Id: Ic95a201ab7874711514bdc8b2e60b711db97ddc0
diff --git a/package/Config.in b/package/Config.in
new file mode 100644
index 0000000..24c14d9
--- /dev/null
+++ b/package/Config.in
@@ -0,0 +1,2 @@
+source "$BR2_EXTERNAL_CZECHLIGHT_PATH/package/cla-sysrepo/Config.in"
+source "$BR2_EXTERNAL_CZECHLIGHT_PATH/package/czechlight-cfg-fs/Config.in"
diff --git a/package/czechlight-cfg-fs/Config.in b/package/czechlight-cfg-fs/Config.in
new file mode 100644
index 0000000..c3c5a46
--- /dev/null
+++ b/package/czechlight-cfg-fs/Config.in
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_CZECHLIGHT_CFG_FS
+	bool "Prepare the /cfg partition"
+	help
+	  This is required for RAUC to work properly.
+
+if BR2_PACKAGE_CZECHLIGHT_CFG_FS
+
+config CZECHLIGHT_CFG_FS_SIZE
+	string "exact size"
+	default "128M"
+	help
+	  Size of the /cfg filesystem image.  This must be big enough to
+	  accommodate all configuration, but small enough to fit within the
+	  corresponding partition.
+
+endif # BR2_PACKAGE_CZECHLIGHT_CFG_FS
diff --git a/package/czechlight-cfg-fs/czechlight-cfg-fs.mk b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
new file mode 100644
index 0000000..a1a5bef
--- /dev/null
+++ b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
@@ -0,0 +1,12 @@
+CZECHLIGHT_CFG_FS_INSTALL_TARGET = NO
+CZECHLIGHT_CFG_FS_INSTALL_IMAGES = YES
+CZECHLIGHT_CFG_FS_DEPENDENCIES = host-e2fsprogs
+
+CZECHLIGHT_CFG_FS_LOCATION = $(BINARIES_DIR)/cfg.ext4
+
+define CZECHLIGHT_CFG_FS_INSTALL_IMAGES_CMDS
+	rm -f $(CZECHLIGHT_CFG_FS_LOCATION)
+	$(HOST_DIR)/sbin/mkfs.ext4 -L cfg $(CZECHLIGHT_CFG_FS_LOCATION) $(call qstrip,$(CZECHLIGHT_CFG_FS_SIZE))
+endef
+
+$(eval $(generic-package))