Boot from USB

Thanks for your response @WayneWWW

I followed the steps mentioned in the user guide to prepare the USB drive. The xavier-nx SoM flashed with 32.5 and USB pendrive with 32.5 images as such without any change works fine on the devkit booting from USB. But when used with custom board it is booting from emmc and not from USB.

I tried with both USB 2.0 and USB 3.0 pendrives.
Is there any specific change on either hardware or software side is need?

Regards,
deepika.s

Hi,

You can try below test

  1. Prepare 1 custom board, 1 devkit and the usb drive.
  2. Use your method to prepare the usb drive, plug it into custom board and see if it can boot from it.
  3. If (2) fails, directly move this usb drive from custom board to devkit and see if it can boot from it.

If devkit can boot from it but custom board cannot, then please check if custom board can mount this usb drive after boot from emmc.

Thanks for your response @WayneWWW

As mentioned above I prepared the boards and USB. On the custom board it was not booting USB and on the devkit it was booting from USB. After custom board booted from emmc, I am able to mount the usb drive.

So far I didn’t use HDMI . But when HDMI was connected to custom board with USB drive, it booted from USB. When hdmi is not connected with USB connected, it booted from emmc. So whenever HDMI is connected I observed the custom board booted from USB and whenever hdmi is not connected it booted from emmc.
But in case of devkit there is no need for any HDMI to boot from USB.

I have attached the following logs. PFA

  1. dmesg of devkit booted from USB without hdmi
    devkit_nohdmi_usbboot_dmesg.txt (76.5 KB)

  2. bootloader log of devkit booted from USB without hdmi
    devkit_nohdmi_usbboot_bootloaderlog.txt (26.0 KB)

  3. dmesg log of custom board without hdmi booted from emmc
    custom_nohdmi_usbconnected_but_booted_emmc_dmesg.txt (62.0 KB)

  4. bootloader log of custom board without hdmi booted from emmc
    custom_nohdmi_usbconnected_but_booted_emmc_bootloader_log.txt (84.6 KB)

  5. dmesg log of custom board with hdmi booted from USB
    custom_hdmiconnected_usbconnected_booted_USB_dmesg.txt (67.4 KB)

  6. bootloader log of custom board with hdmi booted from USB
    custom_hdmiconnected_usbconnected_booted_USB_bootloader_log.txt (27.8 KB)

Could you please help me debug this issue.

Regards,
deepika

Hi,

I checked the log. It looks and sounds like not a software issue to me. Do you mean if you connect HDMI on custom board, then cboot is able to detect file system but if HDMI is gone, then it will not find the filesystem over usb drive?

Thanks for your response @WayneWWW ,

Yes, if HDMI is physically connected the custom board boots from USB else it boots from emmc even if the USB drive is connected.

Is there anything I could check on either software or hardware side?

Regards,
deepika.s

Hi,

Please add these 4 patches to cboot and see if it can resolve this issue.
Patch1

diff --git a/drivers/usbh/xhci.c b/drivers/usbh/xhci.c
index aa0547a..40a1aee 100644
--- a/drivers/usbh/xhci.c
+++ b/drivers/usbh/xhci.c
@@ -1774,7 +1774,6 @@
 		}
 		trb->data_buffer_lo = U64_TO_U32_LO(dma);
 		trb->data_buffer_hi = U64_TO_U32_HI(dma);
-		dma += transfer_size;
 		trb->trb_tfr_len = transfer_size;
 		trb->td_size = (total_packets - ((size + transfer_size) / ctx->curr_dev_priv->enum_dev.ep[dir].packet_size));
 		if (count != (need_trbs - 1)) {

Patch2

diff --git a/lib/gpt/tegrabl_gpt.c b/lib/gpt/tegrabl_gpt.c
index a3b3deb..203aeea 100644
--- a/lib/gpt/tegrabl_gpt.c
+++ b/lib/gpt/tegrabl_gpt.c
@@ -118,12 +118,7 @@
 	pr_trace("GPT read: for device %08x\n", dev->device_id);
 
 	size = sizeof(struct tegrabl_gpt_entry) * TEGRABL_GPT_MAX_PARTITION_ENTRIES;
-
-#if defined(CONFIG_OS_IS_L4T)
-	size += (5 * TEGRABL_BLOCKDEV_BLOCK_SIZE(dev));
-#else
 	size += TEGRABL_BLOCKDEV_BLOCK_SIZE(dev);
-#endif
 
 	if ((*buf) == NULL) {
 		buffer = (uint8_t *)tegrabl_alloc_align(TEGRABL_HEAP_DMA, 4096, size);

Patch3

diff --git a/lib/gpt/tegrabl_gpt.c b/lib/gpt/tegrabl_gpt.c
index 8aab6cb..a3b3deb 100644
--- a/lib/gpt/tegrabl_gpt.c
+++ b/lib/gpt/tegrabl_gpt.c
@@ -120,7 +120,7 @@
 	size = sizeof(struct tegrabl_gpt_entry) * TEGRABL_GPT_MAX_PARTITION_ENTRIES;
 
 #if defined(CONFIG_OS_IS_L4T)
-	size += (6 * TEGRABL_BLOCKDEV_BLOCK_SIZE(dev));
+	size += (5 * TEGRABL_BLOCKDEV_BLOCK_SIZE(dev));
 #else
 	size += TEGRABL_BLOCKDEV_BLOCK_SIZE(dev);
 #endif

Patch4

diff --git a/drivers/usbh/xhci.c b/drivers/usbh/xhci.c
index 0613876..aa0547a 100644
--- a/drivers/usbh/xhci.c
+++ b/drivers/usbh/xhci.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2020, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2018-2021, NVIDIA CORPORATION.  All rights reserved.
  *
  * NVIDIA CORPORATION and its licensors retain all intellectual property
  * and proprietary rights in and to this software, related documentation
@@ -548,7 +548,7 @@
 
 	xusbh_xhci_writel(DB(0), 0);
 	pr_debug("Ding Dong!  @%08x  0x%x\n", DB(0), xusbh_xhci_readl(DB(0)));
-	err = xusbh_wait_irq(ctx, 100);
+	err = xusbh_wait_irq(ctx, 300);
 	set_enq_ptr(&ctx->cmd_ring);
 	return err;
 }
@@ -730,7 +730,7 @@
 	xusbh_xhci_writel(DB(ctx->slot_id), DB_VALUE(ep_index, 0));
 	pr_debug("Ding Dong!!!  Ring EP%d doorbell (%x)\n", ep_index, xusbh_xhci_readl(DB(ctx->slot_id)));
 
-	err = xusbh_wait_irq(ctx, 1000);
+	err = xusbh_wait_irq(ctx, 3000);
 	return err;
 }
 
@@ -924,7 +924,7 @@
 
 	xusbh_xhci_writel(DB(0), 0);
 	pr_debug("Ding Dong!  @%08x  0x%x\n", DB(0), xusbh_xhci_readl(DB(0)));
-	err = xusbh_wait_irq(ctx, 100);
+	err = xusbh_wait_irq(ctx, 300);
 /*
 	xhci_print_slot_ctx(ctx, 0);
 	xhci_print_ep_ctx(ctx, 0, 3, 0);
@@ -990,7 +990,7 @@
 
 	xusbh_xhci_writel(DB(0), 0);
 	pr_debug("Ding Dong!  @%08x  0x%x\n", DB(0), xusbh_xhci_readl(DB(0)));
-	err = xusbh_wait_irq(ctx, 100);
+	err = xusbh_wait_irq(ctx, 300);
 	tegrabl_dma_unmap_buffer(TEGRABL_MODULE_XUSB_HOST, 0, (void *)ctx->curr_dev_priv->dev_context, sizeof(struct EP) * 10,
 							 TEGRABL_DMA_FROM_DEVICE);
 /*

Thanks for your response @WayneWWW ,

I downloaded cboot sources from the link https://developer.nvidia.com/embedded/L4T/r32_Release_v5.0/sources/T186/cboot_src_t19x.tbz2
Tried to apply the patches. I was able to apply patch1 and patch4 but patches 2 & 3 related to lib/gpt/tegrabl_gpt.c, I am not able to apply. I am getting the below error

$git apply patch2.patch
error: patch failed: lib/gpt/tegrabl_gpt.c:118
error: lib/gpt/tegrabl_gpt.c: patch does not apply

Regards,
deepika.s

Hi,

For patch 2,3, please directly add the size+= … to the tegrabl_gpt.c

    pr_trace("GPT read: for device %08x\n", dev->device_id);
 
 	size = sizeof(struct tegrabl_gpt_entry) * TEGRABL_GPT_MAX_PARTITION_ENTRIES;

    +#if defined(CONFIG_OS_IS_L4T)
   	 +    size += (5 * TEGRABL_BLOCKDEV_BLOCK_SIZE(dev));
     +#else
     +    size += TEGRABL_BLOCKDEV_BLOCK_SIZE(dev);
     +#endif

Hi @WayneWWW

  1. I set the cross_compile path following the link: https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/xavier_toolchain.html

  2. Python version used is
    $python --version
    Python 2.7.17

  3. I followed CBoot_Standalone_Readme_t194.txt to build the cboot binary.
    while executing the below command I am facing errors.
    $ make -C ./bootloader/partner/t18x/cboot PROJECT=t194 TOOLCHAIN_PREFIX=“${CROSS_COMPILE}” DEBUG=2 BUILDROOT=“${PWD}”/out NV_TARGET_BOARD=t194ref NV_BUILD_SYSTEM_TYPE=l4t NOECHO=@

    I have attached the error log PFA
    cboot_error (223.8 KB)

Did I miss any step or did I follow something wrong?
Could you please help me solve this…

Regards,
deepika.s

Hi @WayneWWW

Could you please help me on the above query?

Regards,
deepika.s

Hello,

Where did you download your source code?

Thanks for your response @WayneWWW ,

I downloaded it in my laptop in the directory ~/Downloads/cboot and exported cross_compiler and tried to build.

Regards,
deepika.s

I mean which website or URL link did you download this source code tarball from?

Hi,

From the link Jetson Download Center | NVIDIA Developer - CBoot Sources for Jetson AGX Xavier and Jetson Xavier NX version:32.5 release-date :2021/01/21

Regards,
deepika.s

Hi,

We can build the default code without error.
Could you clean up it and try to use the default cboot to build again? It seems not from the patch.

Thanks for your response @WayneWWW ,
I built the cboot with the above patches and tested both on devkit and custom board.

  1. Both in custom board and devkit, without hdmi it booted from usb as observed from bootloader log. But I was not able to configure. I was only getting the below message on the ACM port
    “System configuration setup wasn’t completed. Please reboot device and try again.”
    I have also attached the bootloader error log during this case
    bootloader_log.txt (26.9 KB)

  2. when tested with HDMI both devkit and custom board booted from usb but the configuration was not happening. The configuration screen was blank.

On both the boards I tried to reboot many times with and without HDMI and tested, I was not able to configure.
Could you please help me.

Regards,
deepika.s

Hi,

  1. So after using the patch, you can boot from usb now, right?

  2. Could you remove quiet in extlinux.conf and share me the log with HDMI connected?

Hi @WayneWWW

  1. yes, after using the patch it is booting from USB.

  2. Could you please help on how to do it ?
    I am not able to access either ttyUSB0 or ttyACM0 when booted with/without HDMI.

    In L4T, I find two extlinux.conf file

    $ sudo find -iname extlinux.conf
    ./bootloader/extlinux.conf
    ./rootfs/boot/extlinux/extlinux.conf

should I change in these both files and flash the board fresh and prepare USB and test?

Regards,
deepika.s

During your preparation of the usb drive, modify that one from ./rootfs/boot/extlinux/extlinux.conf. If you don’t know which file to modify, just modify both of them. Such change is not fatal.

Hi @WayneWWW

I have attached the bootloader log . PFA
hdmi_quiet_bootloader.txt (89.5 KB)

Regards,
deepika.s