Boot sequence
The boot selector button on ODROID-M1 can switch the boot media from SPI to eMMC or SD card, or it turns into USB download mode when bootload in eMMC or SD card is failed. By default, SPI has the most higher priority than eMMC and SD card.
Stage #1: Power cycle
This stage is to fetch the bootloader from boot medias (SPI/eMMC/SD card) and run to initiate the bare minimal peripherals and load boot scripts to boot up an operating system.
- eMMC : Removable (custom design by Hardkernel, eMMC 5.0 or higher)
- SD card : Removable (UHS-I)
- SPI : On-board (NOR flash, 16MB)
- USB : Rockchip provide a tool to flash a bootloader to booting media above when RK3568 cannot fetch and run a bootloader
Stage #2: Bootloader
The second stage is to read a bootloader (U-Boot) and run bootscripts to start large operating system. ODROID-M1 has onboard SPI flash memory and it has a dedicated partition for small operating system, by default Petitboot is flashed.
boot.ini
Unlike prior ODROID boards, the boot script boot.ini is deprecated.
boot.scr
This is a legacy script of U-Boot and this becomes a default boot script for ODROID-M1. This file is in a binary format with 64 bytes header at the beginning, the most contents in the file is to set up a bootint parameters and load operating system files, Linux kernel, ramdisk and device tree files.
config.ini
This file stores configurations to change a booting procedure or kernel parameters, it's been introduced to reduce the complexity from mixed U-Boot commands and configurations in lengthy boot.ini. Most common uses of this file is to select device tree overlay files.
Bypassing Petitboot
As shown in the boot sequence diagram, the higher priority boot media is SPI rather than eMMC or SD card. The on-board SPI flash memory contains the bootloader as well as a default boot manager OS a.k.a Petitboot which helps to boot OS in eMMC and SD as well as USB storage and M.2 NVMe. This helps one to run different operating systems installed easily.
Besides disadvantages of using Petitboot are spending more time to run Petitboot itself and delays to boot up a target operating system. In case you do not necessary to manage multiple operating systems and start an operating system in eMMC or SD card, one can make Petitboot be ignored so that the bootloader (U-Boot) starts an operating system in eMMC or SD card. Please note that this method can boot up in eMMC or SD card, not USB nor M.2 MVMe.
In order to bypass Petitboot, start Petitboot first and run a command below in the command line.
fw_setenv skip_spiboot true
In order to revert to bypassing Petitboot, run this command again in an operating system Android or Linux system.
fw_setenv skip_spiboot false
The change in the value will affect on next power cycle.
Changing boot commands or kernel parameters
One may want to add/remove/change a kernel parameter to affect the Linux kernel. Since /boot/boot.scr is a binary format with a certain header, it must not be changed by an editor.
For Linux users
There are two places to apply your changes to a boot script /boot/boot.scr.
/usr/share/flash-kernel/ubootenv.d/vendor
The contents of files in this directory are U-Boot commands and they will be included in /boot/boot.scr, kernel parameter must be added with command set env bootargs “${bootargs} YOUR-KERNEL-PARAMETER”.
/etc/default/flash-kernel
If you have something simple kernel parameter, add it to the line of LINUX_KERNEL_CMDLINE.
U-Boot environment
U-Boot environment values will be stored in a dedicated partition in SPI flash memory even though U-Boot runs in eMMC or SD card. https://wiki.odroid.com/odroid-m1/software/partition_table#spi_flash_memory