bao-project / bao-demos

A guide on how to build and use a set of Bao guest configurations for various platforms
Other
33 stars 37 forks source link

Failed to flash arm trusted firmware to Jetson TX2 #51

Closed danielRep closed 7 months ago

danielRep commented 7 months ago

Hi,

I followed the instructions from bao-demos to install bao on Jetson TX2. However, I stuck at the step to flash arm trusted firmware to Jetson TX2. After the flash command started, it hung for almost an hour. I had nothing to do but interrupt the process.

I am seeking for help to successfully flash the firmware. The followings are some information that might be helpful.

I'm sure the board was in recovery mode. image

During the flashing, it showed a message BootRom is not running. image

Originally posted by @Alan-Kuan in https://github.com/bao-project/bao-hypervisor/discussions/118

danielRep commented 7 months ago

Hi @Alan-Kuan ,

I just reproduced the guide for the baremetal example and everything ran smoothly. Did you follow the automated make or the step-by-step guide?

Alan-Kuan commented 7 months ago

Hi @Alan-Kuan ,

I just reproduced the guide for the baremetal example and everything ran smoothly. Did you follow the automated make or the step-by-step guide?

I tried both, but neither of them worked. It just stuck at the step tegrarcm_v2 --isapplet, and retried after a long while.

Alan-Kuan commented 7 months ago

Other details:

danielRep commented 7 months ago

Can you share the tos.img so I try to flash your binary in my board? I tried to the latest version of L4T (32.7.4) and it's working too.

Alan-Kuan commented 7 months ago

Can you share the tos.img so I try to flash your binary in my board? I tried to the latest version of L4T (32.7.4) and it's working too.

Sure, here's a one-time download link to it. https://file.io/fhCUr9R27O7H

danielRep commented 7 months ago

Can you share the tos.img so I try to flash your binary in my board? I tried to the latest version of L4T (32.7.4) and it's working too.

Sure, here's a one-time download link to it. https://file.io/fhCUr9R27O7H

I could flash your image without running to any issue. image Could you check your hardware? Maybe follow the bring-up guide from Nvidia to see if everything is well configured.

Alan-Kuan commented 7 months ago

Can you share the tos.img so I try to flash your binary in my board? I tried to the latest version of L4T (32.7.4) and it's working too.

Sure, here's a one-time download link to it. https://file.io/fhCUr9R27O7H

I could flash your image without running to any issue. image Could you check your hardware? Maybe follow the bring-up guide from Nvidia to see if everything is well configured.

Wow! I will check it tomorrow. It's about 23:21 in my timezone. Thanks for your help!

danielRep commented 7 months ago

Okey, keep me posted so I close the issue when the problem is solved.

Alan-Kuan commented 7 months ago

I noticed that on the web page of SDK Manager, there's a line telling that to flash successfully, the installed package should support the host OS.

image

Therefore, I guessed the reason that I failed to flash tos.img was because my host OS is not supported by JetPack 4.x, which is the latest version of JetPack that Jetson TX2 can install. My host OS is Ubuntu 22.04, and JetPack 4.x supports only Ubuntu 16.04 and Ubuntu 18.04.

Unfortunately, I have no machine running on either of the supported versions. I tried running the flash tool (L4T Driver Package) inside an Ubuntu 18.04 container and a live-booted environment. However, when I run the command lsusb, I found that Jetson TX2 was not recognized being in recovery mode. I was pretty sure it was in recovery mode, as it's recognized by the original host I used.

I wonder should I use Ubuntu 18.04 to flash tos.img successfully, and how can I make the OS recognize the board is in recovery mode. Is there any package that I have to install?

danielRep commented 7 months ago

I have flashed the TX2 under Ubuntu 22.04 (Linux daniel-GP62M-7REX 6.2.0-39-generic #40~22.04.1-). Did you notice if the gen_tos_part_img has created the tos.img successfully? Since I'm using Ubuntu 22.04 which comes without python2.7 support, I add to refactor the script to python3.

Alan-Kuan commented 7 months ago

I see. So, it should work on Ubuntu 22.04.

Yes, I noticed that it requires Python 2, so I used pyenv to install Python 2 and run the script with it. The tos.img I provided yesterday was generated by this method.

Currently, I successfully flashed the JetPack 4.6.4 onto Jetson TX2. I found that although lsusb didn't show the board was in recovery mode, it's actually recognized. Therefore, I could use SDK Manager to flash the JetPack.

However, the flash.sh indicated that jetson-tx2 is an invalid target board. screenshot

I initially thought it was because the OS didn't recognize the board was in recovery mode, but SDK Manager did flash successfully, so it should be something else.

Alan-Kuan commented 7 months ago

I found the reason why jetson-tx2 was not found. The script utilizes relative path to work, so I should execute the script inside Linux_for_Tegra.

In addition, I successfully flashed tos.img. This time, I switched back to run on Ubuntu 22.04.

Maybe the success was related to the upgrade of JetPack on Jetson TX2.

danielRep commented 7 months ago

So, you manage to flash on the docker yes? And you are testing now in Ubuntu 22.04 ?

Alan-Kuan commented 7 months ago

So, you manage to flash on the docker yes? And you are testing now in Ubuntu 22.04 ?

I didn't flash on the Docker container. I did it on an Ubuntu 22.04 host. However, I guess it will work if running the container with the flags mentioned here.

danielRep commented 7 months ago

Seems now you are able to flash the board, tell us if you have successfully run the demo.

Alan-Kuan commented 7 months ago

Seems now you are able to flash the board, tell us if you have successfully run the demo.

Yes, both baremetal and FreeRTOS+Linux worked. I think this issue can be closed. Again. Thanks for your help!

Alan-Kuan commented 7 months ago

By the way, I successfully reproduced the result on another Jetson TX2 board today. I still had to flash newer JetPack to the board first in order to successfully flash arm trusted firmware.

It looks like the first item or the third item was what made flashing arm trusted firmware work. Screenshot from 2024-01-11 13-53-35

danielRep commented 7 months ago

Great @Alan-Kuan !