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.
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
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 Options
→ B4 Boot Order
and save the settings.
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.
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.
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
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.
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