summaryrefslogtreecommitdiffstats
path: root/Documentation/EDID/Makefile
diff options
context:
space:
mode:
authorChristoph Niedermaier <cniedermaier@dh-electronics.de>2018-11-05 09:48:35 +0100
committerJonathan Corbet <corbet@lwn.net>2018-11-06 15:36:22 +0100
commit8bed5a5cfc3317217f4b4ddad8044cbdd13d5a20 (patch)
tree17192f617896cd0afc7bbd22e84d01eaaa2f01b2 /Documentation/EDID/Makefile
parentDocs/EDID: Fixed erroneous bits of XOFFSET, XPULSE, YOFFSET and YPULSE (diff)
downloadlinux-8bed5a5cfc3317217f4b4ddad8044cbdd13d5a20.tar.xz
linux-8bed5a5cfc3317217f4b4ddad8044cbdd13d5a20.zip
Docs/EDID: Calculate CRC while building the code
The previous version made it necessary to first generate an EDID data set without correct CRC and then to fix the CRC in a second step. This patch adds the CRC calculation to the makefile in such a way that a correct EDID data set is generated in a single build step. Successfully tested with all existing and a couple of new data sets. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.de> Reviewed-by: Carsten Emde <C.Emde@osadl.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/EDID/Makefile')
-rw-r--r--Documentation/EDID/Makefile15
1 files changed, 13 insertions, 2 deletions
diff --git a/Documentation/EDID/Makefile b/Documentation/EDID/Makefile
index 17763ca3f12b..85a927dfab02 100644
--- a/Documentation/EDID/Makefile
+++ b/Documentation/EDID/Makefile
@@ -15,10 +15,21 @@ clean:
%.o: %.S
@cc -c $^
-%.bin: %.o
+%.bin.nocrc: %.o
@objcopy -Obinary $^ $@
-%.bin.ihex: %.o
+%.crc: %.bin.nocrc
+ @list=$$(for i in `seq 1 127`; do head -c$$i $^ | tail -c1 \
+ | hexdump -v -e '/1 "%02X+"'; done); \
+ echo "ibase=16;100-($${list%?})%100" | bc >$@
+
+%.p: %.crc %.S
+ @cc -c -DCRC="$$(cat $*.crc)" -o $@ $*.S
+
+%.bin: %.p
+ @objcopy -Obinary $^ $@
+
+%.bin.ihex: %.p
@objcopy -Oihex $^ $@
@dos2unix $@ 2>/dev/null