Debian 11 ships coreutils 8.32, whose cksum does not support the
-a crc32b option. This leaves crc empty and causes the subsequent shell
arithmetic expression to fail.
Use Python's built-in binascii.crc32 implementation instead. Python 3 is
already required by the OpenWrt build system and produces the same CRC-32
value before the existing final XOR.
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
cat $BL23 >> $BL2
cat $FLASH_TABLE >> $BL2
-crc=$(cksum -a crc32b $BL2 | cut -d' ' -f1)
+crc=$(python3 -c 'import binascii, sys; print(binascii.crc32(sys.stdin.buffer.read()))' < "$BL2")
# XOR with 0xffffffff
crc=$((0xffffffff ^ $crc))