-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PCIe Linux kernel driver and library
- Loading branch information
Showing
36 changed files
with
5,514 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
# Main Makefile for the pciDriver | ||
|
||
#helpful in case of buildroot crosscompiling | ||
ROOTDIR := | ||
CURDIR := $(shell pwd) | ||
|
||
export SRCDIR := $(CURDIR)/src | ||
|
||
default: | ||
$(Q)$(MAKE) -C $(SRCDIR) | ||
|
||
install: | ||
$(Q)$(MAKE) -C $(SRCDIR) install | ||
@echo "INSTALL 60-udev_fpga.rules" | ||
-$(Q)install -m 644 etc/udev/rules.d/60-udev_fpga.rules $(ROOTDIR)/etc/udev/rules.d/ | ||
|
||
uninstall: | ||
$(Q)$(MAKE) -C $(SRCDIR) uninstall | ||
@echo "UNINSTALL 60-udev_fpga.rules" | ||
-$(Q)rm -f $(ROOTDIR)/etc/udev/rules.d/60-udev_fpga.rules | ||
|
||
clean: | ||
@echo "Cleaning..." | ||
-$(Q)$(MAKE) -C $(SRCDIR) clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Permissions for the fpga devices | ||
|
||
KERNEL="fpga*", OWNER="root", GROUP="users", MODE="660" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
#add relevant overrides to make use of buildroot toolchain | ||
BUILDROOT_DIR="/home/adrian/praca/buildroot/buildroot" | ||
|
||
KERNELDIR="$BUILDROOT_DIR/output/build/linux-3.4.7" | ||
INSTALLDIR="$BUILDROOT_DIR/output/target" | ||
|
||
export ARCH=x86_64 | ||
export CROSS_COMPILE=x86_64-linux- | ||
export PATH="$PATH:$BUILDROOT_DIR/output/host/usr/bin" | ||
|
||
EXTRA_CFLAGS="-D VERBOSE" | ||
|
||
cd src && make KERNELDIR=$KERNELDIR | ||
|
||
cd .. | ||
echo "Copying to $INSTALLDIR" | ||
cp src/pciDriver.ko $INSTALLDIR/opt/ | ||
cp etc/udev/rules.d/60-udev_fpga.rules $INSTALLDIR/etc/udev/rules.d/ | ||
echo "DONE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#makefile symbolic link | ||
pciDriver.h | ||
|
||
#editor backup files | ||
*~ | ||
|
||
#Kbuild files | ||
*.o | ||
*.ko | ||
*.mod.c | ||
Module.symvers | ||
modules.order | ||
.tmp_versions/ | ||
.*.cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
obj-m := pciDriver.o | ||
pciDriver-objs := base.o int.o umem.o kmem.o sysfs.o ioctl.o | ||
|
||
KERNELDIR ?= /lib/modules/$(shell uname -r)/build | ||
INSTALLDIR ?= /lib/modules/$(shell uname -r)/extra | ||
INSTALLHDRDIR ?= /usr/include/pciDriver/driver | ||
PWD := $(shell pwd) | ||
|
||
default: dolink | ||
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules | ||
|
||
dolink: | ||
@ln -sf ../../../include/pcie/driver/pciDriver.h | ||
|
||
install: | ||
@mkdir -p $(INSTALLDIR) | ||
@echo "INSTALL $(INSTALLDIR)/pciDriver.ko" | ||
@install -m 755 pciDriver.ko $(INSTALLDIR) | ||
@echo "INSTALL $(INSTALLHDRDIR)/pciDriver.h" | ||
@mkdir -p $(INSTALLHDRDIR) | ||
@install -m 644 pciDriver.h $(INSTALLHDRDIR) | ||
|
||
uninstall: | ||
@echo "UNINSTALL $(INSTALLDIR)/pciDriver.ko" | ||
@rm -f $(INSTALLDIR)/pciDriver.ko | ||
@echo "UNINSTALL $(INSTALLHDRDIR)/pciDriver.h" | ||
@rm -rf /usr/include/pciDriver/driver | ||
|
||
clean: | ||
rm -f *.o *.ko *.mod.c .*.cmd Module.symvers modules.order | ||
rm -rf .tmp_versions |
Oops, something went wrong.