Compiling a snapshot firmware for my Armor Z2 I am getting a segmentation fault when it attempts to build the factory image.
The command it is running appears to be ...
/home/mtf/openwrt-armor-z2/staging_dir/host/bin/mkrasimage -b NBG6817 -v "V1.99(OWRT.9999)C0" -r /home/mtf/openwrt-armor-z2/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/tmp/openwrt-ipq806x-generic-zyxel_nbg6817-squashfs-factory.bin -s 21436416 -o /home/mtf/openwrt-armor-z2/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/tmp/openwrt-ipq806x-generic-zyxel_nbg6817-squashfs-factory.bin.new -k /home/mtf/openwrt-armor-z2/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/zyxel_nbg6817-uImage && mv /home/mtf/openwrt-armor-z2/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/tmp/openwrt-ipq806x-generic-zyxel_nbg6817-squashfs-factory.bin.new /home/mtf/openwrt-armor-z2/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/tmp/openwrt-ipq806x-generic-zyxel_nbg6817-squashfs-factory.bin
I have put this command into gdb and I get ...
Program received signal SIGSEGV, Segmentation fault.
__memmove_sse2_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:405
405 ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
(gdb) bt
#0 __memmove_sse2_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:405
#1 0x000055555555549e in build_image ()
#2 0x00007ffff7a05b97 in __libc_start_main (main=0x555555554c70 <main>, argc=13, argv=0x7fffffffe2a8, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7fffffffe298) at ../csu/libc-start.c:310
#3 0x0000555555554dda in _start ()
(gdb)
I believe the error is in tools/firmware-utils/src/mkrasimage.c it attempts to ensure that the output file is big enough at line 462 which reads ...
rootfs_out.size = rootfs_size < rootfs.size ? rootfs.size : rootfs_size;
However the value of rootfs.size isn't known at that point, so it always picks rootfs_size instead, even though in my case rootfs.size should be larger, consequently when it reaches line 330 of this file and does:
memcpy(rootfs_out.data, rootfs.data, rootfs.size);
it causes the segmentation fault.
Moving the code from line 462 to line 320 fixes the problem.
Not sure how to have this fix added, but hopefully somebody on this forum will be happy to do it?