树莓派3代B型开发板资料地址: http://www.yahboom.com/study/raspberry密码:cf0p
ssh连接 pi raspberry
触摸屏配置
//使用7寸触摸在/boot/config.text 追加
dtparam=audio=on
max_usb_current=1
hdmi_force_hotplug=1 强制树莓派使用HDMI端口
config_hdmi_boost=3 范围从1(用于短电缆)到7(用于长电缆)
hdmi_group=2
hdmi_mode=87
hdmi_cvt 1024 600 60 6 0 0 0
设置时区
sudo dpkg-reconfigure tzdata
更换数据源
树莓派官方有提供的镜像列表:http://www.raspbian.org/RaspbianMirrors
更改 /etc/apt/sources.list 中的源地址
安装VNC远程桌面
http://www.tightvnc.com/download.php
1 | apt-get install tightvncserver |
安装vim 编辑器
1 | apt-get update |
Vim有一个带图形界面的版本,可以分别安装。这个版本打开一个支持鼠标操作的新窗口
1 | apt-get install vim-gnome |
//设置WIFI /etc/wpa_/wpa_
添加
1 | country=CN |
/etc/network/interfaces
开机启动
/etc/rc.local
scim 启动输入法
支持库安装
一 安装Wiring http://www.waveshare.net/study/article-742-1.html
通过GIT获得wiringPi的源码
1
2
31 git clone git://git.drogon.net/wiringPi
2 cd wiringPi
3 ./build-
1
2
31tar -zxvf wiringPi-xxx.tar.gz
2cd wiringPi
3./build
二 安装BCM2583
从bcm22835官网下载最新版本的库,然后解压安装。
1 | tar -zxvf bcm2835-1.xx.tar.gz |
三、python
1、安装RPi.GPIO
(1)先安装python-dev,输入以下指令。
sudo apt-get install python-dev
(2)安装RPi.GPIO和spidev,先下载安装包(RPi.GPIO安装包和spidev安装包,
参见:https://pypi.python.org/pypi/RPi.GPIOhttps://pypi.python.org/pypi/spidev ),
然后通过samba等方式把下载好的文件解压到树莓派上。
四 串口SPI 等等
https://www.cnblogs.com/lulipro/p/5992172.html
Python 支持库 /root/
wpi BCM /
内核模块编译
参考
启动系统后,输入命令uname -a,可以得到输出:
Linux raspberrypi 4.4.34-v7+ #930 SMP Wed Nov 23 15:20:41 GMT 2016 armv7l GNU/Linux
可以知道linux版本是4.4.34-v7+。
编译内核模块需要kernel-headers。输入命令sudo apt-cache search kernel-headers,搜索合适的kernel-headers。结果如下:
raspberrypi-kernel-headers - Header files for the Raspberry Pi Linux kernel
输入命令 sudo apt-get install raspberrypi-kernel-headers,下载安装树莓派kernel-headers。
安装成功后可以在/usr/src目录下生成两个文件夹linux-headers-4.4.34+ 和 linux-headers-4.4.34-v7+,
我们需要使用 linux-headers-4.4.34-v7+。
做make menuconfig时没有看到上面的画面,而是看到一堆英文,则一般是没有安装libncurses5-dev开发库,
使用apt-get install libncurses5-dev来安装就行了
下面是编写模块源码,如下:
1 | #include <linux/init.h> |
接着编写Makefile,内容如下:
1 | KERNEL_DIR:=/usr/src/linux-headers-4.4.34-v7+ |
输入make命令编译后,生成内核模块文件hello.ko。
输入sudo insmod hello.ko安装模块。
输入sudo rmmod hello卸载模块。
尝试安装和卸载,输入dmesg命令可以在末尾看到:
[ 5137.447586] Hi,raspi linux kernel,i am a hello world module.
[ 5157.380482] Goodbye, raspi linux kernel.
证明模块安装和卸载成功。