mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-14 13:08:30 +04:00
The factory image of the Dongwon DW02-412H sometimes carries a broken header CRC, as seen by the rebuilder: -Header CRC: 0X990A0000 +Header CRC: 0X990A9FB7 The CRC is written with printf piped into dd bs=4 count=1. Bash's printf writes its output line buffered, so a CRC holding a 0x0a byte is written in two parts: write(1, "\231\n", 2) = 2 write(1, "\237\267", 2) = 2 If dd reads the pipe between the two writes, it gets a short block, and with count=1 it stops there and leaves the rest of the CRC zero. This depends on the scheduling, so busy builders hit it while idle machines almost never do. Delaying the writes reproduces it every time: old: CRC be f8 0a 00 new: CRC be f8 0a 17 Put the header together by concatenation instead, so the image no longer goes through dd. Without the race, the output is the same as before (300 random kernels, all identical and with valid CRCs). Link: https://github.com/openwrt/openwrt/pull/25867 Signed-off-by: Paul Spooren <mail@aparcar.org>