From 27acf2413e91247e16e4f52c6008ec0f5a5cf4a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Fri, 31 Mar 2023 12:40:31 +0200 Subject: [PATCH] yafut: add a kernel update tool for MikroTik NAND MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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ń --- package/utils/yafut/Makefile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 package/utils/yafut/Makefile diff --git a/package/utils/yafut/Makefile b/package/utils/yafut/Makefile new file mode 100644 index 0000000000..fe27db97d2 --- /dev/null +++ b/package/utils/yafut/Makefile @@ -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)) -- 2.30.2