Kernel Boot Time Optimization
NVIDIA® Tegra® Linux Driver Package (L4T) provides a generic boot kernel for development of your product. To decrease kernel boot time, you can customize the provided kernel based on the requirements of your product.
The kernel includes a default configuration that enables all supported hardware features, and searches all available devices for boot scripts. This enables out-of-the box support for the widest possible variety of controllers, features, storage devices, and boot configurations.
This flexibility comes at a cost:
•Some hardware support takes time to initialize
•Enabling all software features, mostly over Advanced Peripheral Bus (APB), takes time
•Scanning all attached storage and network devices takes time thereby delaying execution of the final operating system
In constrained or pre-configured systems, this flexibility may not be necessary; the system designer may know ahead of time which storage device contains the required files, or know that certain devices do not need to be initialized by the kernel. To reduce system boot time, you can configure the kernel to respect these constraints.
For a Jetson Tegra X1 system running L4T R24 with the default configuration, it takes 12 seconds from cold power-on to begin showing the login prompt. When the following optimization techniques are applied, that process can be reduced to approximately three seconds.
Device Tree Nodes
If you are not using any controller from Tegra SoC, disable the Device Tree nodes for those device tree entries.
PCIe
If you are not using PCIe, disable both the ports from the kernel Device Tree Blob (DTB). If you are using one port, disable the second one.
The Device Tree Source (DTS) file in the L4T package is available at:
arch/arm64/boot/dts/tegra210-jetson-cv-base-p2597-2180-a00.dts
To disable PCIe ports
•Modify the controller and each PCIe port status as shown in the following example.
pcie-controller {
nvidia,wake-gpio = <&gpio TEGRA_GPIO(A, 2) 0>;
nvidia,lane-map = <0x14>;
dvdd-pex-pll-supply = <&max77620_ldo1>;
l0-dvddio-pex-supply = <&max77620_ldo1>;
l1-dvddio-pex-supply = <&max77620_ldo1>;
l2-dvddio-pex-supply = <&max77620_ldo1>;
l3-dvddio-pex-supply = <&max77620_ldo1>;
l4-dvddio-pex-supply = <&max77620_ldo1>;
l5-dvddio-pex-supply = <&max77620_ldo1>;
l6-dvddio-pex-supply = <&max77620_ldo1>;
hvdd-pex-pll-e-supply = <&max77620_sd3>;
l0-hvddio-pex-supply = <&max77620_sd3>;
l1-hvddio-pex-supply = <&max77620_sd3>;
l2-hvddio-pex-supply = <&max77620_sd3>;
l3-hvddio-pex-supply = <&max77620_sd3>;
l4-hvddio-pex-supply = <&max77620_sd3>;
l5-hvddio-pex-supply = <&max77620_sd3>;
l6-hvddio-pex-supply = <&max77620_sd3>;
vddio-pex-ctl-supply = <&max77620_sd3>;
status = "disabled";
pci@1,0 {
status = "disabled";
};
pci@2,0 {
status = "disabled";
};
};
Pinmux
There is duplicity of pinmux and GPIO configuration in u-boot and the kernel; however you can remove this duplicity modifying the configuration. The default configurations are performed based on customer_pinmux.xlsm sheet at one place (u-boot). Extra configuration can be performed by the specific driver.
To eliminate pinmux duplicity
•Remove the following pinmux-name nodes from the device tree DTS file.
/ {
pinmux: pinmux@700008d4 {
status = "okay";
pinctrl-names = "default", "drive", "unused";
pinctrl-0 = <&pinmux_default>;
pinctrl-1 = <&drive_default>;
pinctrl-2 = <&pinmux_unused_lowpower>;
Real-time Clock
Two Real-time Clocks (RTC) are enabled by default:
•Tegra RTC
•PMCI RTC
Enable one, both, or none, based on your development needs. Be aware of the following differences:
•Tegra RTC is the fastest in response, but cannot work as a backup RTC when the system is turned off.
•PMIC RTC can work as a backup RTC, however it is slow in response because of the transfer average to I2C.
If you do not shutdown the system, of if you are not concerned about backup time, then you do not need to enable RTC. Disabling RTC can speed up boot time.
To disable the RTC
1. Remove the the following configuration from your tegra21_defconfig file.
CONFIG_TRC_DRV_MAX77620=y
2. Add the following configuration to the tegra21_defconfig file.
# CONFIG_RTC_HCTOSYS is not set
3. Set the Tegra RTC to disabled in the DTS file as follows:
rtc {
compatible = "nvidia,tegra-rtc";
reg = <0x00000000 0x00000003 0x00000002 0x0000009b>;
interrupts = <0x00000000 0x00000005 0x00000002>;
status = "disabled";
};
Environment Configuration
You can optimize boot time by modifying the environment configuration in the root file system.
Single Step Boot
If you are not using the Network File System (NFS), you can reduce the kernel boot time by approximately 3 seconds by modify the default initial ramdisk (initrd) to disable it from loading the temporary root file system.
By default, initrd is set for rootdev_type for network and external boot media. For example, SD card, USB stick.
To modify the initrd settings
1. Execute the following command to rename the original initrd file.
mv l4t_initrd.img l4t_initrd.img_orig
2. Execute the following command:
touch l4t_initrd.img
Disable Console over UART
Prints over UART are a major bottleneck in kernel boot time. To reduce this time, you can remove console=ttyS0 from the extlinux.conf configuration file.
Once the system is ready for deployment, you can remove the UART console logs or review the console logs over the Framebuffer console. The console log is console=tty1 in the extlinux.conf configuration file.
Compile-Time Configuration
To reduce compile-time configuration, examine the generated configuration file to identify which configurations are required. Once the required configurations are defined, identify which ones to boot asynchronously. For those configurations, the drivers probe is executed asynchronously in a separate thread instead of the main initial thread.
Additionally, examine the required configurations and verify that they can be programmed as modules so that the drivers are loaded when it is called for use. When the drivers are not loaded, the kernel image is reduced and more RAM space is available.
The following topics provide examples of each of these conditions.
Asynchronous Probe
The asynchronous probe feature is available, by default, in Kernel Version 3.18. For Kernel Version 3.10, you must cherry-pick the patches from the mainline available at:
To move the driver to another thread
•Add the probe_type in your driver as follows:
static struct platform_driver sdhci_tegra_driver = {
.driver = {
.name = "sdhci-tegra",
.of_match_table = sdhci_tegra_dt_match,
.pm = SDHCI_PLTFM_PMOPS,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = sdhci_tegra_probe,
.remove = sdhci_tegra_remove,
.shutdown = sdhci_tegra_shutdown,
};
File System
To decrease boot time the filesystem, modify the following configurations to set them as modules:
CONFIG_FUSE_FS=m
CONFIG_VFAT_FS=m
CONFIG_NTFS_FS=m
Sound
Audio codec requires some time to initialize, To eliminate this initialization time, disable the audio configurations as follows:
# CONFIG_SND_SOC_TEGRA_ALT is not set
# CONFIG_SND_SOC_TEGRA_T210REF_MOBILE_ALT is not set
# CONFIG_SND_SOC_TEGRA_T210REF_MOBILE_ES755_ALT is not set