How to skip targets whose image file is too big?

Hi

I'd like to compile for multiple targets like mt7620 default profile (compile for all target in this profile)
Compilation doesn't finish because the image file is too big for some targets like ex2700, and a lot of firmware are not built.
How can I skip all these target and get all other one built correctly?

Thanks

I’ve not seen this myself before. Can you paste some examples of the errors you get inside some code blocks </> ?

I added some packages. It seems that in most platforms like ar71xx, I just have less image at the end, silently skipping targets which don't fit.
Some other are not skipping like ramips mt7620:
The problem seems to be in mkdniimg which should not be executed when source image doesn't exist.

mv /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/ex2700-kernel.bin.new /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/ex2700-kernel.bin
touch /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/ex2700-kernel.bin.fakehdr
/home/sophana/src/ws/18.06-2/wrt/staging_dir/host/bin/mkimage -A mips -O linux -T filesystem -C none -n 'OpenWrt fake filesystem' -d /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/ex2700-kernel.bin.fakehdr -s /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/ex2700-kernel.bin.fakehdr
Image Name:   OpenWrt fake filesystem
Created:      Wed Jan 30 12:21:02 2019
Image Type:   MIPS Linux Filesystem Image (uncompressed)
Data Size:    0 Bytes = 0.00 KiB = 0.00 MiB
Load Address: 00000000
Entry Point:  00000000
cat /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/ex2700-kernel.bin.fakehdr >> /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/ex2700-kernel.bin
[ -f /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/ex2700-kernel.bin -a -f /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/root.squashfs ]
dd if=/home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/ex2700-kernel.bin >> /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-sysupgrade.bin
2816+0 records in
2816+0 records out
1441792 bytes (1.4 MB, 1.4 MiB) copied, 0.0257756 s, 55.9 MB/s
dd if=/home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/root.squashfs >> /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-sysupgrade.bin
8855+1 records in
8855+1 records out
4533994 bytes (4.5 MB, 4.3 MiB) copied, 0.068154 s, 66.5 MB/s
/home/sophana/src/ws/18.06-2/wrt/staging_dir/host/bin/padjffs2 /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-sysupgrade.bin  4
padding image to 005b3000
echo '{  "supported_devices":["ex2700"], "version": { "dist": "OpenWrt", "version": "18.06.2", "revision": "r7676-cddd7b4c77", "board": "ramips" } }' | fwtool -I - /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-sysupgrade.bin
WARNING: Image file /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-sysupgrade.bin is too big
cp /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-sysupgrade.bin /home/sophana/src/ws/18.06-2/wrt/bin/ipq40xx-full/targets/ramips/mt7620/openwrt-ramips-mt7620-ex2700-squashfs-sysupgrade.bin
cp: cannot stat '/home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-sysupgrade.bin': No such file or directory
Makefile:288: recipe for target '/home/sophana/src/ws/18.06-2/wrt/bin/ipq40xx-full/targets/ramips/mt7620/openwrt-ramips-mt7620-ex2700-squashfs-sysupgrade.bin' failed
make[5]: [/home/sophana/src/ws/18.06-2/wrt/bin/ipq40xx-full/targets/ramips/mt7620/openwrt-ramips-mt7620-ex2700-squashfs-sysupgrade.bin] Error 1 (ignored)
[ -f /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/ex2700-kernel.bin -a -f /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/root.squashfs ]
dd if=/home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/ex2700-kernel.bin >> /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-factory.bin
2816+0 records in
2816+0 records out
1441792 bytes (1.4 MB, 1.4 MiB) copied, 0.0275259 s, 52.4 MB/s
dd if=/home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/root.squashfs >> /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-factory.bin
8855+1 records in
8855+1 records out
4533994 bytes (4.5 MB, 4.3 MiB) copied, 0.0702548 s, 64.5 MB/s
/home/sophana/src/ws/18.06-2/wrt/staging_dir/host/bin/padjffs2 /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-factory.bin  4
padding image to 005b3000
WARNING: Image file /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-factory.bin is too big
/home/sophana/src/ws/18.06-2/wrt/staging_dir/host/bin/mkdniimg -B EX2700 -v OpenWrt.r7676 -H 29764623+4+0+32+2x2+0 -r "" -i /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-factory.bin -o /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-factory.bin.new
[mkdniimg] *** error: stat failed on /home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-factory.bin: No such file or directory
Makefile:288: recipe for target '/home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-factory.bin' failed
make[5]: *** [/home/sophana/src/ws/18.06-2/wrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/tmp/openwrt-ramips-mt7620-ex2700-squashfs-factory.bin] Error 1
make[5]: Leaving directory '/home/sophana/src/ws/18.06-2/wrt/target/linux/ramips/image'
Makefile:26: recipe for target 'install' failed
make[4]: *** [install] Error 2
make[4]: Leaving directory '/home/sophana/src/ws/18.06-2/wrt/target/linux/ramips'
Makefile:13: recipe for target 'install' failed
make[3]: *** [install] Error 2
make[3]: Leaving directory '/home/sophana/src/ws/18.06-2/wrt/target/linux'
time: target/linux/install#204.34#18.95#239.83
target/Makefile:23: recipe for target 'target/linux/install' failed
make[2]: *** [target/linux/install] Error 2
make[2]: Leaving directory '/home/sophana/src/ws/18.06-2/wrt'
target/Makefile:19: recipe for target '/home/sophana/src/ws/18.06-2/wrt/staging_dir/target-mipsel_24kc_musl/stamp/.target_install' failed
make[1]: *** [/home/sophana/src/ws/18.06-2/wrt/staging_dir/target-mipsel_24kc_musl/stamp/.target_install] Error 2
make[1]: Leaving directory '/home/sophana/src/ws/18.06-2/wrt'
/home/sophana/src/ws/18.06-2/wrt/include/toplevel.mk:216: recipe for target 'world' failed
make: *** [world] Error 2

This patch is probably 6 months old, but it should demonstrate the principle behind what needs to be done.
Basically find the crash, understand what part of the image production is causing it to fail. Add a condition around it and then always perform a simple command which will return true so the compiler continues.
I have a similar patch for ar71xx as well.

There should be a better way of doing this.

I applied the patch and it works. Thanks
Is it applied in trunk or 18.06 branch?

Hah, no.
I've asked why this behaviour is how it is on IRC before and my sanity was questioned.

What do you mean by sanity?
Is there a better way of doing? did they say why?

What is sure that making an error like today is simply a bug.

Why not do a pull request?