team-ebi

技術系の情報共有

GPIO割込みシグナルドライバコンパイルや使い方 のソース

mkdev.sh


#!/bin/bash

SDK_DIR=$HOME/sdk1
KERNEL_DIR=$SDK_DIR/board-support/linux-4.4.12+gitAUTOINC+3639bea54a-g3639bea54a
TOOLCHAIN=$SDK_DIR/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-

make -C $KERNEL_DIR M=`pwd` ARCH=arm CROSS_COMPILE=$TOOLCHAIN  modules


Makefile


obj-m := gpiisig.o

insdev.sh


#!/bin/sh

# usage :
# ./insdev.sh ./gpiisig.ko gpii gpii devmajor=60 pin=7 sig=10

ins=$1
module=$2
device=$3
mode="664"
/sbin/insmod $ins $* || exit 1
rm -f /dev/${device}[0-1]
major=$(awk "\$2==\"$module\" {print \$1}" /proc/devices)
mknod /dev/${device}0 c $major 0
mknod /dev/${device}1 c $major 1
chmod $mode /dev/${device}[0-1]