diff --git a/include/image-commands.mk b/include/image-commands.mk index 83ecf7c520..f2c3f76f91 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -438,6 +438,20 @@ define Build/kernel2minor rm -f $(temp_file) endef +define Build/yaffs-filesystem + let \ + kernel_size="$$(stat -c%s $@)" \ + kernel_chunks="(kernel_size / 1024) + 1" \ + filesystem_chunks="kernel_chunks + 3" \ + filesystem_blocks="(filesystem_chunks / 63) + 1" \ + filesystem_size="filesystem_blocks * 64 * 1024" \ + filesystem_size_with_reserve="(filesystem_blocks + 2) * 64 * 1024"; \ + head -c $$filesystem_size_with_reserve /dev/zero | tr "\000" "\377" > $@.img \ + && yafut -d $@.img -w -i $@ -o kernel -C 1040 -B 64k -E -P -S $(1) \ + && truncate -s $$filesystem_size $@.img \ + && mv $@.img $@ +endef + define Build/kernel-bin rm -f $@ cp $< $@ diff --git a/target/linux/ath79/image/common-mikrotik.mk b/target/linux/ath79/image/common-mikrotik.mk index b37c8b7197..94c29d8cb6 100644 --- a/target/linux/ath79/image/common-mikrotik.mk +++ b/target/linux/ath79/image/common-mikrotik.mk @@ -10,7 +10,7 @@ endef define Device/mikrotik_nor $(Device/mikrotik) DEVICE_PACKAGES := -yafut - IMAGE/sysupgrade.bin := append-kernel | kernel2minor -s 1024 -e | \ + IMAGE/sysupgrade.bin := append-kernel | yaffs-filesystem -M | \ pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \ check-size | append-metadata endef diff --git a/target/linux/ipq40xx/image/mikrotik.mk b/target/linux/ipq40xx/image/mikrotik.mk index f0e1f1aad3..8c2c6fa08e 100644 --- a/target/linux/ipq40xx/image/mikrotik.mk +++ b/target/linux/ipq40xx/image/mikrotik.mk @@ -5,7 +5,7 @@ define Device/mikrotik_nor KERNEL_NAME := vmlinux KERNEL := kernel-bin | append-dtb-elf IMAGES = sysupgrade.bin - IMAGE/sysupgrade.bin := append-kernel | kernel2minor -s 1024 | \ + IMAGE/sysupgrade.bin := append-kernel | yaffs-filesystem -L | \ pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \ check-size | append-metadata endef diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 8886456bbb..0643cd29f4 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1770,7 +1770,7 @@ define Device/MikroTik DEVICE_PACKAGES := kmod-usb3 -uboot-envtools KERNEL_NAME := vmlinuz KERNEL := kernel-bin | append-dtb-elf - IMAGE/sysupgrade.bin := append-kernel | kernel2minor -s 1024 | \ + IMAGE/sysupgrade.bin := append-kernel | yaffs-filesystem -L | \ pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | \ append-metadata endef diff --git a/tools/Makefile b/tools/Makefile index f60a458f98..f4e749d710 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -83,6 +83,7 @@ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_mxs),y) += elftosb sdim tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_realtek),y) += 7z tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_tegra),y) += cbootimage cbootimage-configs tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USES_MINOR),y) += kernel2minor +tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USES_MINOR),y) += yafut tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_SPARSE),y) += sparse tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_LLVM_BUILD),y) += llvm-bpf tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_MOLD),y) += mold @@ -130,6 +131,7 @@ $(curdir)/sdcc/compile := $(curdir)/bison/compile $(curdir)/squashfs3-lzma/compile := $(curdir)/lzma-old/compile $(curdir)/squashfs4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/util-linux/compile := $(curdir)/bison/compile +$(curdir)/yafut/compile := $(curdir)/cmake/compile ifneq ($(HOST_OS),Linux) $(curdir)/coreutils/compile += $(curdir)/automake/compile $(curdir)/bison/compile $(curdir)/gnulib/compile