System.img not being created when running flash.sh

Hi, I am attempting to flash an AGX Xavier via Jetpack 5.1.2. When I run the flash.sh script, the system.img is not being created, and as a result I cant flash an image to the AGX Xavier. Is there a way to generate this file from somewhere else? Why would this file not be generated automatically?

You could try to share out how you ran your flash.sh and what error you saw there.

I am doing flash everyday but I didn’t hit such issue at all.
Your question only happened to yourself. Nobody knows what is going on your side without log.

I guess your BSP is probably has missing package or even your flash command is totally wrong.

Here is the log for the flash.sh script:

Flash_Log.txt (16.1 KB)

I ran the flash.sh command as follows:

sudo ./flash.sh --no-flash jetson-agx-xavier-devkit mmcblk0p1

The log says “Skip generating system.img”. However, I have no idea why this would happen, as I did not use the -r flag with the flash.sh script.

I have Jetpack 4.6, and Jetpack 5.1 source files both on the same host as well, and both of them work fine (I only face this issue in Jetpack 5.1.2). I tried re-installing the Jetpack 5.1.2 source files, but the issue persists even after re-installing the source files.

looks like just because you run the command with --no-flash?

@WayneWWW , I edited my previous message. Kindly see the updated comment.

The issue occurs even when --no-flash flag is not used. (My understanding is that no-flash does everything except flash the actual image, so it should be creating a system.img. I have used this before, and it does actually create a system.img file).

The issue occurs even when --no-flash flag is not used

Again, do you have any log here to show what you just told? We really don’t need such simple comment. We need the log.

@WayneWWW , here is the log when --no-flash flag is not used.
Flash_Log2.txt (68.8 KB)

Apologies for not sharing this log earlier. Both logs show the line “Skip generating system.img”, which indicates that a new system.img file is not created. Additionally, the log without the --no-flash flag (Flash_Log2.txt) gives an error at the end “File to be written cannot be of zero size, pFileName=system.img” because the system.img file does not exist (because it wasnt created in the first place).

Could you check what is the result of variable “${skip_systemimg}” when running flash.sh?

@WayneWWW , This variable seems to be empty. I ran the following command to check the value of this variable before and after executing the flash.sh script:

echo “${skip_systemimg}”

The output is an empty line in both cases.

Where does this variable get its initial value? I don’t see this variable getting assigned anything in the flash.sh script itself.

Could you check why the flash script (flash.sh) goes into this condition on your side?

I mean make sure the skip generating system.img is from this code first.

3820 # At this stage, the kernel dtb in $BL_DIR folder has the "bootargs=" added,
3821 # it can be saved to rootfs.
3822 #
3823 if [ "${reuse_systemimg}" = "true" ] || [ "${skip_systemimg}" = "true" ]; then
3824         if [ ${disk_enc_enable} -eq 0 ]; then
3825                 APP_TAG+="-e s/APPFILE/${localsysfile}/ ";
3826         fi;
3827         if [ "${skip_systemimg}" != "true" ]; then
3828                 sysfile_exist
3829         else
3830                 if [ ${disk_enc_enable} -eq 0 ]; then
3831                         echo "Skip generating ${localsysfile}";
3832                 else
3833                         echo "Skip generating ${localsysbootfile} & ${localsysencrootfile}";
3834                 fi;
3835         fi;

Hi @WayneWWW , I added three “echo” statements to the lines you mentioned in the flash.sh script. These are shown below:

# At this stage, the kernel dtb in $BL_DIR folder has the "bootargs=" added,
# it can be saved to rootfs.
#
echo "CUSTOM LOG: THE VALUE OF SKIP_SYSTEMIMG VARAIBLE: ${skip_systemimg}"
echo "CUSTOM LOG: THE VALUE OF REUSE SYSTEM IMAGE VARIABLE: ${reuse_systemimg}"
if [ "${reuse_systemimg}" = "true" ] || [ "${skip_systemimg}" = "true" ]; then
	if [ ${disk_enc_enable} -eq 0 ]; then
		APP_TAG+="-e s/APPFILE/${localsysfile}/ ";
	fi;
	if [ "${skip_systemimg}" != "true" ]; then
		sysfile_exist
	else
		if [ ${disk_enc_enable} -eq 0 ]; then
            echo "CUSTOM LOG: FLASH SCRIPT ENTERS HERE!"
			echo "Skip generating ${localsysfile}";
		else
			echo "Skip generating ${localsysbootfile} & ${localsysencrootfile}";
		fi;
	fi;

Then I ran the flash.sh script again as follows:
sudo ./flash.sh jetson-agx-xavier-devkit mmcblk0p1

I see the following on the log:

kernel/dtb/tegra194-p2888-0001-p2822-0000.dtb)... done.
Copying nv_boot_control.conf to rootfs
CUSTOM LOG: THE VALUE OF SKIP_SYSTEMIMG VARAIBLE: true
CUSTOM LOG: THE VALUE OF REUSE SYSTEM IMAGE VARIABLE: 
CUSTOM LOG: FLASH SCRIPT ENTERS HERE!
Skip generating system.img
Not signing of kernel-dtb

The full flash log is attached.
Flash_Log3.txt (69.3 KB)

The modified flash script is also attached (I uploaded it as a text file as the forum doesnt allow me to attach .sh extension files because they are unsupported file extensions for attachment)
flash script.txt (140.0 KB)

So could you trace down why that variable is set to “true” in your case?

CUSTOM LOG: THE VALUE OF SKIP_SYSTEMIMG VARAIBLE: true

Looks like that is why system image didn’t get generated.

I couldn’t find any instance in the flash.sh script where this variable is assigned any value. So I am not sure where the value of ‘true’ comes from. Is there anywhere else these variables are set?

Hi,

I think something else should be clarified first

  1. Is this issue really reproducible on each BSP you use on your side? For example, if you download another package by sdkmanager, will that package also hit this issue?

  2. Does this issue always reproduce with your jeptack5.1.2 for every host PC you could try there? For example, also use jetpack5.1.2 on another PC, will it hit same problem as well?

  3. Does this issue also reproduce on this PC if you use some latest BSP (e.g. jp5.1.4)?

I really don’t think this issue could be easily reproduced on a arbitrary PC, so above could be consider tested first.

As for the flash script checking part,

Only these two condition will set skip_systemimg=“true”;

# check cases where system.img is not needed
if [ ${bup_blob} -eq 1 ] || [ ${rcm_boot} -eq 1 ] \
	|| [ "${no_rootfs}" -eq 1 ] \
	|| [ "${no_systemimg}" -eq 1 ] \
	|| [ "${read_part_name}" != "" ]; then
	skip_systemimg="true";
fi;
# APP partition does not exist
if ! partition_exists_in_PT_table "APP" "${cfgfile}"; then
	skip_systemimg="true";
fi;

As you told this variable is unset in the beginning, it sounds only these two conditions might be related. Please check if it got entered.

Hi.

Regarding your queries, this issue occurs on a specific PC only with release 35.4.1 only. Downloading other releases on the same PC works just fine. I tried deleting everything for 35.4.1 on this PC and download the source files for this version again, but I ran into the same issue.

I understand that this issue is not reproducible on just any PC. It’s most likely an issue in my host PC. However, since this is a server PC, I need to figure out the issue and resolve it. I can’t just use another PC.

The two instances you mentioned where the “skip_systemimg” variable is being assigned true are worth investigating further (I must have missed these when searching in the script earlier). Unfortunately I lost access to the Xavier and the server PC. Will investigate these two instances further as soon as I get the access back.

Just a reminder. You got a typo there. It is 35.4.1 but not 32.4.1.

Apologies. You are right. Its 35.4.1. Corrected it now.

Is this host PC using ubuntu 18.04/20.04?

The host PC is 18.04 ubuntu