Boot Time Optimization

Who?

For those who are sensitive with boot time.
This topic provides several methods of boot time optimization.

Why?

From Jetpack 5, we replace cboot with UEFI as bootloader.
UEFI is a generic open source bootloader which is convenient and easier to customize.
With default L4T reference release, boot time from cold boot to login prompt on console is around 38 seconds.
Default boot time may not achieve customer’s expectation.

How?

Optimization Setup

HW:Orin NX 16G + Orin Nano devkit(p3768)
SW:Jetpack 5.1.3(L4T R35.5.0)

Optimization Options

MB1/MB2

  1. Disable log print
    (<Linux_for_Tegra>/bootloader/tegra234-mb1-bct-misc-common.dtsi)
#ifdef DISABLE_UART_MB1_MB2
            log_level = <0>;
#else
-			log_level = <4>;
+			log_level = <0>;
#endif
  1. Modify combined uart
    (<Linux_for_Tegra>/bootloader/t186ref/tegra234-bpmp-3767-0000-a02-3509-a02.dtb)
a. decompile dtb to dts
$ dtc -I dtb -O dts -o tegra234-bpmp-3767-0000-a02-3509-a02.dts tegra234-bpmp-3767-0000-a02-3509-a02.dtb

b. modify the following lines
        serial {
-               port = <0x03>;
-               has_input;
-
-               combined-uart {
-                       enabled;
-               };
        };

c. assemble dts back to dtb
$ dtc -I dts -O dtb -o tegra234-bpmp-3767-0000-a02-3509-a02.dtb tegra234-bpmp-3767-0000-a02-3509-a02.dts

Bootloader(UEFI)

Disable Some UEFI Components

  1. network
  2. SATA
  3. boot timeout 5s → 0s

Full patch could be found in 0001-uefi-optimize-boot-time.patch (12.0 KB)

Kernel

  1. Pass “quiet” to kernel cmdline (in <Linux_for_Tegra>/p3767.conf.common)
- CMDLINE_ADD="mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb"
+ CMDLINE_ADD="mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb quiet"
  1. remove unused drivers through kernel config based on the requirement
    (kernel config: <Linux_for_Tegra>/sources/kernel/kernel-5.10/arch/arm64/configs/defconfig)

Optimization Results

			default		optimized
MB1/MB2		4s			1s
Bootloader	15s			9s
Kernel 		19s			10s
Total		38s			20s

Reference logs:
OrinNX+p3768_r35.5_default_38s.log (143.7 KB)
OrinNX+p3768_r35.5_optimized_20s.log (21.5 KB)

Notes

  1. Please enable timestamp in serial console to know the overall boot flow and get the boot time first.
  2. The example in this topic is tested on R35.5.0, but it should be available for other R35 releases.
  3. Optimizing the boot time is strongly depending on the use case and the requirement.
  4. Please know what you are doing before any modifications.