Boot time optimisation in Jetson TX2 NX

Hi All,

I want to reduce the boot time of Jetson TX2 NX .Currently I am getting it as around 20sec. I have referred the below document to reduce the boot time

https://docs.nvidia.com/jetson/archives/r34.1/DeveloperGuide/text/SD/Kernel/BootTimeOptimzation.html?highlight=reduce%20system%20boot%20time

First method I tried to reduce the boot time is disable the console printing over UART as mentioned in the above link.I tried removing the “console=ttyS0,115200n8” in the line
CMDLINE_ADD=“console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 isolcpus=1-2”; in the files p3636.conf.common and flash.sh. But after flashing I am able to see the logs over uart.I tried removing the CONFIG_FRAMEBUFFER_CONSOLE in the tegradef_config file .But still logs are coming over UART. How can we disable the console printing ?

Similarly loading of bootloader is taking around 7sec .Can we reduce this time?Can we reduce the auto boot time(2sec)?
Is there any other methods to reduce the boot time?

Kindly support me .
Thanks in advance

Please share your current boot time profile. The whole “bootloader” actually has lots of boot components.

For example, uboot and cboot are two different components that form “bootloader”.

Hi @WayneWWW ,

Please see the attachment for the boot log.

Result of systemd-analyze is as follows.
boot.log (18.7 KB)

Startup finished in 3.179s (kernel) + 8.407s (userspace) = 11.587s
graphical.target reached after 8.377s in userspace

Hi,

For uboot, you need to refer to rel-32 document as rel-34 does not support TX2-NX.

https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3261/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/uboot_guide.html#wwpID0E03F0HA

Also, GUI boot time may not be reduced. Maybe trying to use other light weight window manager may help. For example, lightdm + LXDE.

Hi @WayneWWW ,

Thank you for the response.I will check the link.
Actually I don’t require GUI.I tried to stop Desktop GUI by using the following command.

sudo systemctl set-default multi-user.target

Is it the right method to disable the Desktop GUI?
I checked the boot time by changing the status of a gpio using a startup script with following content

[Unit]
Description=Example systemd service.
After=default.target

[Service]
Type=simple
ExecStart=/bin/bash /etc/on_reboot.sh

[Install]
WantedBy=default.target

Is it the right method to disable the Desktop GUI?

Yes, this is correct.

Hi @WayneWWW ,

Even after disabling the desktop gui , the boot time is not getting reduced.How can we disable the console printing over UART?

Removing ttyS0 from kernel cmdline may make kernel not print log to UART. But bootloader side requires other methods.

You may do other optimization in bootloader first as you still need the UART log to measure the time.

Hi @WayneWWW ,

“Removing ttyS0 from kernel cmdline may make kernel not print log to UART.”
Even after removing the ttys0 from board configuration file(p3636.conf.common) I am able to see the kernel logs over UART. Can we disable the kernel logs by any other methods?

how about this?

  1. ODMDATA=0x2090000 to ODMDATA=0x2010000
  2. CMDLINE_ADD=“console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 isolcpus=1-2”; to
    CMDLINE_ADD=“fbcon=map:0 net.ifnames=0 isolcpus=1-2”;
    in p3636.conf.common

Hi @WayneWWW ,

I will check and get back to you

Hi @WayneWWW ,

I have changed 1. ODMDATA=0x2090000 to ODMDATA=0x2010000 and CMDLINE_ADD=“console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 isolcpus=1-2”; to
CMDLINE_ADD=“fbcon=map:0 net.ifnames=0 isolcpus=1-2”; in p3636.conf.common file.After flashing kernel logs are not being printed over UART.But I am not able to access the nvidia over uart. Is this expected behaviour?

That is the purpose of the above…to disable the serial console. On the other hand, I suppose it is possible to keep serial console enabled while disabling only log messages (not sure, but I am certain it is more complicated to do that). You could still use the UART, but it isn’t used by the console after that.

Yes, it is as expected.

Hi @linuxdev and @WayneWWW ,

Can we disable only the kernel logs and keep serial console enabled? And also is it possible to disable the “Hit any key to stop autoboot” prompt(2 Sec delay) ? .

Just a reminder that uboot source and cboot source are all public… you could refer to it if you want to disable anything.

Hi @WayneWWW and @linuxdev ,

Can we remove the following services.

  1. nvphs.service
  2. containerd.service

Is it safe to remove the above services?Are they important services?

I don’t know if those services are safe to remove. I can tell you that disabling logging in the boot stages would require adjusting the boot source mentioned by @WayneWWW. The mechanism for changing logging once in Linux should be simpler, but I have not tried it myself.

Here is one article on changing log levels once in Linux:
https://linuxconfig.org/introduction-to-the-linux-kernel-log-levels

You would basically be changing log levels in the bootloader as well, but I doubt it is anywhere nearly as simple as it is in Linux. You could disable the “Hit any key to stop autoboot”, but if there are no log messages, then you might as well just disable serial console in boot stages as well. Linux is its own separate stage, and if serial console works there, then it is independent of whether or not console works in the bootloader.

Just a side note: Sometimes the device tree is used to configure similar function in both bootloader and Linux. You might find that if you use the device tree as part of disabling bootloader serial console that it might also disable in Linux. It just depends on a combination of things, so I suggest to just experiment. Something to examine is the content of the “APPEND” key/value pair in extlinux.conf. You might notice that it inherits the environment variable “${cbootargs}”. Then examine the output of the device tree node “chosen->bootargs” (for example, on a running system, “cat /proc/device-tree/chosen/bootargs”).

Mostly the device tree bootargs node is what creates the environment variable “${cbootargs}” as Linux is reached. I say “mostly” because it is possible that boot stages might edit this before passing it on to “${cbootargs}”. If you were to disable serial console in the device tree, then you’d likely disable it in the bootloader, which you don’t want to do. What you want to do is to remove logging, and I don’t know which boot software changes are needed for that.

Hi @linuxdev and @WayneWWW ,

Thank you so much for detailed answer @linuxdev .I will check with the above mentioned link too.I already tried disabling the 2sec delay in the user prompt “Hit any key to stop autoboot”.I have followed the below steps.

1.Added CONFIG_BOOTDELAY=0 in the file sources/u-boot/configs/p3636-0001_defconfig
2. in the uboot source folder done “make distclean”
3.make p3636-0001_defconfig
4.make
5.Copied the binaries u-boot,u-boot.bin,u-boot.dtb,u-boot-dtb.bin to Linux_for_Tegra/bootloader/t186ref/p3636-0001/
6.Done full flash using the command "sudo ./flash.sh mmcblk0p1

I could remove the 2sec delay by following these steps.@WayneWWW could you please confirm whether the above steps are correct or not?

And also I tried to flash u-boot alone using the below command
sudo ./flash.sh -k LNX mmcblk0p1
But flashing was failed.What is the command for flashing the u-boot alone for Jetson TX2 NX?
Kindly support me

sudo ./flash.sh -k LNX mmcblk0p1

Above command didn’t tell which board config to use. I guess the flash log will also tell you that…
Did you ever flash your board with flash.sh before?