Rebuilding the Filesystem from ubuntu-base and Local Mirror

DRIVE OS Linux SDK provides the following additional target-specific components below. These components, along with build-fs and copytarget tools, can be used to rebuild the filesystem starting from the ubuntu-base tarball.
  1. Canonical ubuntu-base tarball: nv-driveos-linux-ubuntu-20.04-base-*_amd64.deb
  2. Canonical arm64 Debian packages: nv-driveos-linux-ubuntu-20.04-arm64-debians-*_amd64.deb
  3. NVIDIA CUDA arm64 Debian packages: cuda-repo-ubuntu2004-11-4-local*arm64.deb
  4. NVIDIA cuDNN arm64 Debian packages: cudnn-prune-87-repo-ubuntu2004-8-2-local*arm64.deb
  5. NVIDIA TensorRT arm64 Debian packages: nv-tensorrt-repo-ubuntu2004-cuda11.4-trt*arm64.deb
  6. NVIDIA Mellanox arm64 Debian packages: nv-driveos-linux-mlnx-docker-arm64-debians-*_amd64.deb
  7. NVIDIA Docker arm64 Debian packages: nv-driveos-linux-mlnx-docker-arm64-debians-*_amd64.deb
  8. NVIDIA DriveWorks arm64 Debian packages: List of Debian packages:
    1. driveworks-v*_drive-linux-*.deb
    2. driveworks_cgf-v*_drive-linux-*.deb
    3. driveworks_cgf_cross-v*_drive-linux-*.deb
    4. driveworks_cgf_samples-v*_drive-linux-*.deb
    5. driveworks_cross-v*_drive-linux-*.deb
    6. driveworks_data-v*_drive-linux-*.deb
    7. driveworks_samples-v*_drive-linux-*.deb
    8. driveworks_stm-v*_drive-linux-*.deb
    9. driveworks_stm_cross-v*_drive-linux-*.deb
    10. driveworks_stm_samples-v*_drive-linux-*.deb
  9. NVIDIA DRIVE OS Core arm64 Debian packages - List of Debian packages:
    1. nv-driveos-linux-aurix_*_arm64.deb

    2. nv-driveos-linux-firmware_*_arm64.deb

    3. nv-driveos-linux-headers_*_arm64.deb

    4. nv-driveos-linux-kernel-modules_*_arm64.deb

    5. nv-driveos-linux-libraries_*_arm64.deb

    6. nv-driveos-linux-samples_*_arm64.deb

    7. nv-driveos-linux-security_*_arm64.deb

    8. nv-driveos-linux-setup-rootfs_*_arm64.deb

    9. nv-driveos-linux-tools_*_arm64.deb

    10. nv-driveos-linux-core_*_arm64.deb

    11. nv-driveos-linux-oobe_*_arm64.deb

The following steps are prerequisites and must be performed before executing the steps to rebuild the filesystem below:
  1. Ensure that DRIVE OS Linux SDK is installed as per the Getting Started page.
  2. Install the build-fs and Copytarget Debian packages to use these tools.
  3. Ensure the NV_WORKSPACE shell variable is set and points to the top directory where DRIVE OS Linux SDK is installed.
  4. Keep the DRIVE OS Linux SDK Debian packages in $NV_WORKSPACE and switch to the following directory:
    cd $NV_WORKSPACE

Steps to rebuild driveos-oobe-desktop-rfs filesystem from ubuntu-base

The rebuilding use case/example requires the use of a local mirror from the target-specific components above. Execute the steps below to set up the local mirror.
  1. Install the driveos-oobe-desktop-rfs SDK package to install its manifest file driveos-oobe-desktop*MANIFEST.json.
    $ sudo -E dpkg -i ./nv-driveos-linux-driveos-oobe-desktop-ubuntu-20.04-rfs-*_amd64.deb
  2. Install Canonical ubuntu-base and arm64 Debian SDK packages:
    $ sudo -E dpkg -i ./nv-driveos-linux-ubuntu-20.04-arm64-debians-<release>-<GCID>_<release>-<GCID>_amd64.deb ./nv-driveos-linux-ubuntu-20.04-base-<release>-<GCID>_<release>-<GCID>_amd64.deb
  3. Install NVIDIA Mellanox and Docker arm64 Debian packages:
    $ sudo -E dpkg -i ./nv-driveos-linux-mlnx-docker-arm64-debians--<release>-<GCID>_<release>-<GCID>_amd64.deb
  4. Copy the NVIDIA CUDA, cuDNN, TensorRT and DriveWorks arm64 Debian packages to $NV_WORKSPACE/drive-linux/filesystem/contents/debians/nvidia/.
  5. Import CUDA bits exported variables by sourcing versions using cmd below:
    $ source ${NVWORKSPACE}/drive-linux/filesystem/contents/debians/versions.conf
  6. Build the final filesystem starting from ubuntu-base:
    $ sudo -E /usr/bin/python3 -B /opt/nvidia/driveos/common/filesystems/build-fs/17/bin/build_fs.py -w ${NV_WORKSPACE}/ -i ${NV_WORKSPACE}/drive-linux/filesystem/targetfs-images/driveos-oobe-desktop-ubuntu-20.04-rfs.MANIFEST.json -o $PWD/output/
Note: To rebuild a filesystem other than driveos-oobe-desktop, provide the corresponding manifest as input instead of driveos-oobe-desktop-ubuntu-20.04-rfs.MANIFEST.json.

Similarly, to install any filesystem manifest, install the corresponding filesystem SDK package.

Rebuilding driveos-oobe-desktop-rfs Filesystem from ubuntu-base Using NVIDIA DRIVE OS Core CopyTarget YAML Manifests

This section provides an example to rebuild the Linux RFS using the DRIVE OS Core CopyTarget YAML manifests from ${NV_WORKSPACE}/drive-linux/filesystem/copytarget/manifest/*.yaml to copy the Core files instead of obtaining them from the NVIDIA DRIVE OS Core Debian packages.

This is useful when you have modified the Core files on your host and want to copy them to the filesystem without rebuilding the NVIDIA DRIVE OS Core Debian packages.

Note: If you instead wish to add additional files to an already available filesystem, follow the instructions in How to Add a Single Debian Package and a Single File to the Linux Filesystem.
  1. Install the driveos-oobe-desktop-rfs SDK package to install its manifest file driveos-oobe-desktop*MANIFEST.json.

    $ sudo -E dpkg -i
                  ./nv-driveos-linux-driveos-oobe-desktop-ubuntu-20.04-rfs-*_amd64.deb
  2. Install Canonical ubuntu-base and arm64 Debian SDK packages:

    $ sudo -E dpkg -i ./nv-driveos-linux-ubuntu-20.04-arm64-debians-*_amd64.deb
                  ./nv-driveos-linux-ubuntu-20.04-base-*_amd64.deb
  3. Install NVIDIA Mellanox and Docker arm64 Debian packages:

    $ sudo -E dpkg -i
              ./nv-driveos-linux-mlnx-docker-arm64-debians-*_amd64.deb
  4. Copy the NVIDIA CUDA, cuDNN, TensorRT and DriveWorks arm64 Debian packages to $NV_WORKSPACE/drive-linux/filesystem/contents/debians/nvidia/.

  5. Import CUDA bits exported variables by sourcing versions using cmd below:

    $ set -a
    $ source
                  ${NV_WORKSPACE}/drive-linux/filesystem/contents/debians/versions.conf
    $ set +a
  6. Update ${NV_WORKSPACE}/drive-linux/filesystem/targetfs-images/driveos-oobe-desktop-ubuntu-20.04-rfs.MANIFEST.json to remove DRIVE OS Core Debian packages.

    $ sed -i
                  '/nv-driveos-linux-\(aurix\|core\|firmware\|headers\|kernel-modules\|libraries\|oobe\|samples\|security\|setup-rootfs\|tools\).*/d'
                  ${NV_WORKSPACE}/drive-linux/filesystem/targetfs-images/driveos-oobe-desktop-ubuntu-20.04-rfs.MANIFEST.json
  7. Update ${NV_WORKSPACE}/drive-linux/filesystem/targetfs-images/driveos-oobe-desktop-ubuntu-20.04-rfs.MANIFEST.json to use the DRIVE OS Core CopyTarget YAML manifests. You may update the “CopyTarget” key in the Build-FS manifest manually to include the YAML manifests from ${NV_WORKSPACE}/drive-linux/filesystem/copytarget/manifest/*.yaml or use the following singlecommand (note that this is one single command that can be pasted into your bash terminal):

    python3 -B - << END
    import json
    from collections import OrderedDict
    bkConfig = OrderedDict()
    manifest="${NV_WORKSPACE}/drive-linux/filesystem/targetfs-images/driveos-oobe-desktop-ubuntu-20.04-rfs.MANIFEST.json"
    with open(manifest) as f:
        data = f.read()
    bkConfig = json.loads(data, object_pairs_hook=OrderedDict)
    bkConfig["CopyTargets"] = [
        "\${COPYTARGETYAML_DIR}/copytarget-configs.yaml",
        "\${COPYTARGETYAML_DIR}/copytarget-aurix.yaml",
        "\${COPYTARGETYAML_DIR}/copytarget-aurix.yaml",
        "\${COPYTARGETYAML_DIR}/copytarget-firmware.yaml",
        "\${COPYTARGETYAML_DIR}/copytarget-headers.yaml",
        "\${COPYTARGETYAML_DIR}/copytarget-kernel-modules.yaml",
        "\${COPYTARGETYAML_DIR}/copytarget-libraries.yaml",
        "\${COPYTARGETYAML_DIR}/copytarget-samples.yaml",
        "\${COPYTARGETYAML_DIR}/copytarget-security.yaml",
        "\${COPYTARGETYAML_DIR}/copytarget-setup-rootfs.yaml",
        "\${COPYTARGETYAML_DIR}/copytarget-tools.yaml"
    ]
    with open(manifest, 'w') as f:
        f.write(json.dumps(bkConfig, indent=4, sort_keys=False))
    END
    
  8. Build the final filesystem starting from ubuntu-base:
    $ sudo -E /usr/bin/python3 -B /opt/nvidia/driveos/common/filesystems/build-fs/17/bin/build_fs.py -w ${NV_WORKSPACE}/ -i ${NV_WORKSPACE}/drive-linux/filesystem/targetfs-images/driveos-oobe-desktop-ubuntu-20.04-rfs.MANIFEST.json -o $PWD/output/