树莓派:树莓派的刷机和登录,以及更新新版vim方便使用

一、树莓派的刷机

我自己的

路径是:  

C:\Users\22330\Documents\Tencent Files\2233093274\FileRecv

这是我自己安装的地方:

我们下载完以后如何让找到他?

单击以后就会出现

这个时候把读卡器和卡插到电脑上,可千万不要点击c盘和d盘

然后我们点击文件夹的位置

 然后找到这个东西

 把下载完的东西的路径放在文件夹前面的地方

                        

点击write,然后点击yes

刷机完成显示

退出的时候,按一下exit,然后就可以拔掉

二、树莓派的登录

1、HDM1视频线 连接到显示器(有条件的可以试试)

2、串口的方式登录树莓派

        2、1设备破解

                默认情况,树莓派的串口和蓝牙连接

                想办法断开蓝牙连接,把串口用来数据通信

                a、观看树莓派的启动过程。字符

                b、串口登录树莓派

        

 dtoverlay=pi3-miniuart-bt

dwc_otg.lpm_enable=0 console=tty1 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
 

第一步

现在把内存卡和读卡器插到电脑上,找到“config.txt”文件

打开原文件是这样的

 加完内容,记得ctrl +s 保存

这样就停止了蓝牙,解除了对串口的占用

第二步:

再修改根目录的"cmdline.txt",将里面的内容全部替换成以下内容,以防万一,请先备份好这个文件的原内容。

(原内容:dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=cd48578f-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh splash plymouth.ignore-serial-consoles)

(要替换的内容:dwc_otg.lpm_enable=0 console=tty1 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

(把系统默认蓝牙交互的数据信息指定为串口0,并且波特率为115200)

记得ctrl +s 保存

然后就可以把卡拿出来,插到树莓派上面,

(因为操作系统被我们改动了,现在的树莓派启动的过程,串口就有数据啦)

我们想知道串口有哪些数据?

要用到usb转串口(只接T 和R)

那么树莓派的T 和R在哪里呢?

(第四个针脚是T ,第五个针脚是R)

树莓派的T  和  usb转串口的 R 相连

树莓派的R 和    usb转串口的T 相连

然后把这两个头都接到电脑

一个是供电的,一个是数据交互的

都连接以后,点击这个东西

 会跳出这个窗口

 点击那个闪电的标志

 选择serial (串口的意思)

记得把波特率改成115200

然后点击连接试一下

结果发现没有成功 :

因为刚才没接GND

config.txt源码

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on
 dtoverlay=pi3-miniuart-bt

改成:

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d
dtoverlay=pi3-disable-bt
start_x=1
gpu_mem=128

cmdline.txt也得改一下

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

然后先连接usb,再连接电源

这就是树莓派的启动过程,把所有的启动的数据都打在串口上

 

让我们输入账号的地方

默认账号是pi

然后回车输入密码

默认密码是raspberry

        

这就成功啦 

 页面看的的不舒服

点击选项里面的会话选项

 点击终端仿真,选者linux

再改一下外观和字体

但是我们的文件 在乌棒图的时候颜色不一样,用串口体现不出来文件的不一样

串口是一种迫于无奈的方法

因为我们刷完机以后,要不然通过显示器来看,这是最土的一种方式

对开发来说,从破解的层面,一般来说都是先接一下串口看有没有数据

(树莓派默认是跟蓝牙连接的哦)

c、通过网络登录树莓派

那么如何让树莓派入网呢?

        修改

 

实际上我们要

 但是这个vi 很鸡肋

是个老版本的

没权限

 咱们这是一个美元符号,是个普通用户

etc下面的文件,咱们没有权限修改它

 你要用vi 的话,前面加个sudo,才能看见里面的文档

 

但是vi 不好用,我们换一个

nano是一个类似vi 的编辑工具

他没有所谓的插入模式,他直接就能写

 那么如何写呢?

加上这个

 

加密方式可以不用写

编辑完成以后注意每个地方都不要漏

你能动的只有双引号里面的,包括账号的名称和密码

 写完以后ctrl +o

问我们要不要写进去,按回车,就是要

退出ctrl +x

Nano是文档编辑器,一进入就可以编写

ctrl +o是保存,会有提示是否保存,我们按回车,ctrl +X 退出

那我们现在给他重启一下

ifconfig

wlan0 就是wifi 的意思

看到没有ip地址说明没连上

重启

 我们看一下重启以后是否自动接到我们的热点当中

 我们用cmd(命令提示符) ping一下树莓派的地址

反过来呢?

也能ping 通 

 

补充一下:固定树莓派的ip地址

这个ip地址是自动获取的,可能每次启动的时候都不一样

我们最好把这个ip地址固定下来

 这个是操作系统启动会调用的脚本

再脚本退出之前

 结果

 

最后不要固定 要不然ssh后面会容易连不上

d、网络的方式登录树莓派

1、打开ssh的功能

 页面是这样的

选择第五个 

 

选择第二个

(你想要ssh的服务器可用吗?)

 然后点击ok就启动啦

然后方向键向右划一下

然后点击那个闪电的符号

然后点击连接,选择接受并保存

 默认密码是raspberry

左面是串口登录

 右面是网络登录

 改动一下外观

文件夹都是蓝色

文件是白色的 

重新打开树莓派后ip地址会变

三、更新新版的vim方便编程使用

登录树莓派的方法:

第一种是视频线

第二种是串口,通过串口上来以后把网络配置好

第三种,等网络配置好以后用ssh的方式登录

(推荐用网络的方式)

我们用nano不是很熟悉,还是喜欢用vi ,那我们就把vi 升级一下

默认的源是国外的,apt-get安装的时候失败,我们更新成国内的源

 打开终端 输入

 sudo nano /etc/apt/sources.list

用#注释或直接删除原有的内容,新增两条:

 deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
#deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

 然后点一下回车,这个就是国外的源了

 我们用#号注释一下

然后把

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

这句话放在里面

我们用的是串口编辑,串口编辑有他的不好,所以我们用网络编辑

更新完以后还不够

源换完以后要更新一下

 这就是更新完毕了

 

我们现在试一下

 sudo的意思是暂时切换超级用户的模式来执行这条命令

包括程序的安装和更新都需要超级用户的权限

普通用户是不能操作的

安装完毕

我们现在来测试一下

 

 结果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值