Adding a Single Debian Package and a Single File to the Linux File System
- Customize your Linux file system.
- Flash your customized Linux file system image onto the NVIDIA DRIVE® platform.
- Boot up the target platform with your customized Linux file system.
- Verify the added package and the added file on the target.
-
In this example, we have chosen to use the file
${NV_WORKSPACE}/drive-linux/filesystem/content/samples/hello_world.txt
that is part of the NVIDIA DRIVE® OS samples to add to the Linux file system. -
You are, otherwise, welcome to use any other file you want, but the rest of this example will refer to hello_world.txt.
-
Create the CopyTarget Manifest
${NV_WORKSPACE}/drive-linux/filesystem/copytarget/manifest/copytarget-hello.yaml
and add entry to${NV_WORKSPACE}/drive-linux/filesystem/content/samples/hello_world.txt
as shown below. A list of file metadata (perm, owner, group) must be specified to provide detail to describe the file. -
To customize the standard Linux file system, specify the file system variant that the file hello_world.txt is part of. Importantly, you must provide the source location (pdk_sdk_installed_path) and the destination that the file hello_world.txt should reside in the customized Linux file system.
-
As per steps 2 and 3, an example that describes hello_world.txt is provided in the code block below. Copy this excerpt into
${NV_WORKSPACE}/drive-linux/filesystem/copytarget/manifest/copytarget-hello.yaml
.fileList: - destination: /hello_world.txt source: pdk_sdk_installed_path: ${NV_WORKSPACE}/drive-linux/filesystem/content/samples/hello_world.txt perm: 644 owner: root group: root
- Further, in this example, we demonstrate adding a Linux Debian package to the
file system using the Build-FS config. To add a package, an entry must be added
to the
DebianPackages
block of the config file. -
Update the
/opt/nvidia/driveos/common/filesystems/build-fs/17/configs/driveos-example-hello_world-rfs.CONFIG.json
Build-FS config to add the CopyTarget YAML created above in the "CopyTargets" block and the parted Debian package in theDebianPackages
block of the config file.{ "OS": "linux", "Output": "driveos-example-hello_world-rfs", "Base": "${BASE_DIR}/targetfs.img", "Mirrors": [ { "Type": "local_debian_folder", "Path": "${MIRROR_DIR}" } ], "CopyTargets": [ "${COPYTARGETYAML_DIR}/copytarget-hello.yaml" ], "DebianPackages": [ "bsdmainutils" ] }
- Run the build-fs tool using the following commands to create a file system with
preceding customizations. The created file system shall be at path
${NV_WORKSPACE}/drive-linux/filesystem/targetfs-images/driveos-example-hello_world-rfs.img
because of the output name specified in/opt/nvidia/driveos/common/filesystems/build-fs/17/configs/driveos-example-hello_world-rfs.CONFIG.json
. Copy the rebuilt file system to replace the starting file system at${NV_WORKSPACE}/drive-linux/filesystem/targetfs.img
.export PROD_SUFFIX="" export NVRTKERNELNAME="$(basename $NV_WORKSPACE/drive-linux/kernel/preempt_rt${PROD_SUFFIX}/modules/*rt*-tegra)" sudo -E /usr/bin/python3 -B /opt/nvidia/driveos/common/filesystems/build-fs/17/bin/build_fs.py -w ${NV_WORKSPACE}/ -i /opt/nvidia/driveos/common/filesystems/build-fs/17/configs/driveos-linux-example-hello_world-rfs.CONFIG.json -o ${NV_WORKSPACE}/drive-linux/filesystem/targetfs-images/ sudo rm -f ${NV_WORKSPACE}/drive-linux/filesystem/targetfs.img sudo ln -s ${NV_WORKSPACE}/drive-linux/filesystem/targetfs-images/driveos-example-hello_world-rfs.img ${NV_WORKSPACE}/drive-linux/filesystem/targetfs.img
- The NVIDIA DRIVE OS flashing tool bootburn.py PCT picks up the file system by
default at path
${NV_WORKSPACE}/drive-linux/filesystem/targetfs.img
. - Use bootburn.py to flash the file system.
- Reboot the target.
- The target should have rebooted with your customized Linux file system.
- Verify that intended customizations are present:
- Check ls at / path to verify /hello-world.txt exists:
-
$ ls /hello-world.txt
-
- Use the following
hexdump
command to confirm the bsdmainutils package is installed:-
$ hexdump -C /hello-world.txt
-
- Check ls at / path to verify /hello-world.txt exists: