Package: unipi-kernel-modules-dkms
Architecture: all
-Pre-Depends: raspberrypi-kernel-headers | axon-kernel-headers | linux-headers(>=4.0) | zulu-kernel-headers, unipi-common
+Pre-Depends: raspberrypi-kernel-headers | axon-kernel-headers | linux-headers(>=4.0), unipi-common
Depends: ${misc:Depends}, dkms, unipi-firmware (>=5.50)
Replaces: neuron-kernel, unipi-kernel-modules
Conflicts: neuron-kernel, unipi-kernel-modules
--- /dev/null
+#!/bin/bash
+
+
+. /ci-scripts/include.sh
+
+arch=`dpkg-architecture -q DEB_BUILD_ARCH`
+
+# ${PRODUCT} set by gitlab-ci
+# ${DEBIAN_VERSION} from bob-the-builder image
+# ${arch} from building arch
+
+PROJECT_VERSION=$(dpkg-parsechangelog -S Version)
+
+if [ -z "${PRODUCT}" ]; then
+ ################## dkms #################333
+ cat >debian/rules.in <<EOF
+%:
+ dh \$@ --with dkms
+
+override_dh_dkms:
+ dh_dkms -V ${PROJECT_VERSION}
+ make dkms DESTDIR=${PWD}/debian/unipi-kernel-modules-dkms/usr/src/unipi-${PROJECT_VERSION}
+
+override_dh_auto_build:
+
+override_dh_auto_install:
+
+EOF
+ exit 0
+ ################## end of dkms #################333
+fi
+
+case "${PRODUCT}" in
+ neuron )
+ if [ "${DEBIAN_VERSION}" == "stretch" ]; then
+ BINARY_PKG_NAME=neuron-kernel
+ else
+ BINARY_PKG_NAME=unipi-kernel-modules
+ fi
+ PKG_KERNEL_HEADERS=raspberrypi-kernel-headers
+ PKG_KERNEL_IMAGE=raspberrypi-kernel
+ ;;
+ neuron64 )
+ BINARY_PKG_NAME=unipi-kernel-modules
+ PKG_KERNEL_IMAGE=raspberrypi-kernel
+ PKG_KERNEL_HEADERS=raspberrypi-kernel-headers
+ ;;
+ axon )
+ BINARY_PKG_NAME=unipi-kernel-modules
+ PKG_KERNEL_HEADERS=axon-kernel-headers
+ PKG_KERNEL_IMAGE=axon-kernel-image
+ ;;
+ g1 )
+ if [ "${DEBIAN_VERSION}" == "buster" ]; then
+ BINARY_PKG_NAME=g1-unipi-kernel-modules
+ else
+ BINARY_PKG_NAME=unipi-kernel-modules
+ fi
+ PKG_KERNEL_HEADERS=g1-kernel-headers
+ PKG_KERNEL_IMAGE=g1-kernel-image
+ ;;
+ zulu )
+ if [ "${DEBIAN_VERSION}" == "buster" ]; then
+ BINARY_PKG_NAME=zulu-unipi-kernel-modules
+ else
+ BINARY_PKG_NAME=unipi-kernel-modules
+ fi
+ PKG_KERNEL_HEADERS=zulu-kernel-headers
+ PKG_KERNEL_IMAGE=zulu-kernel-image
+ ;;
+ iris )
+ BINARY_PKG_NAME=unipi-kernel-modules
+ PKG_KERNEL_HEADERS=zulu-kernel-headers
+ PKG_KERNEL_IMAGE=zulu-kernel-image
+ ;;
+ patron )
+ BINARY_PKG_NAME=unipi-kernel-modules
+ PKG_KERNEL_HEADERS=zulu-kernel-headers
+ PKG_KERNEL_IMAGE=zulu-kernel-image
+ ;;
+esac
+
+PKG_KERNEL_VER="$(dpkg-query -f='${Version}' -W ${PKG_KERNEL_HEADERS})"
+echo "PKG_KERNEL_VER = ${PKG_KERNEL_VER}"
+# after rpi kernel 1.20210303-1 the version is prefixed with "1:", e.g. 1:1.20210430-2
+# this breaks the combined version since it is no longer a number (1.66.1:1.20210430-2)
+# we will strip the first ":" part
+# but in dependencies, we need to keep it !!!
+PKG_KERNEL_VER_STRIPPED="$(echo ${PKG_KERNEL_VER} | cut -d":" -f 2-)"
+echo "PKG_KERNEL_VER_STRIPPED = ${PKG_KERNEL_VER_STRIPPED}"
+
+if [ "${PRODUCT}" = "neuron" ]; then
+ # in raspberrypi-kernel-headers can be more than one kernels for different SoC
+ LINUX_DIR_ARR=($(dpkg -L ${PKG_KERNEL_HEADERS} | sed -n '/^\/lib\/modules\/.*-v7.*\/build$/p'))
+ LINUX_DIR_PATH="${LINUX_DIR_ARR[*]}"
+else
+ LINUX_DIR_PATH=$(dpkg -L ${PKG_KERNEL_HEADERS} | sed -n '/^\/lib\/modules\/.*\/build$/p')
+fi
+
+#####################################################################
+### Create changelog for binary packages with modified version string
+
+cat >debian/${BINARY_PKG_NAME}.changelog <<EOF
+unipi-kernel-modules (${PROJECT_VERSION}.${PKG_KERNEL_VER_STRIPPED}) unstable; urgency=medium
+ * Compiled for ${PKG_KERNEL_IMAGE}
+ -- auto-generator <info@unipi.technology> $(date -R)
+
+EOF
+cat debian/changelog >>debian/${BINARY_PKG_NAME}.changelog
+
+#####################################################################
+### Append binary packages definition to control file
+
+if [ ${BINARY_PKG_NAME} == "unipi-kernel-modules" ]; then
+ breaks="neuron-kernel"
+ provides=""
+elif [ ${BINARY_PKG_NAME} == "neuron-kernel" ]; then
+ breaks=""
+ provides="unipi-kernel-modules(=${PROJECT_VERSION})"
+else
+ breaks="unipi-kernel-modules, neuron-kernel"
+ provides="unipi-kernel-modules(=${PROJECT_VERSION})"
+fi
+
+cat >>debian/control <<EOF
+
+Package: ${BINARY_PKG_NAME}
+Architecture: ${arch}
+Pre-Depends: unipi-common
+Depends: ${misc:Depends}, ${PKG_KERNEL_IMAGE}(=${PKG_KERNEL_VER}), unipi-firmware (>=5.50)
+Provides: ${provides}
+Replaces: ${breaks}
+Breaks: ${breaks}
+Description: UniPi kernel modules
+ Binary kernel modules for UniPi Neuron/Axon/Patron/Iris controller.
+ Compiled for ${PKG_KERNEL_IMAGE} version ${PKG_KERNEL_VER}.
+
+EOF
+
+#####################################################################
+### Create rules.in
+
+cat >debian/rules.in <<EOF
+
+%:
+ dh \$@
+
+override_dh_auto_install:
+ mkdir -p debian/${BINARY_PKG_NAME}
+ mv debian/tempdest/* debian/${BINARY_PKG_NAME} || exit 1;
+
+override_dh_auto_build:
+ for LDP in ${LINUX_DIR_PATH}; do \
+ make clean || exit 1;\
+ dh_auto_build -- LINUX_DIR_PATH=\$\${LDP} || exit 1;\
+ dh_auto_install --destdir=debian/tempdest -- LINUX_DIR_PATH=\$\${LDP} || exit 1;\
+ done
+EOF
+
+#cat debian/rules.in
+#cat debian/unipi-kernel-modules.changelog
+#cat debian/control
+++ /dev/null
-Package: unipi-kernel-modules
-Architecture: arm64 armhf
-Pre-Depends: unipi-common
-Depends: ${misc:Depends}, axon-kernel-image(=${PKG-KERNEL-VER}) | raspberrypi-kernel(=${PKG-KERNEL-VER}), unipi-firmware (>=5.50)
-Replaces: neuron-kernel
-Breaks: neuron-kernel
-Description: UniPi Neuron/Axon kernel modules
- Binary kernel modules for UniPi Neuron/Axon controller. Compiled for axon-kernel-image
- version.
-
+++ /dev/null
-Package: unipi-kernel-modules-dkms
-Architecture: all
-Pre-Depends: raspberrypi-kernel-headers | axon-kernel-headers | linux-headers(>=4.0), unipi-common
-Depends: ${misc:Depends}, dkms, unipi-firmware (>=5.50)
-Replaces: neuron-kernel, unipi-kernel-modules
-Conflicts: neuron-kernel, unipi-kernel-modules
-Description: UniPi Neuron/Axon kernel modules - DKMS source
- This package contains source code of kernel module for spi protocol
- used by internal boards in the UniPi Neuron/Axon controllers.
- Can be used with DKMS so that local kernel images are automatically
- built and installed every time relevant kernel packages are upgraded.
-
+++ /dev/null
-Package: g1-unipi-kernel-modules
-Architecture: arm64
-Pre-Depends: unipi-common
-Depends: ${misc:Depends}, g1-kernel-image(=${PKG-KERNEL-VER}), unipi-firmware (>=5.50)
-Provides: unipi-kernel-modules(=${PROJECT-VERSION})
-Replaces: unipi-kernel-modules
-Breaks: unipi-kernel-modules
-Description: UniPi G1 kernel modules
- Binary kernel modules for UniPi G1 gateway. Compiled for g1-kernel-image
- version.
-
+++ /dev/null
-Source: unipi-kernel-modules
-Section: kernel
-Priority: optional
-Maintainer: Miroslav Ondra <info@unipi.technology>
-Build-Depends: debhelper (>= 9)
-Standards-Version: 3.9.8
-Homepage: https://www.unipi.technology/
-Vcs-Git: https://git.unipi.technology/UniPi/unipi-kernel.git
-
+++ /dev/null
-Package: neuron-kernel
-Architecture: armhf
-Pre-Depends: unipi-common
-Depends: ${misc:Depends}, raspberrypi-kernel(=${PKG-KERNEL-VER}), unipi-firmware (>=5.50)
-Description: UniPi Neuron kernel modules
- Binary kernel modules for UniPi Neuron controller. Compiled with
- raspberrypi-kernel from Raspbian distribution.
-
+++ /dev/null
-Package: neuron-kernel
-Architecture: arm64
-Pre-Depends: unipi-common
-Depends: ${misc:Depends}, raspberrypi-kernel(=${PKG-KERNEL-VER}), unipi-firmware (>=5.50)
-Description: UniPi Neuron kernel modules
- Binary kernel modules for UniPi Neuron controller. Compiled with
- raspberrypi-kernel from Raspbian distribution.
-
+++ /dev/null
-Package: zulu-unipi-kernel-modules
-Architecture: arm64
-Pre-Depends: unipi-common
-Depends: ${misc:Depends}, zulu-kernel-image(=${PKG-KERNEL-VER}), unipi-firmware (>=5.50)
-Provides: unipi-kernel-modules(=${PROJECT-VERSION})
-Replaces: unipi-kernel-modules
-Breaks: unipi-kernel-modules
-Description: UniPi Zulu kernel modules
- Binary kernel modules for UniPi Patron (Zulu based) PLC. Compiled for g1-kernel-image
- version.
-
+++ /dev/null
-unipi-kernel-modules-dkms
--- /dev/null
+#!/usr/bin/make -f
+# See debhelper(7) (uncomment to enable)
+# output every command that modifies files on the build system.
+#export DH_VERBOSE = 1
+
+
+# see FEATURE AREAS in dpkg-buildflags(1)
+#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+
+# see ENVIRONMENT in dpkg-buildflags(1)
+# package maintainers to append CFLAGS
+#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
+# package maintainers to append LDFLAGS
+#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+export DEB_LDFLAGS_SET = -zrelro
+
+clean:
+ dh clean --with dkms
+ [ -x debian/control-generator.sh ] && debian/control-generator.sh
+
+
+override_dh_installmodules:
+ DH_AUTOSCRIPTDIR=debian/autoscripts dh_installmodules
+
+-include debian/rules.in
+++ /dev/null
-#!/usr/bin/make -f
-# See debhelper(7) (uncomment to enable)
-# output every command that modifies files on the build system.
-#export DH_VERBOSE = 1
-
-
-# see FEATURE AREAS in dpkg-buildflags(1)
-#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-
-# see ENVIRONMENT in dpkg-buildflags(1)
-# package maintainers to append CFLAGS
-#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
-# package maintainers to append LDFLAGS
-#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
-export DEB_LDFLAGS_SET = -zrelro
-
-MOD_VERSION=$(shell dpkg-parsechangelog |grep ^Version:|cut -d ' ' -f 2)
-
-clean:
- #cat debian/control.in debian/control.dkms >debian/control
- dh clean --with dkms
-
-%:
- dh $@ --with dkms
-
-
-override_dh_installmodules:
- DH_AUTOSCRIPTDIR=debian/autoscripts dh_installmodules
-
-override_dh_dkms:
- dh_dkms -V $(MOD_VERSION)
- make dkms DESTDIR=$(PWD)/debian/unipi-kernel-modules-dkms/usr/src/unipi-$(MOD_VERSION)
-
-override_dh_auto_build:
- @echo "skip build"
-
-override_dh_auto_install:
- @echo skip install
-
+++ /dev/null
-#!/usr/bin/make -f
-# See debhelper(7) (uncomment to enable)
-# output every command that modifies files on the build system.
-#export DH_VERBOSE = 1
-
-
-# see FEATURE AREAS in dpkg-buildflags(1)
-#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-
-# see ENVIRONMENT in dpkg-buildflags(1)
-# package maintainers to append CFLAGS
-#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
-# package maintainers to append LDFLAGS
-#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
-export DEB_LDFLAGS_SET = -zrelro
-
-DEBIAN_VERSION=$(shell . /ci-scripts/include.sh; echo $${DEBIAN_VERSION})
-PLATFORM=$(shell echo $${PLATFORM:-axon})
-
-CONTROL_INC=$(PLATFORM)
-
-ifeq ($(PLATFORM),axon)
- BINARY_PKG_NAME=unipi-kernel-modules
-else
- BINARY_PKG_NAME=$(PLATFORM)-unipi-kernel-modules
-endif
-
-
-PKG_KERNEL_VER = $(shell dpkg-query -f='$${Version}' -W $(PLATFORM)-kernel-headers)
-LINUX_DIR_PATH = $(shell dpkg -L $(PLATFORM)-kernel-headers | sed -n '/^\/lib\/modules\/.*\/build$$/p')
-KERNEL_VERSION = $(subst /lib/modules/,,$(subst /build,,$(LINUX_DIR_PATH)))
-
-PROJECT_VERSION=$(shell dpkg-parsechangelog -S Version)
-
-clean:
- cat debian/control.in debian/control.$(CONTROL_INC) >debian/control
- dh clean
-
-%:
- dh $@
-
-
-override_dh_installmodules:
- DH_AUTOSCRIPTDIR=debian/autoscripts dh_installmodules
-
-override_dh_prep:
- @dh_prep --exclude=unipi-kernel-modules.substvars
- @echo PKG-KERNEL-VER=${PKG_KERNEL_VER} > debian/unipi-kernel-modules.substvars
- @echo PKG-KERNEL-VER=${PKG_KERNEL_VER} > debian/$(PLATFORM)-unipi-kernel-modules.substvars
- @echo PROJECT-VERSION=${PROJECT_VERSION} >> debian/unipi-kernel-modules.substvars
- @echo PROJECT-VERSION=${PROJECT_VERSION} >> debian/$(PLATFORM)-unipi-kernel-modules.substvars
- ( sed 's/)/.${PKG_KERNEL_VER})/;q' debian/changelog; \
- printf "\n * Compiled for $(PLATFORM)-kernel-image\n";\
- printf "\n -- auto-generator <info@unipi.technology> %s\n\n" "`date -R`"; \
- cat debian/changelog;\
- ) >debian/unipi-kernel-modules.changelog
- @cat debian/unipi-kernel-modules.changelog > debian/$(PLATFORM)-unipi-kernel-modules.changelog
-
-
-override_dh_auto_build:
- dh_auto_build -- CCPREFIX=${DEB_TARGET_GNU_TYPE}- LINUX_DIR_PATH=$(LINUX_DIR_PATH) ARCH=${DEB_TARGET_ARCH_CPU}
-
-override_dh_auto_install:
- dh_auto_install --destdir=debian/$(BINARY_PKG_NAME) -- CCPREFIX=${DEB_TARGET_GNU_TYPE}- \
- LINUX_DIR_PATH=$(LINUX_DIR_PATH) ARCH=${DEB_TARGET_ARCH_CPU}
+++ /dev/null
-#!/usr/bin/make -f
-# See debhelper(7) (uncomment to enable)
-# output every command that modifies files on the build system.
-#export DH_VERBOSE = 1
-
-
-# see FEATURE AREAS in dpkg-buildflags(1)
-#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-
-# see ENVIRONMENT in dpkg-buildflags(1)
-# package maintainers to append CFLAGS
-#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
-# package maintainers to append LDFLAGS
-#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
-export DEB_LDFLAGS_SET = -zrelro
-
-DEBIAN_VERSION=$(shell . /ci-scripts/include.sh; echo $${DEBIAN_VERSION})
-PLATFORM=$(shell echo $${PLATFORM:-neuron})
-
-ifeq ($(DEBIAN_VERSION),stretch)
- BINARY_PKG_NAME=neuron-kernel
- CONTROL_INC=neuron
-else
- BINARY_PKG_NAME=unipi-kernel-modules
- CONTROL_INC=axon
-endif
-
-## Check possible cross compile
-## LINUX_DIR_PATH can contain more directories !!
-ifeq ($(shell dpkg-architecture -q DEB_BUILD_ARCH),armhf)
-RPI_FIRMWARE_VER = $(shell dpkg-query -f='$${Version}' -W raspberrypi-kernel-headers)
-# after rpi kernel 1.20210303-1 the version is prefixed with "1:", e.g. 1:1.20210430-2
-# this breaks the combined version since it is no longer a number (1.66.1:1.20210430-2)
-# we will strip the first ":" part
-# but in dependencies, we need to keep it !!!
-RPI_FIRMWARE_VER_STRIPPED = $(shell echo $(RPI_FIRMWARE_VER) | cut -d":" -f 2-)
-LINUX_DIR_PATH = $(shell dpkg -L raspberrypi-kernel-headers | sed -n '/^\/lib\/modules\/.*-v7.*\/build$$/p')
-KERNEL_VERSION = $(subst /lib/modules/,,$(subst /build,,$(LINUX_DIR_PATH)))
-else
-.raspbian-versions:
- misc/check-raspbian
-include ./.raspbian-versions
-LINUX_DIR_PATH = ${PWD}/tmp/linux-raspberrypi-kernel_${RPI_FIRMWARE_VER}
-
-ifneq ($(shell dpkg-architecture -q DEB_BUILD_ARCH),armhf)
-override_dh_auto_configure:
- misc/check-raspbian
- misc/current
-endif
-
-endif
-
-clean:
- cat debian/control.in debian/control.$(CONTROL_INC) >debian/control
- dh clean --with dkms
-
-%:
- dh $@
-
-override_dh_installmodules:
- DH_AUTOSCRIPTDIR=debian/autoscripts dh_installmodules
-
-override_dh_prep:
- @dh_prep --exclude=$(BINARY_PKG_NAME).substvars
- @echo PKG-KERNEL-VER=${RPI_FIRMWARE_VER} >> debian/$(BINARY_PKG_NAME).substvars
- ( sed 's/)/.$(RPI_FIRMWARE_VER_STRIPPED))/;q' debian/changelog; \
- printf "\n * Compiled for raspberrypi-kernel\n";\
- printf "\n -- auto-generator <info@unipi.technology> %s\n\n" "`date -R`"; \
- cat debian/changelog;\
- ) >debian/$(BINARY_PKG_NAME).changelog
-
-
-## LINUX_DIR_PATH can contain more directories !!
-override_dh_auto_build:
- for LDP in $(LINUX_DIR_PATH); do \
- make clean || exit 1;\
- dh_auto_build -- CCPREFIX=${DEB_TARGET_GNU_TYPE}- LINUX_DIR_PATH=$${LDP} ARCH=${DEB_TARGET_ARCH_CPU} || exit 1;\
- dh_auto_install --destdir=debian/tempdest -- CCPREFIX=${DEB_TARGET_GNU_TYPE}- \
- LINUX_DIR_PATH=$${LDP} ARCH=${DEB_TARGET_ARCH_CPU} || exit 1;\
- done
-
-override_dh_auto_install:
- mkdir -p debian/$(BINARY_PKG_NAME)
- mv debian/tempdest/* debian/$(BINARY_PKG_NAME) || exit 1;