树莓派 Raspberry Pi 3B+ 使用

您所在的位置:网站首页 树莓派无法开机 树莓派 Raspberry Pi 3B+ 使用

树莓派 Raspberry Pi 3B+ 使用

2022-11-07 20:03| 来源: 网络整理| 查看: 265

Download Raspbian for Raspberry Pi

https://www.raspberrypi.org/downloads/raspbian/

烧写完成后,打开 TF 卡根目录的 config.txt 文件并在文件末端加入以下代码

max_usb_current=1 hdmi_group=2 hdmi_mode=1 hdmi_mode=87 hdmi_cvt 800 480 60 6 0 0 0 hdmi_drive=1

树莓派开机时,如果LCD USB接到树莓派,会造成HDMI无信号,建议单独电源供电,开机完成显示桌面后再接到树莓派进行触摸操作。和电源问题无关,可能是树莓派或LCD原因,暂时无解决办法。建议LCD一直单独电源供电,需要触屏时再接到树莓派,触屏完成后仍改为单独电源,不用时最好关闭。

开机后在Welcome第一个配置界面,全部不改,勾选"Use US keyboard",修改默认pi密码的界面直接"next",后面用命令行改,剩下的"skip"。最后一个界面提示重启的时候,先停下。从开始菜单打开配置界面,启用SSH,不改Locale,Timezone改为Asia/Shanghai,Wifi Country改为CN China。关闭蓝牙和Wifi,桌面图片改为temple.jpg。完成以上设置后,LCD USB单独供电,SSH登录,sudo reboot。这样可避免一次HDMI无信号的问题。开机后的SSH不安全警告和Welcome配置界面,直接关闭。经过上面的配置后,raspi-config以后不需要再使用,也不用关心TF卡存储的扩展,初次启动时已经自动扩充了。通过LCD的操作就完成了,接下来的操作通过pi/raspberry SSH登录完成。

sudo apt-get install tmux

源码编译Vim,支持Python,后面配置YCM,python-config文件夹根据具体修改,python2类似如下,python3类似如下。编译时可能会提示安装ncurses,sudo apt-get install libncurses5-dev。

./configure --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config-arm-linux-gnueabihf/ --with-features=huge ./configure --enable-python3interp=yes --with-python3-config-dir=/usr/lib/python3.5/config-3.5m-arm-linux-gnueabihf/ --with-features=huge

在/etc/profile最后添加

export HISTTIMEFORMAT="`whoami`  %F  %T  " alias rm="/usr/bin/remove.sh"

然后source /etc/profile 。删除文件用rm some-file,删除文件夹用rm some-dir/,这样可避免误删文件,不定期手动/bin/rm some-file或/bin/rm -rf some-dir/删除.trash文件夹的文件和文件夹,才真正删除。

修改/etc/dhcpcd.conf类似如下的地方,然后重启。

interface eth0 static ip_address=192.168.1.30/24 static routers=192.168.1.1 static domain_name_servers=192.168.1.1 8.8.8.8 114.114.114.114

Raspberry pi 系统中的Raspbian默认用户是pi 密码为raspberry。修改pi账号的密码可以在之前的rasp-config中修改,也可以在pi用户登录之后在命令行终端输入passwd pi。

官方的初始系统root账户默认是没有密码,但是账户是锁定的。当需要root权限时,可由pi用户登录,在命令行下执行sudo passwd root,执行此命令后系统会提示输入两遍的root密码,输入想设的密码即可,然后再执行sudo passwd --unlock root。

树莓派屏幕常亮,因为LCD休眠后屏幕仍有亮度,效果不好,直接禁止休眠。

sudo vim /etc/lightdm/lightdm.conf

找到[Seat:*]这一项,在下面的‘#xserver-command=X’删除前面的注释符#,修改为xserver-command=X -s 0 -dpms,其中,-s设置屏幕保护不启动,-dpms关闭电源节能管理。重启系统。

修改树莓派软件源,su后执行以下命令

echo "deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi" >> /etc/apt/sources.list echo "deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi" >> /etc/apt/sources.list echo "deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui" >> /etc/apt/sources.list.d/raspi.list echo "deb-src http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui" >> /etc/apt/sources.list.d/raspi.list

注释/etc/apt/sources.list和/etc/apt/sources.list.d/raspi.list的第一行。

/etc/apt/sources.list 其他镜像源

中科大 deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

清华 deb https://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

默认官方源 deb https://archive.raspbian.org/raspbian/ stretch main contrib non-free rpi

/etc/apt/sources.list.d/raspi.list其他镜像源

中科大 deb https://mirrors.ustc.edu.cn/archive.raspberrypi.org/ stretch main ui

清华 deb https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui

默认官方源 deb http://archive.raspberrypi.org/debian/ stretch main ui

raspi-config界面选择update sudo apt-get update sudo apt-get upgrade sudo apt-get autoremove sudo apt-get autoclean sudo apt update sudo apt upgrade sudo apt autoremove sudo apt autoclean sudo reboot

系统版本信息lsb_release -a

当前正在运行的CPU频率vcgencmd get_config arm_freq

实时温度cat /sys/class/thermal/thermal_zone0/temp,返回值除以1000为当前CPU温度值

树莓派默认安装了Git,如果没有安装,需要装上以方便后续安装开发所需库使用。虚拟键盘的安装参照下面的链接即可,关于开始菜单,安装完成后,开始菜单会有个虚拟键盘的菜单项,但是这个菜单项只是简单地调用程序,并不显示小键盘,如果想在任务栏显示,仍需要配置。建议用自定义sh脚本,这样菜单项和任务栏的配置都统一,任务栏文件依赖菜单项文件,菜单项文件依赖sh脚本,方便后续更改。所需要的文件只能传到pi目录,再mv到指定目录。和链接不同的一点就是,任务栏是在/etc/xdg/lxpanel/LXDE-pi/panels/panel添加,任务栏的添加需要重启。

Virtual Keyboard for the Raspberry Pi | ozzmaker.com

http://ozzmaker.com/virtual-keyboard-for-the-raspberry-pi/

然后就是让Vim支持YCM,前面支持了Python,配置YCM时需要安装cmake,直接上传.vimrc到/home/pi目录以节约时间,https://blog.csdn.net/mabing993/article/details/78445334的做法在树莓派上不能工作,猜测可能是libclang的版本(arm或ubuntu)问题。只需要执行https://blog.csdn.net/mabing993/article/details/78445334的第二步,完成后在YCM目录下sudo ./install.py --clang-completer。最后结果可能如下图,忽略即可,YCM的安装就完成了。

上传的.vimrc的.ycm_extra_conf.py的路径要改为~/.vim/bundle/YouCompleteMe/third_party/ycmd,然后根据https://blog.csdn.net/mabing993/article/details/78445334修改.ycm_extra_conf.py即可。在树莓派中,~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib是libclang.so的路径,ycm_core.so的路径仍然是.vim/bundle/YouCompleteMe/third_party/ycmd。

树莓派的基本配置就完成了,导出的history20190413.txt文件作为记录。本文章使用到的文件可在链接:https://pan.baidu.com/s/1lq0D7T2XZyYaPus7-xu8LQ 提取码:949t 下载。

1 pi 2019-04-13 13:01:51 sudo reboot 2 pi 2019-04-13 11:54:23 sudo apt-get install tmux 3 pi 2019-04-13 11:56:55 sudo apt-get install libncurses5-dev 4 pi 2019-04-13 11:57:21 ls 5 pi 2019-04-13 11:57:29 tar xjvf vim-8.1.tar.bz2 6 pi 2019-04-13 11:57:51 ls 7 pi 2019-04-13 11:57:53 cd vim81/ 8 pi 2019-04-13 11:58:03 ./configure --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config-arm-linux-gnueabihf/ --with-features=huge 9 pi 2019-04-13 11:59:22 make 10 pi 2019-04-13 12:05:54 sudo make install 14 pi 2019-04-13 12:08:13 sudo vim /etc/profile 15 pi 2019-04-13 12:08:31 source /etc/profile 16 pi 2019-04-13 12:08:34 history 17 pi 2019-04-13 12:08:56 sudo vim /etc/dhcpcd.conf 18 pi 2019-04-13 12:10:57 sudo reboot 19 pi 2019-04-13 12:11:38 passwd pi 20 pi 2019-04-13 12:13:11 sudo passwd root 21 pi 2019-04-13 12:13:29 sudo passwd --unlock root 22 pi 2019-04-13 12:13:40 sudo vim /etc/lightdm/lightdm.conf 23 pi 2019-04-13 12:15:03 sudo reboot 42 pi 2019-04-13 12:50:31 lsb_release -a 43 pi 2019-04-13 12:50:40 vcgencmd get_config arm_freq 44 pi 2019-04-13 12:50:48 cat /sys/class/thermal/thermal_zone0/temp 45 pi 2019-04-13 12:52:33 sudo apt-get install libfakekey-dev libpng-dev libxft-dev autoconf libtool -y 46 pi 2019-04-13 12:53:22 git clone https://github.com/mwilliams03/matchbox-keyboard.git 47 pi 2019-04-13 12:53:39 cd matchbox-keyboard/ 48 pi 2019-04-13 12:53:44 ./autogen.sh 49 pi 2019-04-13 12:54:23 make 50 pi 2019-04-13 12:54:51 sudo make install 51 pi 2019-04-13 12:54:55 sudo apt-get install libmatchbox1 -y 52 pi 2019-04-13 12:56:20 cd 53 pi 2019-04-13 12:56:23 ls 54 pi 2019-04-13 12:56:43 sudo mv toggle-matchbox-keyboard.sh /usr/bin/ 55 pi 2019-04-13 12:57:07 sudo chmod +x /usr/bin/toggle-matchbox-keyboard.sh 56 pi 2019-04-13 12:57:45 sudo mv toggle-matchbox-keyboard.desktop /usr/share/applications/ 57 pi 2019-04-13 12:59:01 sudo mv panel /etc/xdg/lxpanel/LXDE-pi/panels/ 61 pi 2019-04-13 12:59:30 sudo reboot 62 pi 2019-04-13 13:01:54 git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 71 pi 2019-04-13 13:30:08 cd .vim/bundle/YouCompleteMe/ 73 pi 2019-04-13 13:30:28 git submodule update --init --recursive 75 pi 2019-04-13 13:52:22 sudo apt-get install cmake 76 pi 2019-04-13 13:52:52 sudo ./install.py --clang-completer

树莓派灯的状态解释?

答:灯的状态可以不用太关心,只要能进系统就可以,一般是红灯常亮或者灭掉,都是电源正常的,出现闪烁则表示电源供电不足;绿灯只是读写数据的状态灯,不一定一直闪烁,不用纠结此灯。

树莓派开机启动项怎么设置?怎么让程序开机自动运行?

答:请进到 /etc 目录下,修改rc.local文件,添加运行的程序即可。

树莓派系统安装到SD卡上之后,内存只有几十M?

答:属于正常现象,因为linux和windows文件结构不一样,需要看大小,可以用SDFormat格式化后就会恢复到原始大小。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3