CBoot - shorten boot time

Hi,

I am trying to shorten the boot times of the system, and currently trying to mainly manage the CBoot times. I couldn’t find any guide related to CBoot, just for u-boot.

Two questions

  1. Is there a way to disable the “Hit any key to stop autoboot” prompt? It’s a 2s delay to boot times. (I tried looking in the sources published in the past, and I couldn’t find a configuration, but maybe I’ve missed something)
  2. Can I skip the USB boot attempt? it’s another ~1.5 to the boot times.

Thanks in advance,
Koby

If you use serial console to interrupt U-Boot (I have not looked at whether NX uses U-Boot though), then you have access the U-Boot command line. If NX uses U-Boot, then that command line (the very thing prompting to hit a key to stop) has access to the environment variables of U-Boot. That delay and wait is a macro expansion of the environment variables, and you can easily edit this.

If you have U-Boot and edit the environment variables, then you can also follow the expansion of variables and remove (or reorder) the search for other boot media such that your media is the first one searched for and there would be no need to wait for alternatives.

Typically, in a U-Boot command line, you would be interested in these commands:

help
printenv
# Replace MACRONAME with one of the printenv environment variables:
print MACRONAME
# Alternate:
echo $MACRONAME
# To continue booting:
boot

There are also various “save” commands. If you make a change and do not save, then those macros can be tested since this is still active for that boot. Future boots will lose the edit unless you save. Beware that once you remove the two second delay that you will need to flash again before you can get back to a U-Boot command line. This means you might want to clone prior to testing a “save” which removes that two second wait.

Note: Xavier does not use U-Boot, but so far as I know all other Jetsons (including NX) use U-Boot. I could be wrong.

Hi @linuxdev,

Thanks for your detailed answer. However, I’m pretty sure Xavier NX also uses CBoot and not U-Boot, and those commands don’t exist there.

Just verified again - there is a “Welcome to Cboot” message when booting NX, and also found this reference: Tegra Linux Driver which suggests NX also uses CBoot.

I couldn’t find any documentation or CBoot, and just an old version of its source code.

1 Like

The NX does indeed use CBoot.

You can disable the shell and usb boot but you have to recompile cboot to do it. It’s fairly easy though…

You can disable CBoot chell by undefining CONFIG_ENABLE_SHELL

1 Like

I have not explored the recent CBoot releases, but it seems likely that this is also read from some sort of environment variable. Someone knowing more about this CBoot version can probably tell you where to find the variables/macros being expanded which are equivalent to U-Boot’s since this is what the newer CBoot is trying to do…add some U-Boot functionality into CBoot. I have not experimented with that myself.

Unfortunately, whether to use the shell, and how long to wait is determined at compile time based on the GLOBAL_DEFINES.

#if defined(CONFIG_ENABLE_SHELL)

void enter_shell_upon_user_request(void)
{
	uint32_t i;

	/* wait for 2 seconds for an input from user to enter SHELL */
	pr_info("Hit any key to stop autoboot:");
	tegrabl_enable_timestamp(false);

	for (i = 4; i > 0; i--) {
		if (tegrabl_getc_wait(500) > 0) {
			tegrabl_display_printf(GREEN, "BOOTLOADER SHELL MODE\n");
			tegrabl_printf("\n");
#if defined(CONFIG_ENABLE_WDT) /*disable wdt in shell*/
			tegrabl_wdt_disable(TEGRABL_WDT_LCCPLEX);
#endif
			(void)console_init();
			console_start();
			break;
		}

		tegrabl_printf("\t%d", i);
	}
	tegrabl_printf("\n");

	/*enable wdt again, after exiting shell*/
	wdt_enable();

	tegrabl_enable_timestamp(true);
}
#endif

Thanks for your answers. As @gtj suggested, after looking a bit into the source code, all “configuration” is done in compile time which is a pity for development. I was able to change the behavior of #1 & #2 from my original question.

Anyone has an idea if CBoot is expected to improve in that sense? (allow runtime configuration)