Building EDK2 Firmware for Tegra with GCC 12.2

Hello guys,

I’m using Jetpack 5.0.2 / L4T R 35.1 and I’m building EDK2 firmware from source GCC version 12.2 .

My device Jetson Orin AGX is not booting and stuck at Jetson UEFI firmware stage.

Kindly see the logs below

Synchronous Exception at 0x0000000802F9A734

Recursive exception occurred while dumping the CPU state

                                                        Recursive exception occurred while dumping the CPU state
                                                                                                                ASSERT [ArmCpuDxe] /home/ichergui/projects/oe4t/tegra-demo-distro/build-orin-agx/tmp/work/jet
son_agx_orin_devkit-oe4t-linux/edk2-firmware-tegra/35.1.0-r0/edk2-tegra/edk2/MdePkg/Library/UefiLib/UefiLibPrint.c(202): Buffer != ((void *) 0)

Resetting the system in 5 seconds.
����Shutdown state requested 1
Rebooting system ...

Note: The device is rebooting in loop infinite

The attached file contains logs from serial UART (EDK2 building in DEBUG mode)

uefi_debug_mode_orin_agx_branch_rel-35.log (101.6 KB)

Any idea about the root cause ?

Any help would be appreciated.
Best regards,
Ilies

hello ilies.chergui,

may I also know what’s your desktop build environment, are you using ubuntu-18, or 20?
did you follow the instructions at… Build · NVIDIA/edk2-nvidia Wiki · GitHub ?

Hello @JerryChang
My desktop is Ubuntu 18.04.5 LTS
Yes, I’m following the instructions described in the link you shared

hello ilies.chergui,

we’ve check this internally with success.
please also follow below steps for reference,
for example,

$ mkdir edkrepo
$ cd edkrepo/
$ wget https://github.com/tianocore/edk2-edkrepo/releases/download/edkrepo-v2.1.2/edkrepo-2.1.2.tar.gz
$ tar xpvf edkrepo-2.1.2.tar.gz 
$ sudo ./install.py 
$ edkrepo manifest-repos add nvidia https://github.com/NVIDIA/edk2-edkrepo-manifest.git main nvidi
$ edkrepo clone nvidia-uefi NVIDIA-Jetson jetson-r35.1
$ cd nvidia-uefi/
$ cat edk2-nvidia/Platform/NVIDIA/Jetson/Build.md 
$ edk2-nvidia/Platform/NVIDIA/Jetson/build.sh

note, you may also install mono on your Ubuntu-18.04 host machine,
thanks

@JerryChang
Which toolchain you are using ?
Please share GGC and binutils version

Thanks a lot @JerryChang

I confirm when following the instructions you shared above and building the sources by using my toolchain (GCC version 12.2, binutils version 2.39)
The device Jetson Orin AGX boots normally.

  • Toolchain informations
➜  crosstool-ng git:(master)  (master)./ct-ng show-aarch64-unknown-linux-gnu 
[L...]   aarch64-unknown-linux-gnu
    Languages       : C,C++
    OS              : linux-5.19.2
    Binutils        : binutils-2.39
    Compiler        : gcc-12.2.0
    C library       : glibc-2.36
    Debug tools     : gdb-12.1
    Companion libs  : expat-2.4.1 gettext-0.21 gmp-6.2.1 isl-0.24 libiconv-1.16 mpc-1.2.1 mpfr-4.1.0 ncurses-6.2 zlib-1.2.12
    Companion tools :
➜  crosstool-ng git:(master)  (master)
  • result (images)
(venv) ➜  nvidia-uefi  [jetson-r35.1]tree images                   
images
├── AcpiBoot_Jetson_DEBUG.dtbo
├── AcpiBoot_Jetson_RELEASE.dtbo
├── BOOTAA64_Jetson_DEBUG.efi
├── BOOTAA64_Jetson_RELEASE.efi
├── builddir_Jetson_DEBUG.txt
├── builddir_Jetson_RELEASE.txt
├── L4TConfiguration_Jetson_DEBUG.dtbo
├── L4TConfiguration_Jetson_RELEASE.dtbo
├── L4TRootfsABInfo_Jetson_DEBUG.dtbo
├── L4TRootfsABInfo_Jetson_RELEASE.dtbo
├── L4TRootfsBrokenInfo_Jetson_DEBUG.dtbo
├── L4TRootfsBrokenInfo_Jetson_RELEASE.dtbo
├── L4TRootfsInfo_Jetson_DEBUG.dtbo
├── L4TRootfsInfo_Jetson_RELEASE.dtbo
├── uefi_Jetson_DEBUG.bin
└── uefi_Jetson_RELEASE.bin

0 directories, 16 files
(venv) ➜  nvidia-uefi  [jetson-r35.1]

The attached files contains the complete logs from host machine and serial uart

build_uefi_from_source_host_machine.log (5.4 MB)
jetson_orin_agx_serial_uart.log (102.8 KB)

@JerryChang

Quick question:

What is the best approach to debug UEFI when having issue at runtime ?

Thanks

hello ilies.chergui,

what’s the issue, is it hang or something else?
you should check UART console for output logs. if you’re able to use ESC keyevent to enter UEFI menu, you’re able to select boot options.

Hey @JerryChang
I’m not able to use ESC keyevent to entre the UEFI menu (I don’t think it will help tbh). I believe the issue happen when loading nvgop-chips-platform driver.

add-symbol-file /dvs/git/dirty/git-master_linux/out/nvidia/bootloader/uefi/Jetson_RELEASE/Build/Jetson/RELEASE_GCC5/AARCH64/Silicon/NVIDIA/Drivers/NvGopDriver/nvgop-chips-platform/DEBUG/nvgop-chips-platfor
m.dll 0x802D85000
Loading driver at 0x00802D84000 EntryPoint=0x00802D8CE3C nvgop-chips-platform.efi
PROGRESS CODE: V03040002 I0


Synchronous Exception at 0x0000000802D88734

Recursive exception occurred while dumping the CPU state

                                                        Recursive exception occurred while dumping the CPU state

                                                                                                                Recursive exception occurred while dumping the CPU state

                                                                                                                                                                        Recursive exception occurred while du
mping the CPU state
                   ��ERROR:   Exception reason=2 syndrome=0x80000411
Unhandled Exception in EL3.

Please check the attached log file which contains the complete traces from serial UART.

uefi_debug_mode_orin_agx_branch_rel-35.log (101.6 KB)

Can I use QEMU to try the UEFI (uefi_jetson.bin) image before flashing my Jetson device ? (This is for debug purposes)

Thanks a lot for your help.

Hi,

A question here. Are you always using your own toolchain version or you have tried the toolchain @JerryChang just shared to you?

Hey @WayneWWW

I’m using my own toolchain.

Note: I’m using crosstool-ng to generate the toolchain.

Could you try to use our suggested toolchain first and see if it that is fine ?

As I mentioned above the device boots fine when using the toolchain suggested by Nvidia

.e.g: Bootlin Toolchain gcc 9.3

Also, I’m asking about the best way/practices to debug the bootloader UEFI at runtime ? I’m not sure if we can use QEMU

Hello @JerryChang @WayneWWW

Could you please close this topic because it is solved ?

Thanks
Ilies