From b269972008d3b134ebdd3e08af9bb8a1e51bd984 Mon Sep 17 00:00:00 2001 From: marqs Date: Wed, 9 Oct 2024 23:26:29 +0300 Subject: [PATCH] add DEB build script and update instructions --- README.md | 7 ++---- {db9_gpio_rpi-1.2 => db9_gpio_rpi}/Makefile | 1 + {db9_gpio_rpi-1.2 => db9_gpio_rpi}/README | 0 db9_gpio_rpi/build_dpkg-deb.sh | 25 +++++++++++++++++++ .../db9_gpio_rpi-dkms-mkdeb/Makefile | 0 .../debian/README.Debian | 0 .../db9_gpio_rpi-dkms-mkdeb/debian/changelog | 0 .../db9_gpio_rpi-dkms-mkdeb/debian/compat | 0 .../db9_gpio_rpi-dkms-mkdeb/debian/control | 2 +- .../db9_gpio_rpi-dkms-mkdeb/debian/dirs | 0 .../db9_gpio_rpi-dkms-mkdeb/debian/postinst | 0 .../db9_gpio_rpi-dkms-mkdeb/debian/prerm | 0 .../db9_gpio_rpi-dkms-mkdeb/debian/rules | 0 .../db9_gpio_rpi.c | 0 {db9_gpio_rpi-1.2 => db9_gpio_rpi}/dkms.conf | 0 15 files changed, 29 insertions(+), 6 deletions(-) rename {db9_gpio_rpi-1.2 => db9_gpio_rpi}/Makefile (75%) rename {db9_gpio_rpi-1.2 => db9_gpio_rpi}/README (100%) create mode 100755 db9_gpio_rpi/build_dpkg-deb.sh rename {db9_gpio_rpi-1.2 => db9_gpio_rpi}/db9_gpio_rpi-dkms-mkdeb/Makefile (100%) rename {db9_gpio_rpi-1.2 => db9_gpio_rpi}/db9_gpio_rpi-dkms-mkdeb/debian/README.Debian (100%) rename {db9_gpio_rpi-1.2 => db9_gpio_rpi}/db9_gpio_rpi-dkms-mkdeb/debian/changelog (100%) rename {db9_gpio_rpi-1.2 => db9_gpio_rpi}/db9_gpio_rpi-dkms-mkdeb/debian/compat (100%) rename {db9_gpio_rpi-1.2 => db9_gpio_rpi}/db9_gpio_rpi-dkms-mkdeb/debian/control (87%) rename {db9_gpio_rpi-1.2 => db9_gpio_rpi}/db9_gpio_rpi-dkms-mkdeb/debian/dirs (100%) rename {db9_gpio_rpi-1.2 => db9_gpio_rpi}/db9_gpio_rpi-dkms-mkdeb/debian/postinst (100%) rename {db9_gpio_rpi-1.2 => db9_gpio_rpi}/db9_gpio_rpi-dkms-mkdeb/debian/prerm (100%) rename {db9_gpio_rpi-1.2 => db9_gpio_rpi}/db9_gpio_rpi-dkms-mkdeb/debian/rules (100%) rename {db9_gpio_rpi-1.2 => db9_gpio_rpi}/db9_gpio_rpi.c (100%) rename {db9_gpio_rpi-1.2 => db9_gpio_rpi}/dkms.conf (100%) diff --git a/README.md b/README.md index bfdbb85..bc3bd15 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,5 @@ db9_gpio_rpi is a driver (Linux kernel module) for DB9 joysticks and gamepads co Building dkms package on RPi --------------------------------------------------- -1. Install kernel headers -2. Copy db9_gpio_rpi-\ folder to /usr/src/ -3. dkms add db9_gpio_rpi/\ -4. dkms build db9_gpio_rpi/\ -5. dkms mkdeb db9_gpio_rpi/\ --source-only +1. cd db9_gpio_rpi +2. ./build_dpkg-deb.sh \ No newline at end of file diff --git a/db9_gpio_rpi-1.2/Makefile b/db9_gpio_rpi/Makefile similarity index 75% rename from db9_gpio_rpi-1.2/Makefile rename to db9_gpio_rpi/Makefile index 20b0d3d..4d2a091 100644 --- a/db9_gpio_rpi-1.2/Makefile +++ b/db9_gpio_rpi/Makefile @@ -1,5 +1,6 @@ obj-m := db9_gpio_rpi.o KVERSION := `uname -r` +CFLAGS_gamecon_gpio_rpi.o := -O3 -Wno-implicit-fallthrough all: $(MAKE) -C /lib/modules/$(KVERSION)/build M=$(PWD) modules diff --git a/db9_gpio_rpi-1.2/README b/db9_gpio_rpi/README similarity index 100% rename from db9_gpio_rpi-1.2/README rename to db9_gpio_rpi/README diff --git a/db9_gpio_rpi/build_dpkg-deb.sh b/db9_gpio_rpi/build_dpkg-deb.sh new file mode 100755 index 0000000..0784243 --- /dev/null +++ b/db9_gpio_rpi/build_dpkg-deb.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +source dkms.conf + +DEB_NAME=$(echo $PACKAGE_NAME | sed 's,_,-,g') + +MKDEB_DIR=${PACKAGE_NAME}-dkms-mkdeb +BUILD_DIR=${DEB_NAME}-dkms_${PACKAGE_VERSION}_all + +mkdir -p $BUILD_DIR/DEBIAN +sed -e "s/DEBIAN_PACKAGE/${DEB_NAME}/g" -e '/^$/d' $MKDEB_DIR/debian/control > $BUILD_DIR/DEBIAN/control +echo "Version: ${PACKAGE_VERSION}" >> $BUILD_DIR/DEBIAN/control +sed -e "s/DEBIAN_PACKAGE/${PACKAGE_NAME}/g" -e "s/MODULE_VERSION/${PACKAGE_VERSION}/g" -e "s/DATE_STAMP/$(date)/g" $MKDEB_DIR/debian/changelog > $BUILD_DIR/DEBIAN/changelog +sed -e "s/NAME=MODULE_NAME/NAME=${PACKAGE_NAME}/g" $MKDEB_DIR/debian/postinst > $BUILD_DIR/DEBIAN/postinst +sed -e "s/NAME=MODULE_NAME/NAME=${PACKAGE_NAME}/g" -e "s/VERSION=MODULE_VERSION/VERSION=${PACKAGE_VERSION}/g" $MKDEB_DIR/debian/prerm > $BUILD_DIR/DEBIAN/prerm +chmod 775 $BUILD_DIR/DEBIAN/postinst $BUILD_DIR/DEBIAN/prerm + +mkdir -p $BUILD_DIR/usr/share/doc/$PACKAGE_NAME +cp README $BUILD_DIR/usr/share/doc/$PACKAGE_NAME +gzip $BUILD_DIR/usr/share/doc/$PACKAGE_NAME/README + +mkdir -p $BUILD_DIR/usr/src/${PACKAGE_NAME}-${PACKAGE_VERSION} +cp -t $BUILD_DIR/usr/src/${PACKAGE_NAME}-${PACKAGE_VERSION} dkms.conf ${PACKAGE_NAME}.c Makefile + +dpkg-deb --build $BUILD_DIR \ No newline at end of file diff --git a/db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/Makefile b/db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/Makefile similarity index 100% rename from db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/Makefile rename to db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/Makefile diff --git a/db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/README.Debian b/db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/README.Debian similarity index 100% rename from db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/README.Debian rename to db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/README.Debian diff --git a/db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/changelog b/db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/changelog similarity index 100% rename from db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/changelog rename to db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/changelog diff --git a/db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/compat b/db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/compat similarity index 100% rename from db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/compat rename to db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/compat diff --git a/db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/control b/db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/control similarity index 87% rename from db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/control rename to db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/control index ebf6abd..0235ca5 100644 --- a/db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/control +++ b/db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/control @@ -7,5 +7,5 @@ Standards-Version: 3.8.1 Package: DEBIAN_PACKAGE-dkms Architecture: all -Depends: dkms (>= 1.95), ${misc:Depends} +Depends: dkms (>= 1.95) Description: DEBIAN_PACKAGE driver in DKMS format. diff --git a/db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/dirs b/db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/dirs similarity index 100% rename from db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/dirs rename to db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/dirs diff --git a/db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/postinst b/db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/postinst similarity index 100% rename from db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/postinst rename to db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/postinst diff --git a/db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/prerm b/db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/prerm similarity index 100% rename from db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/prerm rename to db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/prerm diff --git a/db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/rules b/db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/rules similarity index 100% rename from db9_gpio_rpi-1.2/db9_gpio_rpi-dkms-mkdeb/debian/rules rename to db9_gpio_rpi/db9_gpio_rpi-dkms-mkdeb/debian/rules diff --git a/db9_gpio_rpi-1.2/db9_gpio_rpi.c b/db9_gpio_rpi/db9_gpio_rpi.c similarity index 100% rename from db9_gpio_rpi-1.2/db9_gpio_rpi.c rename to db9_gpio_rpi/db9_gpio_rpi.c diff --git a/db9_gpio_rpi-1.2/dkms.conf b/db9_gpio_rpi/dkms.conf similarity index 100% rename from db9_gpio_rpi-1.2/dkms.conf rename to db9_gpio_rpi/dkms.conf