mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 13:22:23 +00:00
8bed5a5cfc
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>
38 lines
707 B
Makefile
38 lines
707 B
Makefile
|
|
SOURCES := $(wildcard [0-9]*x[0-9]*.S)
|
|
|
|
BIN := $(patsubst %.S, %.bin, $(SOURCES))
|
|
|
|
IHEX := $(patsubst %.S, %.bin.ihex, $(SOURCES))
|
|
|
|
CODE := $(patsubst %.S, %.c, $(SOURCES))
|
|
|
|
all: $(BIN) $(IHEX) $(CODE)
|
|
|
|
clean:
|
|
@rm -f *.o *.bin.ihex *.bin *.c
|
|
|
|
%.o: %.S
|
|
@cc -c $^
|
|
|
|
%.bin.nocrc: %.o
|
|
@objcopy -Obinary $^ $@
|
|
|
|
%.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
|
|
|
|
%.c: %.bin
|
|
@echo "{" >$@; hexdump -f hex $^ >>$@; echo "};" >>$@
|