diff --git a/.gitignore b/.gitignore index 2e834c83764cdea034d8aba969161d1f8c8a72c7..6361521721fc7722978ba83bc1031dd18ad8b2ea 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,9 @@ *~ .fuse_hidden* .mypy_cache +debian/ctucanfd-drv +debian/*.log +debian/*.substvars +debian/debhelper-build-stamp +debian/*.debhelper +debian/files diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000000000000000000000000000000000000..da0c4431fdc91b07e0b66da02988f73be3d83f4d --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +ctucanfd-drv (1.0.0) unstable; urgency=medium + + * Initial dkms build. + + -- Pavel Pisa Fri, 18 Jan 2019 19:09:04 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000000000000000000000000000000000000..76373a685e62cd81d124360bb07e5d2c6df8ed3e --- /dev/null +++ b/debian/control @@ -0,0 +1,22 @@ +Source: ctucanfd-drv +Maintainer: Pavel Pisa +Section: admin +Priority: optional +Build-Depends: debhelper (>=9), + dkms +Standards-Version: 1.0.0 +Vcs-Browser: https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core +Vcs-Git: https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core.git +Homepage: https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core + +Package: ctucanfd-drv +Architecture: all +Depends: ${misc:Depends} +Description: CTU CAN FD IP Core driver + CAN with Flexible Data-rate IP Core developed + at Department of Measurement of FEE CTU. + . + This package provides driver for the core. + It supports PCI express cards as well as it provides + platform driver for SoC integration when appropriate + device tree is provided. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000000000000000000000000000000000000..e59474db0fc6552a7ee97c40fd8acfa7aa31b225 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,69 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: ctucanfd_ip_core +Source: https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core + +Files: /driver/* +Copyright: 2018-2019 Ondrej Ille + 2018-2019 Martin Jerabek + 2018-2019 Pavel Pisa +License: GPL-2.0+ + +Files: /src/* +Copyright: 2018-2019 Ondrej Ille + 2018-2019 Martin Jerabek +License: CTUCANFD-Core License + +License: CTUCANFD-Core License + CTU CAN FD IP Core + Copyright (C) 2015-2018 + . + Authors: + Ondrej Ille + Martin Jerabek + . + Project advisors: + Jiri Novak + Pavel Pisa + . + Department of Measurement (http://meas.fel.cvut.cz/) + Faculty of Electrical Engineering (http://www.fel.cvut.cz) + Czech Technical University (http://www.cvut.cz/) + . + Permission is hereby granted, free of charge, to any person obtaining a copy + of this VHDL component and associated documentation files (the "Component"), + to deal in the Component without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Component, and to permit persons to whom the + Component is furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Component. + . + THE COMPONENT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHTHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE COMPONENT OR THE USE OR OTHER DEALINGS + IN THE COMPONENT. + . + The CAN protocol is developed by Robert Bosch GmbH and protected by patents. + Anybody who wants to implement this IP core on silicon has to obtain a CAN + protocol license from Bosch. + +License: GPL-2.0+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General Public License + Version 2 can be found in `/usr/share/common-licenses/GPL-2'. diff --git a/debian/ctucanfd-drv.install b/debian/ctucanfd-drv.install new file mode 100755 index 0000000000000000000000000000000000000000..e0ba4c240cb3dbad396181cf81ccf5bea0364f7e --- /dev/null +++ b/debian/ctucanfd-drv.install @@ -0,0 +1,9 @@ +#!/bin/sh + +for fname in ctu_can_fd.c ctu_can_fd_frame.h ctu_can_fd_hw.c ctu_can_fd_hw.h \ + ctu_can_fd_regs.h ; do + echo driver/${fname} /usr/src/${PACKAGE_NAME}-${PACKAGE_VERSION} +done +for fname in Kbuild Makefile ; do + echo driver/linux/${fname} /usr/src/${PACKAGE_NAME}-${PACKAGE_VERSION} +done diff --git a/debian/dkms b/debian/dkms new file mode 100644 index 0000000000000000000000000000000000000000..93ca30d68235b742393d3f6c9dd95ab6d8149409 --- /dev/null +++ b/debian/dkms @@ -0,0 +1 @@ +driver/dkms.conf diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000000000000000000000000000000000000..b43bf86b50fd8d3529a0dc062c30006ed38f309e --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README.md diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000000000000000000000000000000000000..2ea362925246da8435add9d46c59cf977a48b9dd --- /dev/null +++ b/debian/rules @@ -0,0 +1,18 @@ +#!/usr/bin/make -f + +export DH_VERBOSE = 1 + +export OMIT_KERNEL_PASSES = y + +PACKAGE_NAME=$(shell grep PACKAGE_NAME= driver/dkms.conf | cut -d= -f2 | cut -d\" -f2) +PACKAGE_VERSION=$(shell grep PACKAGE_VERSION= driver/dkms.conf | cut -d= -f2 | cut -d\" -f2) +export PACKAGE_NAME PACKAGE_VERSION + +%: + dh $@ --with dkms + +# Nothing to configure, build or auto-install (this all happens after +# installation using dkms) +override_dh_auto_configure: +override_dh_auto_build: +override_dh_auto_install: diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000000000000000000000000000000000000..89ae9db8f88b823b6a7eabf55e203658739da122 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/driver/dkms.conf b/driver/dkms.conf new file mode 100644 index 0000000000000000000000000000000000000000..7e5df53fc497f4fbc8b6cd385021f0c1dabc636f --- /dev/null +++ b/driver/dkms.conf @@ -0,0 +1,8 @@ +PACKAGE_VERSION="1.0.0" +PACKAGE_NAME="ctucanfd-drv" +CLEAN="make clean" +BUILT_MODULE_NAME[0]="ctucanfd" +BUILT_MODULE_LOCATION[0]="" +DEST_MODULE_LOCATION[0]="/extra" +MAKE[0]="make KERNEL_VERSION=$kernelver -C ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build" +AUTOINSTALL="yes" diff --git a/driver/linux/Makefile b/driver/linux/Makefile index b7db4a9969a12e009c70245c1c7479f1d57eae0d..301f73e9fa66e3dc204c70b8ac6324332aaec2a1 100644 --- a/driver/linux/Makefile +++ b/driver/linux/Makefile @@ -1,15 +1,32 @@ -CROSS_COMPILE= arm-linux-gnueabihf- +ifeq ($(KERNEL_VERSION),) + +CROSS_COMPILE?= arm-linux-gnueabihf- KDIR ?= /home/mjerabek/projects/kernel/linux-4.15-build/zynq ARCH=arm +ifeq ($(shell hostname),hathi) +INSTALL_DIR=/srv/nfs4/debian-armhf-devel +endif + #KDIR ?= /lib/modules/$(shell uname -r)/build #ARCH ?= x86_64 +else +KDIR = /lib/modules/$(KERNEL_VERSION)/build +endif + +MAKEARGS := -C $(KDIR) +MAKEARGS += $(if $(ARCH),ARCH=$(ARCH)) +MAKEARGS += $(if $(CROSS_COMPILE),CROSS_COMPILE=$(CROSS_COMPILE)) + +$(warning "$(MAKEARGS)") + default: - $(MAKE) -C $(KDIR) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) M=$$PWD -ifeq ($(shell hostname),hathi) - -rm -f /srv/nfs4/debian-armhf-devel/ctucanfd.ko - cp ctucanfd.ko /srv/nfs4/debian-armhf-devel/ + $(MAKE) $(MAKEARGS) M=$$PWD +ifneq ($(INSTALL_DIR),) + -rm -f $(INSTALL_DIR)/ctucanfd.ko + cp ctucanfd.ko $(INSTALL_DIR)/ endif + clean: - $(MAKE) -C $(KDIR) M=$$PWD ARCH=arm clean + $(MAKE) $(MAKEARGS) M=$$PWD clean