How to Add a Single Debian Package and a Single File to the Linux Filesystem
-
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 DRIVE OS samples to add to the LINUX filesystem.
-
You are, otherwise, welcome to use any other file you desire, but the rest of this example will refer to hello_world.txt.
-
Create a 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.
-
In this example, we customize the standard LINUX filesystem; thus, we need to specify the filesystem variant that the file hello_world.txt is part of. Importantly, we need to provide the source location (pdk_sdk_installed_path) and the destination that the file hello_world.txt should reside in the customized LINUX filesystem.
-
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 filesystem 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 the "DebianPackages" 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 command-line below to create a filesystem with
above customizations. The created filesystem 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.
(FIX config) Copy the rebuilt filesystem to replace the starting filesystem at
${NV_WORKSPACE}/drive-linux/filesystem/targetfs-images/targetfs.img.
$ 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 ln -sf ${NV_WORKSPACE}/drive-linux/filesystem/targetfs-images/driveos-example-hello_world-rfs.img ${NV_WORKSPACE}/drive-linux/filesystem/targetfs-images/targetfs.img
- The DRIVE OS flashing tool bootburn.py PCT picks up filesystem by default at path ${NV_WORKSPACE}/drive-linux/filesystem/targetfs-images/targetfs.img.
- Use bootburn.py to flash the filesystem.
- Reboot the target.
- The target should have rebooted with your customized LINUX filesystem.
- Verify that intended customizations are present:
- Check ls at / path to verify /hello-world.txt exists:
-
$ ls /hello-world.txt
-
- Use the hexdump command below to confirm the bsdmainutils package is
installed:
-
$ hexdump -C /hello-world.txt
-
- Check ls at / path to verify /hello-world.txt exists: