USB boot on Raspberry Pi 4 Model B

The Raspberry Pi 4 has a microSD card slot, and it seems that the official usage is to insert a microSD card with Linux installed in it. Although microSD has advantages such as low cost and low power consumption,

There are also drawbacks such as, and it is undeniable that I feel dissatisfied with using it as a server.

However, for a while, EEPROM that can be booted from USB mass storage was released as a beta version for Raspberry Pi 4 Model B The last released version has recently been upgraded to official version. This anxiety can be resolved if it can be operated with a USB-connected SSD or HDD using this. The hurdles have been lowered both in terms of work and psychology, so I decided to actually try it.

What to prepare

EEPROM update

Update the EEPROM from the Raspberry Pi OS.

Download the image from https://www.raspberrypi.org/downloads/raspberry-pi-os/. Probably anything is fine, but I only update the EEPROM, so I recommend the Raspberry Pi OS (32-bit) Lite, which has the least capacity (it seems easier to update using the recovery image of the EEPROM, but it has not been confirmed yet. .). After downloading the image, install it on the microSD with Raspberry Pi Imager (hereinafter rpi-imager. You can download it from the Official Download Page), and start Raspberry Pi with this. ..

Before the official release, the EEPROM that supports USB mass storage boot seems to have had to be downloaded from the beta version on the GitHub page, but now it is automatically updated by updating with the package manager apt. The procedure is as follows.

$ sudo apt update
# rpi-The eeprom package contains EEPROM, so it will be updated here
$ sudo apt full-upgrade
$ sudo reboot

#EEPROM is 2020 after reboot-09-Confirm that it was updated to 03
$ vcgencmd bootloader_version
Sep  3 2020 13:11:43
version c305ZZ1a6d7e532693cc7ff57fddfc8649def167 (release)
timestamp 1599135103

Change boot device settings

From the EEPROM of 2020-09-03, USB mass storage seems to be the highest priority as a boot device, but before that, the default is microSD, so check and change this setting.

$ sudo raspi-config

Select B1 USB Boot from 3 Boot OptionsB4 Boot Order and save the settings.

Installing Linux on USB mass storage

We have confirmed the operation on Raspberry Pi OS (64bit) and Ubuntu 20.04.1 LTS (64bit). The procedure is slightly different for each, so I will describe them individually.

Raspberry Pi OS installation

When using rpi-imager

Connect the USB mass storage to your PC and install Raspberry Pi OS with rpi-imager. Only the 32-bit version can be selected from the menu, so download the 64-bit version image in advance from the following location and use it.

Once installed, connect the USB mass storage to your Raspberry Pi 4 and you're ready to go.

When not using rpi-imager

The above image is just a dump of storage, so you can replace it with the dd command without using rpi-imager. However, if there is a command input error, ** the data on the PC may be erased **, so only those who understand the execution contents of each command.

# /dev/Change sdb part as appropriate
$ unzip -p 2020-08-20-raspios-buster-arm64.zip | sudo dd of=/dev/sdb bs=128M
0+57209 Record input
0+57209 Record output
3779067904 bytes (3.8 GB, 3.5 GiB) copied, 35.0279 s, 108 MB/s

Rewrite the bootloader settings and fstab.

#Check the PARTUUID of each partition
$ blkid /dev/sdb*
/dev/sdb1: LABEL_FATBOOT="boot" LABEL="boot" UUID="54E3-79CE" TYPE="vfat" PARTUUID="ad09722e-01"
/dev/sdb2: LABEL="rootfs" UUID="c6dd3b94-a789-4d57-9080-1472f721804b" TYPE="ext4" PARTUUID="ad09722e-02"

$ mkdir boot root
$ sudo mount /dev/sdb1 boot
$ sudo mount /dev/sdb2 root

# root=PARTUUID=Set the value of to PARTUUID of rootfs
$ cat boot/cmdline.txt
console=serial0,115200 console=tty1 root=PARTUUID=ad09722e-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh splash plymouth.ignore-serial-consoles

# PARTUUID=The value of boot,Set to PARTUUID of rootfs
$ cat root/etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=ad09722e-01  /boot           vfat    defaults          0       2
PARTUUID=ad09722e-02  /               ext4    defaults,noatime  0       1

#Clean up after work
$ sudo umount boot root
$ rmdir boot root

Partition extension

Regardless of whether you use rpi-imager or not, the partition immediately after installation is as follows.

$ sudo gdisk -l /dev/sdb
:
Number  Start (sector)    End (sector)  Size       Code  Name
   1            8192          532479   256.0 MiB   0700  Microsoft basic data
   2          532480         7380991   3.3 GiB     8300  Linux filesystem

Since the usage rate of root is 88%, it is a cramped state, so extend the partition with the parted command.

Ubuntu 20.04.1 LTS installation

Creating an image with rpi-imager is similar to Raspberry Pi OS. The location of the image is below.

The method without using rpi-imager and the need to change the partition are the same as when installing Raspberry Pi OS.

In addition, adjust around the kernel referring to the following information.

$ mkdir boot
$ zcat boot/vmlinuz | sudo dd of=boot/vmlinux

$ cat boot/config.txt
 :
[pi4]
max_framebuffers=2
dtoverlay=vc4-fkms-v3d
boot_delay
kernel=vmlinux
initramfs initrd.img followkernel
 :

$ sudo umount boot
$ rmdir boot

Now you can start it. However, when updating boot / vmlinux, it is necessary to follow vmlinuz as well, so it is a good idea to register a script like ʻauto_decompress_kernel` as in the forum mentioned above.

Recommended Posts

USB boot on Raspberry Pi 4 Model B
USB boot with Raspberry Pi 4 Model B (3) LVM edition
raspberry pi 1 model b, python
raspberry pi 1 model b, node-red part 17
Build OpenCV-Python environment on Raspberry Pi B +
pigpio on Raspberry pi
Cython on Raspberry Pi
Why detectMultiScale () is slow on Raspberry Pi B +
Introduced Ceph on Kubernetes on Raspberry Pi 4B (ARM64)
Raspberry Pi 4B initial setting
Run LEDmatrix interactively with Raspberry Pi 3B + on Slackbot
I tried running Flask on Raspberry Pi 3 Model B + using Nginx and uWSGI
Power on/off the USB port on the RaspberryPi 4 Model B
Control power on / off of USB port of Raspberry Pi
Introduced pyenv on Raspberry Pi
Use NeoPixel on Raspberry Pi
Install OpenCV4 on Raspberry Pi 3
Install TensorFlow 1.15.0 on Raspberry Pi
[Note] Installing vmware ESXi on Arm Fling on Raspberry Pi 4B
getrpimodel: Recognize Raspberry Pi model (A, B, B +, B2, B3, etc) with python
Port FreeRTOS to Raspberry Pi 4B
Testing uart communication on Raspberry Pi
USB over ethernet using Raspberry pi
MQTT on Raspberry Pi and Mac
raspberry pi 4 centos7 install on docker
Install ghoto2 on Raspberry Pi (memo)
Try using ArUco on Raspberry Pi
OpenCV installation procedure on Raspberry Pi
Power on / off Raspberry pi on Arduino
Detect switch status on Raspberry Pi 3
Install OpenMedia Vault 5 on Raspberry Pi 4
L Chika on Raspberry Pi C #
Build wxPython on Ubuntu 20.04 on raspberry pi 4
Connect two USB cameras to Raspberry Pi 4
"Honwaka Notification Lamp" on Raspberry Pi Part 2
Detect "brightness" using python on Raspberry Pi 3!
"Honwaka Notification Lamp" on Raspberry Pi Part 1
Enable UART + serial communication on Raspberry Pi
Adafruit Python BluefruitLE works on Raspberry Pi.
Accelerate Deep Learning on Raspberry Pi 4 CPU
Set swap space on Ubuntu on Raspberry Pi
Programming normally with Node-RED programming on Raspberry Pi 3
Use the Grove sensor on the Raspberry Pi
Install 64-bit OS (bate) on Raspberry Pi
Install docker-compose on 64-bit Raspberry Pi OS
Run servomotor on Raspberry Pi 3 using python
"Honwaka Notification Lamp" on Raspberry Pi Part 3
Working with sensors on Mathematica on Raspberry Pi
Infer Custom Vision model with Raspberry Pi
Detect temperature using python on Raspberry Pi 3!
Mount Windows shared folder on Raspberry Pi
Matrix multiplication on Raspberry Pi GPU (Part 2)
How to install NumPy on Raspberry Pi
I installed OpenCV-Python on my Raspberry Pi
Working with GPS on Raspberry Pi 3 Python
Detect slide switches using python on Raspberry Pi 3!
Build a Django environment on Raspberry Pi (MySQL)
Try using a QR code on a Raspberry Pi
Detect magnet switches using python on Raspberry Pi 3!
Raspberry Pi backup
Enjoy electronic work with GPIO on Raspberry Pi