alliedvision / linux_nvidia_jetson

Allied Vision CSI-2 camera driver for NVIDIA Jetson Systems.
105 stars 41 forks source link

Deploy tarball for Xavier NX target does not work #34

Open l4es opened 2 years ago

l4es commented 2 years ago

Hi again,

I'm still working with master and l4t-32.5.1. When I ran deploy.sh command to generate the tarball for Jetson Xavier NX as target, I got following error :

Generate Multi-Spec BUP Tool

Error: Invalid target board - jetson-nano-devkit. ...

Error: Invalid target board - jetson-nano-devkit-emmc.

...

Error: Invalid target board - jetson-nano-2gb-devkit.

...

Error: Invalid target board - jetson-tx1-devkit.

... t21x payload generation complete with 10 failure(s) ^M FAILURE: error cleaning BUP tmp files^M FAILURE: no payload made for config "boardid=3448;fab=000;boardsku=0000;boardrev=;fuselevel_s=1;chiprev=0;board=jetson-nano-devkit;rootdev=mmcblk0p1"^M FAILURE: no payload made for config "boardid=3448;fab=100;boardsku=0000;boardrev=;fuselevel_s=1;chiprev=0;board=jetson-nano-devkit;rootdev=mmcblk0p1"^M FAILURE: no payload made for config "boardid=3448;fab=200;boardsku=0000;boardrev=;fuselevel_s=1;chiprev=0;board=jetson-nano-devkit;rootdev=mmcblk0p1"^M FAILURE: no payload made for config "boardid=3448;fab=300;boardsku=0000;boardrev=;fuselevel_s=1;chiprev=0;board=jetson-nano-devkit;rootdev=mmcblk0p1"^M FAILURE: no payload made for config "boardid=3448;fab=200;boardsku=0002;boardrev=;fuselevel_s=1;chiprev=0;board=jetson-nano-devkit-emmc;rootdev=mmcblk0p1"^M FAILURE: no payload made for config "boardid=3448;fab=300;boardsku=0002;boardrev=;fuselevel_s=1;chiprev=0;board=jetson-nano-devkit-emmc;rootdev=mmcblk0p1"^M FAILURE: no payload made for config "boardid=3448;fab=300;boardsku=0003;boardrev=;fuselevel_s=1;chiprev=0;board=jetson-nano-2gb-devkit;rootdev=mmcblk0p1"^M FAILURE: no payload made for config "boardid=2180;fab=100;boardsku=;boardrev=;fuselevel_s=1;chiprev=0;board=jetson-tx1-devkit;rootdev=mmcblk0p1"^M FAILURE: error cleaning BUP tmp files cp: cannot stat '/devel/RTR/SW/alliedvision_linux_nvidia_jetson/avt_build/nx-workdir/Linux_for_Tegra/bootloader/payloads_t21x/bl_update_payload': No such file or directory

It seems that NX is not really taken into account in the createDeployTarball() function :

createDeployTarball() { rm -rf "$PATH_TARGET_DEPLOY_TMP_FOLDER" mkdir -p "$PATH_TARGET_DEPLOY_TMP_FOLDER"

    cp "$FILE_INSTALL_SCRIPT" "$PATH_TARGET_DEPLOY_TMP_FOLDER"
    cp "$FILE_KERNEL_IMAGE" "$PATH_TARGET_DEPLOY_TMP_FOLDER"

    if [ "$DEDICATED_BOARD" = "$DEDICATED_BOARD_XAVIER" ]
    then
            #sed -i -e '/REQ_MACHINE=/c\REQ_MACHINE="NVidia Jetson AGX Xavier"' "$PATH_TARGET_DEPLOY_TMP_FOLDER/install.sh"
            #cp "$FILE_DEVICE_TREE_BLOB_XAVIER" "$PATH_TARGET_DEPLOY_TMP_FOLDER"
            (
                    cd ${PATH_TARGET_L4T}
                    ./l4t_generate_soc_bup.sh t19x
            )
            cp ${PATH_TARGET_L4T}/bootloader/payloads_t19x/bl_update_payload "$PATH_TARGET_DEPLOY_TMP_FOLDER"
            sed -i -e '/REQ_MACHINE=/c\REQ_MACHINE="NVidia Jetson Xavier"' "$PATH_TARGET_DEPLOY_TMP_FOLDER/install.sh"

    elif [ "$DEDICATED_BOARD" = "$DEDICATED_BOARD_TX2" ]
    then
            #cp "$FILE_DEVICE_TREE_BLOB_TX2" "$PATH_TARGET_DEPLOY_TMP_FOLDER"
            (
                    cd ${PATH_TARGET_L4T}
                    ./l4t_generate_soc_bup.sh t18x
            )
            cp ${PATH_TARGET_L4T}/bootloader/payloads_t18x/bl_update_payload "$PATH_TARGET_DEPLOY_TMP_FOLDER"
            sed -i -e '/REQ_MACHINE=/c\REQ_MACHINE="NVidia Jetson TX2"' "$PATH_TARGET_DEPLOY_TMP_FOLDER/install.sh"

    else
            (
                    cd ${PATH_TARGET_L4T}
                    ./l4t_generate_soc_bup.sh t21x
            )
            cp ${PATH_TARGET_L4T}/bootloader/payloads_t21x/bl_update_payload "$PATH_TARGET_DEPLOY_TMP_FOLDER"

            #sed -i -e '/REQ_MACHINE=/c\REQ_MACHINE="NVidia Jetson Xavier"' "$PATH_TARGET_DEPLOY_TMP_FOLDER/install.sh"
            #cp "$FILE_DEVICE_TREE_BLOB_NANO_DEVKIT" "$PATH_TARGET_DEPLOY_TMP_FOLDER"
            #cp "$FILE_DEVICE_TREE_BLOB_NANO_PRODUCTION" "$PATH_TARGET_DEPLOY_TMP_FOLDER"
            #cp "$FILE_DEVICE_TREE_BLOB_NANO_2GB" "$PATH_TARGET_DEPLOY_TMP_FOLDER"
            sed -i -e '/REQ_MACHINE=/c\REQ_MACHINE="NVidia Jetson Nano"' "$PATH_TARGET_DEPLOY_TMP_FOLDER/install.sh"
    fi

    if ! (cd "${PATH_TARGET_L4T}/rootfs"; tar -zcvf "${PATH_TARGET_DEPLOY_TMP_FOLDER}/${FILE_DEPLOY_MODULES}" "${RELATIVE_PATH_KERNEL_MODULES}")
    then
            log error "Could not find modules folder! ${PATH_TARGET_DEPLOY_TMP_FOLDER}/${FILE_DEPLOY_MODULES} ${RELATIVE_PATH_KERNEL_MODULES}"
            SUCCESS_FLAG=$FALSE
    else
            if (cd "$PATH_TARGET_DEPLOY" && tar -zcvf "${FNAME}${KR}".tar.gz $(basename "${PATH_TARGET_DEPLOY_TMP_FOLDER}"))
            then
                    log debug "Deploy tarball has been created: ${PATH_TARGET_DEPLOY}/${FNAME}${KR}.tar.gz"
                    SUCCESS_FLAG=$TRUE
            else
                    log error "Could not create tarball with kernel image and device tree files"
                    SUCCESS_FLAG=$FALSE
            fi
    fi

}

It looks like targets other than Xavier and TX2 would be considered as Nano/TX1 (t21x). Do you confirm?

Thanks and best regards, Pascal.

deploy.log

l4es commented 2 years ago

I would say that _l4t_generate_socbup.sh needs to be executed with root permission :

sudo ./l4t_generate_soc_bup.sh t19x

Regards, Pascal

amarburg commented 2 years ago

I can corroborate this, there are a couple of bugs:

In deploy.sh line 382:

    elif check_parameter $2 nx

"nx" isn't quoted. Not sure if this is actually consequential in sh.

Then in createDeployTarball() there's no branch in the if for the NX. I've got it working, I'll post a PR.

l4es commented 2 years ago

Hi @amarburg, I also noticed about the unquoted nx case. I modified it in local as well. Even that, l4t_generate_soc_bup.sh still needs to be executed with root permission.

Best Regards, Pascal.

amarburg commented 2 years ago

Interesting. I'm not running l4t_generate_soc_bup.sh as root.

l4es commented 2 years ago

Hi @amarburg , As per my observation, running l4t_generate_soc_bup.sh as root helps to generate bl_update_payload file as well as to update the dtb (if any change) correctly within the tarball without flashing it separately (by just running the ./install.sh script as in step 5 in the README).

amarburg commented 2 years ago

Hm. I wonder if I'm getting a silent failure when I don't run as root. I'll have to look.