入手树莓派4B有一段时间了,之前使用SSD启动成功过,再次尝试,发现有价值的教程不太好找,记录一下操作过程
可能遇到的坑:
USB3.0接口供电不足?(确定跟电源有关,换了电源后此问题再没有出现过)
之前接入3.0接口之后,SSD硬盘出现卡顿,掉线的问题,怀疑跟供电有关,这次上了红米的3A快充,目前没出现问题。(之前使用的是购买时店家附赠的3.5A充电器,怀疑是不是质量太差)
准备:内存卡,SSD,树莓派4B,rufus
SD卡安装树莓派系统
- 使用rufus将树莓派系统写入内存卡
- 等待写入完成后,在根目录创建一个名为
ssh
的文件 - 树莓派断电,将SD卡插入树莓派,启动树莓派
- 等待载入系统,找到树莓派IP,使用ssh工具连接,默认账号
pi
密码raspberry
修改树莓派源
# 编辑 `/etc/apt/sources.list` 文件,删除原文件所有内容,用以下内容取代: deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi # 编辑 `/etc/apt/sources.list.d/raspi.list` 文件,删除原文件所有内容,用以下内容取代: deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
更新系统与固件
sudo apt update sudo apt-get upgrade -y sudo apt full-upgrade sudo rpi-update sudo reboot # 等待重启... sudo rpi-eeprom-update -d -a #BOOTLOADER: up to date #CURRENT: Thu 29 Apr 16:11:25 UTC 2021 (1619712685) # LATEST: Thu 29 Apr 16:11:25 UTC 2021 (1619712685) #RELEASE: default (/lib/firmware/raspberrypi/bootloader/default) # Use raspi-config to change the release. #VL805_FW: Dedicated VL805 EEPROM # VL805: up to date #CURRENT: 000138a1 # LATEST: 000138a1 # 查看版本 sudo vcgencmd bootloader_version #Apr 29 2021 17:11:25 #version c2f8c388c4ee37ad709ace403467d163e8dd91ce (release) #timestamp 1619712685 #update-time 1624022291 #capabilities 0x0000001f
将Ubuntu系统写入SSD
- 使用rufus将Ubuntu写入SSD
- 等待写入完成
替换镜像文件
下载https://github.com/raspberrypi/firmware/archive/refs/heads/master.zip
解压缩,进入boot文件夹,将
*.dat
和*.elf
文件复制到SSD根目录
将SSD插入树莓派
树莓派USB3.0启动
挂载SSD
fdisk -l
# 找到你的SSD盘符
# ...
#Device Boot Start End Sectors Size Id Type
#/dev/sda1 * 2048 526335 524288 256M c W95 FAT32 (LBA)
#/dev/sda2 526336 6366175 5839840 2.8G 83 Linux
sudo mkdir /mnt/boot /mnt/writable
sudo mount /dev/sda1 /mnt/boot
sudo mount /dev/sda2 /mnt/writable
使用Ubuntu-Server-raspi4-unofficial一键脚本
# 国内使用jsdelivr加速下载
wget https://cdn.jsdelivr.net/gh/TheRemote/Ubuntu-Server-raspi4-unofficial@master/BootFix.sh
sudo chmod +x BootFix.sh
sudo apt install git -y
sudo bash BootFix.sh
#Found writable partition at /mnt/writable
#Found boot partition at /mnt/boot
#Decompressing kernel from vmlinuz to vmlinux...
#Kernel decompressed
#Updating config.txt with correct parameters...
#Creating script to automatically decompress kernel...
#Creating apt script to automatically decompress kernel...
#Updating Ubuntu partition was successful! Shut down your Pi, remove the SD card then #reconnect the power.
优化SSD
sudo dmesg|less
/idVendor
# 搜索idVendor
# 按n可以搜索下一个
# usb 2-1 表示上面的usb3.0接口 2-2表示下面的usb3.0接口,你用的哪个就记录哪个id
#[ 999.187291] usb 2-1: New USB device found, idVendor=152d, idProduct=9561, bcdDevice=12.#01
#[ 999.187311] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
#[ 999.187330] usb 2-1: Product: SSK Storage
#[ 999.187347] usb 2-1: Manufacturer: SSK
#[ 999.187364] usb 2-1: SerialNumber: 0000007788DE
# 复制 idVendor=152d, idProduct=9561
sudo nano /mnt/boot/cmdline.txt
# 在文件头位置添加 usb-storage.quirks=152d:9561:u
# 添加后文件大致如下
# usb-storage.quirks=152d:9561:u net.ifnames=0 dwc_otg.lpm_enable=0 consol...
卸载SSD
sudo umount /mnt/boot
sudo umount /mnt/writable
sudo rmdir /mnt/boot /mnt/writable
设置USB启动
sudo raspi-config
Advanced Options > Boot Order > 选中USB Boot > 回车
树莓派断电,拔出SD卡,插电
Ubuntu默认账号密码
账号:ubuntu
密码:ubuntu
参考链接:
https://blog.csdn.net/figerdeng/article/details/116562433
https://blog.csdn.net/Nick12138_2017/article/details/112424516