日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發(fā)布時(shí)間:2025/4/5 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 树莓派:树莓派的刷机和登录,以及更新新版vim方便使用 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一、樹莓派的刷機(jī)

我自己的

路徑是:??

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

這是我自己安裝的地方:

我們下載完以后如何讓找到他?

單擊以后就會(huì)出現(xiàn)

這個(gè)時(shí)候把讀卡器和卡插到電腦上,可千萬不要點(diǎn)擊c盤和d盤

然后我們點(diǎn)擊文件夾的位置

?然后找到這個(gè)東西

?把下載完的東西的路徑放在文件夾前面的地方

? ? ? ? ? ? ? ? ? ? ? ??

點(diǎn)擊write,然后點(diǎn)擊yes

刷機(jī)完成顯示

退出的時(shí)候,按一下exit,然后就可以拔掉

二、樹莓派的登錄

1、HDM1視頻線 連接到顯示器(有條件的可以試試)

2、串口的方式登錄樹莓派

????????2、1設(shè)備破解

? ? ? ? ? ? ? ? 默認(rèn)情況,樹莓派的串口和藍(lán)牙連接

? ? ? ? ? ? ? ? 想辦法斷開藍(lán)牙連接,把串口用來數(shù)據(jù)通信

????????????????a、觀看樹莓派的啟動(dòng)過程。字符

? ? ? ? ? ? ? ? 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
?

第一步

現(xiàn)在把內(nèi)存卡和讀卡器插到電腦上,找到“config.txt”文件

打開原文件是這樣的

?加完內(nèi)容,記得ctrl +s 保存

這樣就停止了藍(lán)牙,解除了對(duì)串口的占用

第二步:

再修改根目錄的"cmdline.txt",將里面的內(nèi)容全部替換成以下內(nèi)容,以防萬一,請(qǐng)先備份好這個(gè)文件的原內(nèi)容。

(原內(nèi)容: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)

(要替換的內(nèi)容:dwc_otg.lpm_enable=0 console=tty1 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

(把系統(tǒng)默認(rèn)藍(lán)牙交互的數(shù)據(jù)信息指定為串口0,并且波特率為115200)

記得ctrl +s 保存

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

(因?yàn)椴僮飨到y(tǒng)被我們改動(dòng)了,現(xiàn)在的樹莓派啟動(dòng)的過程,串口就有數(shù)據(jù)啦)

我們想知道串口有哪些數(shù)據(jù)?

要用到usb轉(zhuǎn)串口(只接T?和R)

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

(第四個(gè)針腳是T ,第五個(gè)針腳是R)

樹莓派的T? 和??usb轉(zhuǎn)串口的 R 相連

樹莓派的R 和? ??usb轉(zhuǎn)串口的T 相連

然后把這兩個(gè)頭都接到電腦

一個(gè)是供電的,一個(gè)是數(shù)據(jù)交互的

都連接以后,點(diǎn)擊這個(gè)東西

?會(huì)跳出這個(gè)窗口

?點(diǎn)擊那個(gè)閃電的標(biāo)志

?選擇serial (串口的意思)

記得把波特率改成115200

然后點(diǎn)擊連接試一下

結(jié)果發(fā)現(xiàn)沒有成功 :

因?yàn)閯偛艣]接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,再連接電源

這就是樹莓派的啟動(dòng)過程,把所有的啟動(dòng)的數(shù)據(jù)都打在串口上

?

讓我們輸入賬號(hào)的地方

默認(rèn)賬號(hào)是pi

然后回車輸入密碼

默認(rèn)密碼是raspberry

????????

這就成功啦?

?頁面看的的不舒服

點(diǎn)擊選項(xiàng)里面的會(huì)話選項(xiàng)

?點(diǎn)擊終端仿真,選者linux

再改一下外觀和字體

但是我們的文件 在烏棒圖的時(shí)候顏色不一樣,用串口體現(xiàn)不出來文件的不一樣

串口是一種迫于無奈的方法

因?yàn)槲覀兯⑼隀C(jī)以后,要不然通過顯示器來看,這是最土的一種方式

對(duì)開發(fā)來說,從破解的層面,一般來說都是先接一下串口看有沒有數(shù)據(jù)

(樹莓派默認(rèn)是跟藍(lán)牙連接的哦)

c、通過網(wǎng)絡(luò)登錄樹莓派

那么如何讓樹莓派入網(wǎng)呢?

? ? ? ? 修改

?

實(shí)際上我們要

?但是這個(gè)vi 很雞肋

是個(gè)老版本的

沒權(quán)限

?咱們這是一個(gè)美元符號(hào),是個(gè)普通用戶

etc下面的文件,咱們沒有權(quán)限修改它

?你要用vi 的話,前面加個(gè)sudo,才能看見里面的文檔

?

但是vi 不好用,我們換一個(gè)

nano是一個(gè)類似vi 的編輯工具

他沒有所謂的插入模式,他直接就能寫

?那么如何寫呢?

加上這個(gè)

?

加密方式可以不用寫

編輯完成以后注意每個(gè)地方都不要漏

你能動(dòng)的只有雙引號(hào)里面的,包括賬號(hào)的名稱和密碼

?寫完以后ctrl +o

問我們要不要寫進(jìn)去,按回車,就是要

退出ctrl +x

Nano是文檔編輯器,一進(jìn)入就可以編寫

ctrl +o是保存,會(huì)有提示是否保存,我們按回車,ctrl +X 退出

那我們現(xiàn)在給他重啟一下

ifconfig

wlan0 就是wifi 的意思

看到?jīng)]有ip地址說明沒連上

重啟

?我們看一下重啟以后是否自動(dòng)接到我們的熱點(diǎn)當(dāng)中

?我們用cmd(命令提示符) ping一下樹莓派的地址

反過來呢?

也能ping 通?

?

補(bǔ)充一下:固定樹莓派的ip地址

這個(gè)ip地址是自動(dòng)獲取的,可能每次啟動(dòng)的時(shí)候都不一樣

我們最好把這個(gè)ip地址固定下來

?這個(gè)是操作系統(tǒng)啟動(dòng)會(huì)調(diào)用的腳本

再腳本退出之前

?結(jié)果

?

最后不要固定 要不然ssh后面會(huì)容易連不上

d、網(wǎng)絡(luò)的方式登錄樹莓派

1、打開ssh的功能

?頁面是這樣的

選擇第五個(gè)?

?

選擇第二個(gè)

(你想要ssh的服務(wù)器可用嗎?)

?然后點(diǎn)擊ok就啟動(dòng)啦

然后方向鍵向右劃一下

然后點(diǎn)擊那個(gè)閃電的符號(hào)

然后點(diǎn)擊連接,選擇接受并保存

?默認(rèn)密碼是raspberry

左面是串口登錄

?右面是網(wǎng)絡(luò)登錄

?改動(dòng)一下外觀

文件夾都是藍(lán)色

文件是白色的?

重新打開樹莓派后ip地址會(huì)變

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

登錄樹莓派的方法:

第一種是視頻線

第二種是串口,通過串口上來以后把網(wǎng)絡(luò)配置好

第三種,等網(wǎng)絡(luò)配置好以后用ssh的方式登錄

(推薦用網(wǎng)絡(luò)的方式)

我們用nano不是很熟悉,還是喜歡用vi ,那我們就把vi 升級(jí)一下

默認(rèn)的源是國外的,apt-get安裝的時(shí)候失敗,我們更新成國內(nèi)的源

?打開終端 輸入

?sudo nano /etc/apt/sources.list

用#注釋或直接刪除原有的內(nèi)容,新增兩條:

?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

?然后點(diǎn)一下回車,這個(gè)就是國外的源了

?我們用#號(hào)注釋一下

然后把

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

這句話放在里面

我們用的是串口編輯,串口編輯有他的不好,所以我們用網(wǎng)絡(luò)編輯

更新完以后還不夠

源換完以后要更新一下

?這就是更新完畢了

?

我們現(xiàn)在試一下

?sudo的意思是暫時(shí)切換超級(jí)用戶的模式來執(zhí)行這條命令

包括程序的安裝和更新都需要超級(jí)用戶的權(quán)限

普通用戶是不能操作的

安裝完畢

我們現(xiàn)在來測(cè)試一下

?

?結(jié)果

總結(jié)

以上是生活随笔為你收集整理的树莓派:树莓派的刷机和登录,以及更新新版vim方便使用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。