yafut: add a kernel update tool for MikroTik NAND
authorMichał Kępień <openwrt@kempniu.pl>
Fri, 31 Mar 2023 10:40:31 +0000 (12:40 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Tue, 18 Apr 2023 11:53:04 +0000 (13:53 +0200)
Commit 9d96b6fb72 ("ath79/mikrotik: disable building NAND images")
disabled building images for MikroTik devices with NAND flash due to a
less than satisfactory method used for updating the kernel on those
devices back then.

To address the problem, add support for updating the kernel on MikroTik
devices with NAND flash using a new tool, Yafut, which enables copying
files from/to Yaffs file systems even if the kernel does not have native
support for the Yaffs file system compiled in.  Instead of erasing the
entire NAND partition holding the kernel during every system upgrade
(which is what the previously-used approach employing kernel2minor
involved), Yafut preserves the Yaffs filesystem present on that
partition and only replaces the kernel executable.  This allows bad
block information to be preserved across sysupgrade runs and also
enables wear leveling on the NAND partition holding the kernel.  Yafut
does not rely on kernel2minor in any way and intends to eventually
supersede the latter for NAND devices.

Signed-off-by: Michał Kępień <openwrt@kempniu.pl>
package/utils/yafut/Makefile [new file with mode: 0644]

diff --git a/package/utils/yafut/Makefile b/package/utils/yafut/Makefile
new file mode 100644 (file)
index 0000000..fe27db9
--- /dev/null
@@ -0,0 +1,35 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=yafut
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL=https://github.com/kempniu/yafut.git
+PKG_SOURCE_DATE:=2023-03-31
+PKG_SOURCE_VERSION:=16435e89d449f953712983315e1a89cdb678620d
+
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=LICENSE
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+CMAKE_INSTALL:=1
+
+define Package/yafut
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Yet Another File UTility
+  DEPENDS:=@NAND_SUPPORT
+endef
+
+define Package/yafut/description
+  A program for copying files from/to Yaffs file systems from userspace.
+endef
+
+define Package/yafut/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/yafut $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,yafut))