From: Robert Marko <robimarko@gmail.com>
Date: Sun, 18 Apr 2021 17:05:47 +0000 (+0200)
Subject: build: image: add UBIFS kernel packer
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=da3261e57cf33d6804222c614c77e13fdb32cf95;p=openwrt%2Fstaging%2Fxback.git

build: image: add UBIFS kernel packer

This allows packing the kernel into UBIFS like newer
MikroTik NAND devices require.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---

diff --git a/include/image-commands.mk b/include/image-commands.mk
index 91865e1e7e..23c7bd6133 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -27,6 +27,15 @@ define Build/append-kernel
 	dd if=$(IMAGE_KERNEL) >> $@
 endef
 
+define Build/package-kernel-ubifs
+	mkdir $@.kernelubifs
+	cp $@ $@.kernelubifs/kernel
+	$(STAGING_DIR_HOST)/bin/mkfs.ubifs \
+		$(KERNEL_UBIFS_OPTS) \
+		-r $@.kernelubifs $@
+	rm -r $@.kernelubifs
+endef
+
 define Build/append-image
 	dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) >> $@
 endef