yafut: add a kernel update tool for MikroTik NAND

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>
This commit is contained in:
Michał Kępień 2023-03-31 12:40:31 +02:00 committed by Christian Marangi
parent fa4dc86e98
commit 27acf2413e
No known key found for this signature in database
GPG Key ID: AC001D09ADBFEAD7

View File

@ -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))