27 lines
597 B
Makefile
27 lines
597 B
Makefile
# Source and target file names
|
|
DTS = counter.dts
|
|
DTBO = counter.dtbo
|
|
|
|
# Installation paths
|
|
OVERLAY_DIR = /boot/overlays
|
|
CONFIG_TXT = /boot/firmware/config.txt
|
|
OVERLAY_NAME = counter
|
|
|
|
all: $(DTBO)
|
|
|
|
$(DTBO): $(DTS)
|
|
dtc -@ -I dts -O dtb -o $@ $<
|
|
|
|
install: $(DTBO)
|
|
sudo cp $(DTBO) $(OVERLAY_DIR)/
|
|
@if ! grep -q "^dtoverlay=$(OVERLAY_NAME)$$" $(CONFIG_TXT); then \
|
|
echo "dtoverlay=$(OVERLAY_NAME)" | sudo tee -a $(CONFIG_TXT); \
|
|
else \
|
|
echo "Overlay already present in config.txt."; \
|
|
fi
|
|
@echo "Installation complete. Reboot your Raspberry Pi to activate the overlay."
|
|
|
|
clean:
|
|
rm -f *.dtbo
|
|
|