Skip to content

Instantly share code, notes, and snippets.

@pratimugale
Last active August 25, 2019 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pratimugale/d01bc6120f7a75454ab9ceff065fff6f to your computer and use it in GitHub Desktop.
Save pratimugale/d01bc6120f7a75454ab9ceff065fff6f to your computer and use it in GitHub Desktop.
# Makefile that contains the install instructions to create the pruapi debian package.
# Path to the pruss_api.c loadable kernel module.
MDIR := drivers
# Path to the prussd.py python daemon service.
DDIR := prussd
# Path to the cpp-bindings.
CDIR := cpp-bindings
# Path to the linux kernel headers to compile the pruss_api.c module.
KDIR := /lib/modules/$(shell uname -r)/build
# Object files.
obj-m += pruss_api.o
# Rule for make.
all:
@echo "all:"
# Compiling the kernel driver.
driver:
$(MAKE) -C $(KDIR) M=$$PWD/$(MDIR)
# How and where the library files must be placed.
library:
@g++ -c $$PWD/$(CDIR)/pruss.cpp
@ar rvs libpruss.a pruss.o
@cp -v libpruss.a /usr/lib/
@cp -v $$PWD/$(CDIR)/pruss.cpp /usr/lib/
@cp -v $$PWD/$(CDIR)/pruss.h /usr/include/
@cp -v $$PWD/$(CDIR)/pruss.cpp /usr/include/
example:
#@cd examples/firmware_examples/example2-rpmsg-pru1/ && make
@cp -v $$PWD/am335x-pru1-fw /usr/bin
@cp -v examples/firmware_examples/example2-rpmsg-pru1/userspace.o /usr/bin
# All the install instructions that will be executed while running checkinstall.
install: driver library example
@echo "Starting the installation"
@echo 'cp $$PWD/$(MDIR)/pruss_api.ko /lib/modules/$(shell uname -r)'
@cp -v $$PWD/$(MDIR)/pruss_api.ko /lib/modules/$(shell uname -r)
#This instruction goes to the postinstall script.
@sudo depmod -ae
#Daemon installation
@cp -v "$$PWD/$(DDIR)/prussd.py" "/usr/bin"
@cp -v "$$PWD/$(DDIR)/prussd.service" "/lib/systemd/system/prussd.service"
@cp -v "$$PWD/$(DDIR)/prussd.conf" "/etc/default/prussd.conf"
@sed -i -e "s:DIR:${PWD}:" "/lib/systemd/system/prussd.service"
@sed -i -e "s:DIR:${PWD}:" "/etc/default/prussd.conf"
# Postinstall
@chmod a+x "/usr/bin/prussd.py"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment