NVIDIA Tegra
NVIDIA DRIVE OS 5.1 Linux SDK

Developer Guide
5.1.15.0 Release


 
Customizing Quickboot
 
Compression Options
Compiling
About the Build System
Compiling Quickboot
Incrementing the Quickboot Version Number
Using Interactive Mode
Forcing Boot from the Kernel Recovery Partition
Configuring the Serial Console Baud Rate
Using I2C Controller
Appending Splash Screen/CPIO Images to the RAMdisk
The Quickboot boot loader for the CPU:
Provides a debugging mode.
Includes a single build for Quickboot, which works for all platforms. All platform-specific configurations must occur through the DTB file.
Optimized for embedded and automotive applications.
Boot Stages
Quickboot loads the kernel image from KERNEL_PRIMARY partition on flash. Based on whether the image is compressed, it performs on-the fly decompression of the kernel image and boots the same.
Decompression
Quickboot supports decompression algorithms:
LZ4: performs good compression with faster decompression time.
The default decompression scheme is LZ4.
Compression Options
The prepended kernel header specifies compression in the download image. There are multiple approaches you can take to prepend the header; each approach can specify compression.
For final production or for flashing updated images, most customers create custom flashing CFG files.
There are several advantages to using a custom CFG file. It can specify:
Different kernel images for recovery and primary partitions.
Ternary partition.
RAMDisk or other feature in recovery partition or vice-versa.
Compiling
Foundation provides defconfig files that specify the configuration for the target platform. Such files are used when the target differs from the host system. The defconfig files are available at:
<top>/drive-t186ref-foundation/firmwares/src/bootloader/quickboot/qb-t18x-partner/arch/t19x/configs
Debug Quickboot
Quickboot supports the following configuration for debug:
qb_defconfig
This configuration supports debug logging and provides a debug console with utilities. Manual intervention is required.
To load and boot the kernel image
1. Power on the system.
2. When prompted, type boot to proceed and load the kernel.
For more information, see Using Interactive Mode.
Production Quickboot
Quickboot supports the following configuration for production:
qb_production_defconfig
Debug prints are not enabled. This configuration auto loads the kernel image.
About the Build System
The build system creates the loadable binaries by performing these steps:
1. Parses the defconfig file and generates the header and .config_* files: autoconf_cpu
2. Makes header files available to all Quickboot sources. The build system uses config files for defining the code to compile.
3. Generates a binary as the CPU boot loader binary: qb_cpu.bin.
Compiling Quickboot
To compile quickboot you must:
Update the following file, to specify the absolute path:
<top>/drive-t186ref-foundation/firmwares/src/bootloader/quickboot/qb-t18x-partner/.cross_compile
Specify the absolute path to:
export QUICKBOOT_CPU_CROSS_COMPILE=<Top>/toolchains/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
Verify that the TARGET_PLATFORM environment variable specifies the target platform.
To compile Quickboot
1. Set the current working directory to:
<top>/drive-t186ref-foundation/firmwares/src/bootloader/quickboot/qb-t18x-partner
2. Configure Quickboot for your board.
The following example uses defconfig and the release build flavor. The build flavor must be release.
export BUILD_FLAVOR=release
export TARGET_SOC=t19x
export TEGRA_TOP=<QB_PARTNER_PATH>/../..
make clean
3. If you are compiling back and forth between production defconfig and debug defconfig, run the make clean command before typing make.
For the default build, enter:
make <defconfig>
make
4. Create a backup of the default boot loader images provided.
Backup location:
<top>/drive-t186ref<foundation>/firmwares/bin/t19x/
5. To use the same image next time you flash, copy the boot loader images to the boot loader top directory. The destination directory depends on your build type.
Built images location:
<top>/drive-t186ref<foundation>/firmwares/src/bootloader/quickboot/qb-t18x-partner/_out/t19x/images
6. Copy the files to this location:
<top>/drive-t186ref<foundation>/firmwares/bin/t19x/
Incrementing the Quickboot Version Number
Incrementing the Quickboot version number allows you to distinguish your Quickboot modifications from the default version. It also allows you to distinguish between your own versions of Quickboot modifications.
From the Quickboot command line, you can obtain the Quickboot version with the version command.
To increment the Quickboot version number
1. Locate and edit the following file:
bootloader/quickboot/qb-t18x-partner/include/version.h
2. Modify the minor or major number.
The following shows an example of the file contents:
#ifndef INCLUDED_VERSION_H
#define INCLUDED_VERSION_H
 
#define QB_MAJOR_VERSION 0
#define QB_MINOR_VERSION 1
 
#endif
3. Compile Quickboot.
Using Interactive Mode
The method for enabling interactive mode depends on the Tegra version in your platform:
To enable the console upon boot
Enable the CONFIG_ENABLE_DEBUG_PROMPT in the non-production defconfig for the VCM and rebuild Quickboot.
To list all Quickboot commands
At the Quickboot prompt, enter:
qb> help
To boot the kernel image
From the Quickboot prompt, enter:
qb> boot
This command loads the kernel from the KERNEL_PRIMARY partition. If the kernel image is compressed, Quickboot decompresses it before loading it.
To get the Quickboot version number
At the Quickboot prompt, enter:
qb> version
Forcing Boot from the Kernel Recovery Partition
Applications can force Quickboot to boot from the kernel recovery partition, even when the kernel-primary partition is valid.
The kernel-recovery partition has the KERNEL_RECOVERY type.
To force Quickboot to boot from the kernel-recovery partition
1. Set bit 31 in a value that you write to the APBDEV_PMC_SCRATCH0_0 scratch register.
2. Trigger a soft-reboot.
Configuring the Serial Console Baud Rate
If serial console is enabled for Quickboot, it is by default configured for a baud rate of 115200.
To change the baud rate, update the Quickboot DTS file for the corresponding platform.
Using I2C Controller
By default in QB DTB, only I2C-0 is registered.
To register other I2C controllers in the DTB:
1. Locate the platform DTB in:
<top>/drive-t186ref-foundation/firmwares/src/bootloader/quickboot/qb-t18x-partner/data_driven/
2. Add the I2C controller in the I2C DTB node.
3. Add the corresponding I2C controller details in the Clock node to configure Clocks for the Controller.
A sample command for using I2C is provided in core/console.c. Use it by enabling the interactive mode of the Quickboot.
Appending Splash Screen/CPIO Images to the RAMdisk
To ensure fast booting, keep the RAMdisk as small as possible. During production, to display a different splash screen/animation/notification based on the region where the product is launched, Quickboot can read another CPIO image, validate the image (Hash validation), and append it to the RAMdisk CPIO image.
To change the splash screen display:
1. Add the splash screen partition to the flash CFG file:
[partition]
name=<NAME>
type=splash
allocation_policy=sequential
filesystem_type=basic
size=0x400000
partition_attribute=0
filename=<CPIO_PATH>
2. In Quickboot, edit the QbGetSplashScreenPartition function and pass the corresponding partition name as mentioned in the flash CFG file at:
qb-t18x-partner/core/kernel/boot_config.c
When calling QbAddCpioContentToRamdisk this function is invoked in:
qb-t18x-partner/core/kernel/qbbootkernel.c
Which adds the content of the given partition to the CFG.
By default, splash is the partition name in the Quickboot, defined in partname.h. The same can be provided in the flashing CFG as well.
Quickboot Device Tree
 
Clocks
Serial
QSPI
SDMMC
I2C
Field_Ratchet
Quickboot (QB) has a data driven framework which uses the device tree to configure device drivers and clocks in various configurations. The QB build process generates the device tree source and the QB device tree binary (DTB) files. The device tree source has a name that is based on the device name, e.g. e3550. The QB device tree binary is appended to QB bootloader binary, qb_cpu.bin, during flashing or offline image creation to generate the final binary, qb.bin.
Clocks
QB queries the clock node in the DTB and requests BPMP-FW to configure peripheral clocks, which are defined in clocks’ device tree node. For example:
clock {
periph =
/* ClockId ResetId ParentClkId RequiredRate */
< CLK_ID(QSPI0) RESET_ID(QSPI0) TEGRA194_CLK_PLLP_OUT0 136000000 >,
< CLK_ID(QSPI1) RESET_ID(QSPI1) TEGRA194_CLK_PLLP_OUT0 136000000 >;
};
Where:
ClockID and ResetID are defined in the BPMP-FW clock ABI documentation.
ParentClkId is the ID of the clock to be set as parent of the current clock.
RequiredRate is the rate to be set for the current clock.
To keep the default setting of a clock (as set by BPMP-FW), set ResetID to RESET_ID_INVALID, ParentClkId to PARENT_CLK_ID_INVALID, and RequiredRate to CLK_RATE_INVALID.
Serial
The QB serial driver can be configured using the serial node in QB DTB file. For example:
serial {
serial =
/* WordLength, Parity, StopBits, BaudRate, Port */
<8 0 1 115200 0>;
};
Note:
The Quickboot serial device (UART) is predefined by th early boot loader components MB1 and MB2. For this reason the instance number fo the serial device is not supported, and multiple instances of the serial device cannot be defined.
QSPI
The QB QSPI driver can be configured and instanced using the qspi node. For example:
qspi {
/* Instance numbering starts from 0 */
qspi@0 {
Instance = <0>;
/* OpMode DmaChannel ChipSelect CSActiveBwPkts CyclesBwPkts TxClkTapDelay RxClkTapDelay */
Controller Properties = <1 0 0 1 3 0 0>;
};
Where:
OpMode is set to 0 for SDR mode or 1 for DDR mode.
DmaChannel specifies the GPC DMA channel to be used by the QSPI driver.
ChipSelect is set to 0 for Active_Low or 1 for Active_High.
CSActiveBwPkts is Chip Select to be active between QSPI packets. Set 1 to enable Chip Select, or 0 to disable it.
CyclesBwPkts is the number of wait cycles between QSPI packets.
TxClkTapDelay and RxClkTapDelay specify the tab delay.
Note:
The Xavier SoC has two QSPI controllers. The second controller can also be registered, but the two controllers must use different DMA channels.
SDMMC
The QB EMMC driver can be configured and instanced using the sdmmc node. For example:
sdmmc {
/* Instance numbering starts from 0 */
sdmmc@3 {
Instance = <3>;
/*
* 2 - skip CMD0, start full init with CMD1
* 1 - init only, exit after CMD0 and initiating CMD1
* 0 - full initialization
*/
InitTypeNative = <0>;
InitTypePL = <0>;
InitTypeOSL = <0>;
factor =
/* ClockDivisor, CardClockDivisor, Mantissa */
<4 2 1>;
DataWidth = <6>;
DisableHS400 = <1>;
/* Values depend on SDR or DDR mode selection */
TapVal = <0x9>;
TrimVal = <0x5>;
};
};
Where:
Instance is the controller instance in hardware: 0, 1, or 2, as explained in the example’s comments.
factor is the internal controller clock divisor setting <ClockDivisor, CardClockDivisor, Mantissa>.
DisableHS400 is set to 1 for EMMC in DDR 50, or 0 for EMMC in HS400 (if supported by the device).
TapVal and Trim Val are fixed values based on SDR/DDR mode. They should not be changed.
The SDMMC driver is shared by several stage bootloaders (Quickboot, Partition Loader, and OS Loader).
The InitTypeNative, InitTypeFL, and InitTypeOSL fields allow further initialization time optimization in SDMMC node. These nodes are:
InitTypeNative = <0>;
InitTypePL = <0>;
InitTypeOSL = <0>;
For each field:
0 specifies full initialization.
1 abbreviates initialization: the process ends after sending CMD0 and initiating CMD1.
2 skips CMD0 and starts full initialization with CMD1.
I2C
The QB I2C driver can be instanced using the i2c node in QB-DTB. Since the QB I2C driver only support one-byte read/write operations, adding a controller instance is sufficient. For example:
i2c {
/* Instance numbering starts from 0 */
i2c@0 {
Instance = <0>;
};
};
Field_Ratchet
Quickboot updates field ratchet for MB1, MTS and MB1-BCT binary when optin fuse is set and hardware ratchet is lesser than the software ratchet version. The default behavior of Quickboot is to update field ratchet when an in-active boot-chain is found to be corrupted. Modify this behavior by setting disable-force-ratchet = <1>. If the inactive boot-chain is corrupted, QB does not update the field ratchet. Setting disable-force-ratchet to 1 is recommended for systems where both boot chains are maintained at different software ratchets.
For example:
field-ratchet {
disable-force-ratchet = <1>;
};