Skip to content

Commit

Permalink
add DEB build script and update instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
marqs committed Oct 9, 2024
1 parent a3c1692 commit b269972
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 6 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-\<VERSION> folder to /usr/src/
3. dkms add db9_gpio_rpi/\<VERSION>
4. dkms build db9_gpio_rpi/\<VERSION>
5. dkms mkdeb db9_gpio_rpi/\<VERSION> --source-only
1. cd db9_gpio_rpi
2. ./build_dpkg-deb.sh
1 change: 1 addition & 0 deletions db9_gpio_rpi-1.2/Makefile → db9_gpio_rpi/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
File renamed without changes.
25 changes: 25 additions & 0 deletions db9_gpio_rpi/build_dpkg-deb.sh
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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.
File renamed without changes.
File renamed without changes.

0 comments on commit b269972

Please sign in to comment.