One of my designs requires comparing the boot time of Ubuntu Core on Raspberry Pi 4. The original SD card was broken, so I had to reinstall it and keep a log.
Among them, pin 4 and 6 are for 5V power and GND, providing power to the cooling fan. The pin table below comes from https://pinout.xyz/#
Prepare an SD card, at least 8G. Log in to https://www.raspberrypi.com/software/ to download Pi Imager
Raspberry Pi Imager is the quick and easy way to install Raspberry Pi OS and other operating systems to a microSD card, ready to use with your Raspberry Pi.
https://www.raspberrypi.com/software/
I remember that the last installation also required SD Card Formatter and Win disk imaging tools to format the SD card and write the image to the SD card. This Pi Imager is much more convenient.
Installation
Select the image to be written and the SD card to write to
The SD card does not need to be formatted in advance; Pi Imager will format it directly
Download and write
After completion, remove the SD card from the computer and insert it into the Raspberry Pi to start. Before starting, you need to connect HDMI to the monitor and USB keyboard and mouse. However, if you have a serial cable, you can directly configure it through the serial output, so you don’t need an extra monitor, especially since the monitor is connected to the computer and there is no extra monitor. I connected a UART-USB serial cable (of course, depending on what is convenient; if you don’t have a serial cable, you have to connect the Raspberry Pi to the monitor). The TX/RX pins of the UART refer to the pin diagram above, pins 8 and 10.
Power on, the serial port prints output until you need to enter “enter”
Next, you will configure the Ethernet connection or Wi-Fi connection. If the Raspberry Pi is connected to the router, no modifications are needed, just proceed to enter the Ubuntu account interface.
Here, I will briefly explain why an account configuration is needed. The first SSH login to Ubuntu Core does not have a username and password; therefore, a secure way to set a username and password is required.
Ubuntu requires you to first apply for an account, then create a username within the account, and import the public key used for the first SSH login to the Raspberry Pi (device). So you need to prepare in advance. For example, I will use my Ubuntu virtual machine on my computer to log in to the Raspberry Pi for the first time and create a password. I need to create a pair of public and private keys on my Ubuntu virtual machine on my computer and then copy the public key and import it into my Ubuntu account. This way, I can SSH into the Raspberry Pi for the first time without needing a password and create a password for the Raspberry Pi.
So the configuration in the above image is to import the certificate from the Ubuntu account.
The image below shows creating a pair of public and private keys on my Ubuntu virtual machine on my computer and then copying the public key and importing it into my Ubuntu account.
Import the pub key into the personal account of Ubuntu:
Returning to the Raspberry Pi configuration, after entering the account, the next step is to complete the configuration and wait for the SSH client to connect.
At this point, you can open the terminal on your computer’s Ubuntu virtual machine, log in to the Raspberry Pi, and create a password for the Raspberry Pi for future logins.
sudo passwd <username> //create password
At this point, all installations are complete.
Use the command below to check the boot time. It took about 14 seconds.
systemd-analyze blame