CopyTarget

The CopyTarget tool copies files reliably from a source location to the destination location while maintaining file metadata, which includes ownership and permission.
CopyTarget supports the following operations:
Copy file
Create directory
Update file metadata
Update directory metadata
Remove file
Remove empty directory
Create symlink
Prerequisites
Ubuntu 18.04 x86_64 host
python3 (>= 3.5)
python3-yaml
coreutils
bash

Installing CopyTarget

The CopyTarget tool is packaged and distributed in the Debian software package (.deb) file. The following instructions describe how to download and install CopyTarget.
1. Download nvidia-driveos-<DRIVEOS_RELEASE>-copytarget.deb to your workspace.
2. Install the Debian:
sudo apt install ./nvidia-driveos-<DRIVEOS_RELEASE>-copytarget.deb
CopyTarget is installed on the host at /opt/nvidia/driveos/<DRIVEOS_RELEASE>/filesystems/copytarget/.

Using CopyTarget

Execute CopyTarget:
/opt/nvidia/driveos/<DRIVEOS_RELEASE>/filesystems/copytarget/copytarget.py ${TARGET_DIRECTORY} ${WORKSPACE} MANIFEST.yaml
Where:
<DRIVEOS_RELEASE> is the release version of NVIDIA DRIVE OS.
${TARGET_DIRECTORY} is the destination directory.
${WORKSPACE} is the workspace directory.
MANIFEST.yaml is the manifest file that specifies the file operations to execute.

Command Line Syntax

CopyTarget has the following invocation syntax with the following mandatory and optional arguments. For more information, see Command Argument Options.
copytarget.py ${TARGET_DIRECTORY} ${WORKSPACE} MANIFEST.yaml [MANIFEST1.yaml...] [OPTIONS]
The destination ${TARGET_DIRECTORY}, current workspace ${WORKSPACE}, and an initial manifest must be specified. Optional and additional manifests can be specified and are treated as if the initial manifest imported these additional manifests in its import section.
See Command Argument Options for additional options that can be specified to CopyTarget as part of [OPTIONS].

Command Argument Options

Argument
Description
Required
Default
${TARGET_DIRECTORY}
Destination directory where CopyTarget conducts file operations at.
Required
-
${WORKSPACE}
Source workspace directory where CopyTarget conducts file operations from.
Manifest filepaths are relative to the ${WORKSPACE} path.
Required
-
MANIFEST.yaml
Initial manifest required for CopyTarget to operate on.
Required
-
--version, -v
Prints the version of CopyTarget. If this argument is supplied, CopyTarget does not continue execution after printing the version.
Optional
Not set.
--help, -h
Prints the help message of CopyTarget. If this argument is supplied, CopyTarget does not continue execution after printing the help message.
Optional
Not set.
--user-identifier-dictionary=[FILEPATH]
Specifies the specific user identifier dictionary to use.
The assigned filepath should be the absolute location of the file.
However, relative paths to the ${TARGET_DIRECTORY} can be used if [FILEPATH] does not start with a leading slash "/".
Optional
Not set.
--group-identifier-dictionary=[FILEPATH]
Specifies the specific group identifier dictionary to use.
The assigned filepath should be the absolute location of the file.
However, relative paths to the ${TARGET_DIRECTORY} can be used if [FILEPATH] does not start with a leading slash "/".
Optional
Not set.
--source-type=SOURCETYPE
Specifies the type of source to use.
The assigned sourcetype should be defined in the manifest under "source" field.
Optional
pdk_sdk_installed_path
--filesystem-type=FILESYSTEMTYPE
Filters out the files to be copied to the specified filesystem.
Optional
standard

CopyTarget Manifest

CopyTarget operates on one or more manifest files and at least one must be provided to the tool. Each manifest file contains the source and destination locations of the file, as well as the metadata. Manifests follow YAML syntax, a human-readable data-serialization language.
A manifest is specified by two sections: a header, and a file list. The header and file list serve different roles. In the next section, the roles of these sections are explained in detail.

Header

The header contains information required to process the file list section of the manifest. The header also provides information indicating the compatible CopyTarget software. The header includes the following information as captured and detailed in the table.
Attribute
Description
Required
Default
Domain
Example
version
Defines the list of CopyTarget versions that the manifest is compatible with.
Mandatory
 -
Decimal number
version: '1.4' 
exports
Subsection containing a list of key value pairs. The keys defined in this section are used as variable identifiers and using these keys in the filelist expands them into assigned values.
Optional
Empty list
Key: a valid variable name
Value: any valid YAML assignable value
exports:
- Key1: Value1
- Key2: Value2
imports
Subsection containing a list of additional manifests.
Optional
Empty list
List of zero, one, or more valid and compatible filepaths to additional CopyTarget manifest files.
Filepaths can be absolute or relative to the current manifest file; and this relativity is applied recursively for each nested manifest file.
Imported manifest files are processed first before continued processing of the current manifest; however, exports from the current manifest are processed and forwarded to nested manifests. Defining an export in the current manifest is made visible to the child and grandchild manifests.
imports: 
- manifest1.yaml

Filelist

The filelist section defines an itemized list of files to be copied from source to destination. The list is processed in the order specified in the section. The filelist contains zero, one, or more file sections. Each file section includes the following information as captured and detailed in the table.
Attribute
Description
Required
Default
Domain
Example(s)
destination
Specifies the path of the file, directory, or symlink that needs to be copied to or created in the target directory.
 
The name of the destination file does not need to match the filename specified in the source attribute; when there is a difference, the file will be renamed accordingly.
 
The value specified in destination attribute is relative to ${TARGET_DIRECTORY}, which must be specified to CopyTarget.
Mandatory
-
Valid Linux filepath.
destination:
'/lib/nvidia/lib_nvidia.so'
source
Specifies the source path of a file or symlink that needs to be copied from.
Sources must be specified using a dictionary data type. The key defines the source type and the corresponding value specifies the path. While executing copytarget, the key to be selected is determined by the --source-type parameter.
 
This attribute should not be set when creating a directory or changing the permission of an already existing file or directory.
 
The value specified in source attribute is relative to ${WORKSPACE}, which must be specified to CopyTarget (except when creating symlinks).
Optional
""
Dictionary
Key: Sting
Value: Valid Linux filepath.
source:
pdk_sdk_installed_path: /drive/libnvidia.so
build_tree_path: /lib/libnvidia.so
perm
Specifies the permission of the file or directory in octal notation.
Mandatory
(exception: creating symlinks)
-
Valid Octal notation of Linux permission.
perm: 0777
owner
Specifies the owner identifier of the file, directory, or symlink and can be assigned a numeric UID or a string specifying the username.
 
Strings are converted to numeric UID when a User Identifier Dictionary is provided to CopyTarget, see Identifier Dictionary section.
Mandatory 
-
Valid Linux UID, or UID alias.
owner: root
owner: 0
group
Specifies the group identifier of the file, directory, or symlink and can be assigned a numeric GID or a string specifying the groupname.
 
Strings are converted to numeric GID when a Group Identifier Dictionary is provided to CopyTarget, see Identifier Dictionary section.
Mandatory
-
Valid Linux GID, or GID alias. 
group: root
group: 0
filesystems
Specifies the filesystem types that a file can be copied into.
 
The key specifies the name of filesystem. The value field is a dictionary that defines whether a file can be copied into this filesystem by setting required:yes or required:no. The value field can also define addditional key:values for puropses of bookkeeping. The additional fields are however not processed by CopyTarget.
 
If this field is not defined, the file item is processed for ALL filesystem-types.
Optional
ALL filesystem types
Dictionary
Key: Sting
Value: Dictionary
filesystems:
standard:
required: no
safety:
required: yes
jama: XYZ
create_symlink
If set to true, a symlink is created at the destination location. The symlink points to the value specified in the attribute source.
By default, this field is set to false.
Optional
 false
 true, false
create_symlink: true
remove
If set to true, the file specified in the destination attribute is removed.
If the destination attribute points to a directory, the directory must be empty; otherwise, CopyTarget reports an error; this is intentional and prevents inappropriate deletion.
By default, this field is set to false.
Optional 
 false
 true, false
remove: true

CopyTarget File Operations

CopyTarget supports a limited number of file operations and to have CopyTarget execute a particular operation, a combination of file attributes must be specified. Any invalid combination is raised as an error by CopyTarget and an error message with a pointer to the offending file attribute is presented to the user to resolve.
The following table describes each of the valid operations and the required attributes to trigger the operation.
File Operation
Required Attributes
Example(s)
Copy
Attribute
Requirement
destination
Required.
source
Required (unless an imported manifest already defines it).
perm
Required (unless an imported manifest already defines it).
owner
Required (unless an imported manifest already defines it).
group
Required (unless an imported manifest already defines it).
create_symlink
Can be absent (default is false) or must be set to false.
remove
Can be absent (default is false) or must be set to false.
 
Copy file from ${WORKSPACE}/libraries/lib_nvidia.so to ${TARGET_DIRECTORY}/usr/lib/lib_nvidia.so with ownership root:root and permission 0777; where ${TARGET_DIRECTORY} is the target directory provided to CopyTarget, pdk_sdk_installed_path is the source type, and ${WORKSPACE} is the workspace directory provided to CopyTarget.
Attribute
Value
destination
/usr/lib/lib_nvidia.so
source
pdk_sdk_installed_path: libraries/lib_nvidia.so
perm
0777
owner
root
group
root
create_symlink
false
remove
false
 
Create Directory
 
Attribute
Requirement
destination
Required (must end with a trailing slash; otherwise, an error is reported).
source
Must be absent.
perm
Required (unless an imported manifest already defines it).
owner
Required (unless an imported manifest already defines it).
group
Required (unless an imported manifest already defines it).
create_symlink
Can be absent (default is false) or must be set to false.
remove
Can be absent (default is false) or must be set to false.
 
Create directory at ${TARGET_DIRECTORY}/usr/lib/nvidia/ with ownership root:root and permission 0777; where ${TARGET_DIRECTORY} is the target directory provided to CopyTarget.
Attribute
Value
destination
/usr/lib/nvidia/
source
 
perm
0777
owner
root
group
root
create_symlink
false
remove
false
 
Update File Metadata
Attribute
Requirement
destination
Required.
source
Must be absent.
perm
Required (unless an imported manifest already defines it).
owner
Required (unless an imported manifest already defines it).
group
Required (unless an imported manifest already defines it).
create_symlink
Can be absent (default is false) or must be set to false.
remove
Can be absent (default is false) or must be set to false.
 
Set file ${TARGET_DIRECTORY}/usr/lib/lib_nvidia.so with ownership nvidia:nvidia and permission 0644; where ${TARGET_DIRECTORY} is the target directory provided to CopyTarget.
Attribute
Value
destination
/usr/lib/lib_nvidia.so
source
 
perm
0644
owner
nvidia
group
nvidia
create_symlink
false
remove
false
 
Update Directory Metadata
Attribute
Requirement
destination
Required.
source
Must be absent.
perm
Required (unless an imported manifest already defines it).
owner
Required (unless an imported manifest already defines it).
group
Required (unless an imported manifest already defines it).
create_symlink
Can be absent (default is false) or must be set to false.
remove
Can be absent (default is false) or must be set to false.
 
Set directory ${TARGET_DIRECTORY}/usr/lib/nvidia/ with ownership nvidia:nvidia and permission 0644; where ${TARGET_DIRECTORY} is the target directory provided to CopyTarget.
Note: This operation is not recursive and only updates the metadata of ${TARGET_DIRECTORY}/usr/lib/nvidia/.
Attribute
Value
destination
/usr/lib/nvidia/
source
 
perm
0644
owner
nvidia
group
nvidia
create_symlink
false
remove
false
 
Remove a File
Attribute
Requirement
destination
Required.
source
Should be absent.
perm
Should be absent (if specified, is ignored).
owner
Should be absent (if specified, is ignored).
group
Should be absent (if specified, is ignored).
create_symlink
Should be absent (default is false) or must be set to false.
Setting this to true causes an error to be thrown.
remove
Must be set to true. (unless an imported manifest already defines it).
 
Remove file ${TARGET_DIRECTORY}/usr/lib/lib_nvidia.so; where ${TARGET_DIRECTORY} is the target directory provided to CopyTarget.
Attribute
Value
destination
/usr/lib/lib_nvidia.so
source
-
perm
-
owner
-
group
-
create_symlink
false
remove
true
 
Remove Empty Directory
Attribute
Requirement
destination
Required.
source
Should be absent.
perm
Should be absent (if specified, is ignored).
owner
Should be absent (if specified, is ignored).
group
Should be absent (if specified, is ignored).
create_symlink
Must be set to false (unless an imported manifest already defines it).
Setting this to true causes an error to be thrown.
remove
Must be set to true (unless an imported manifest already defines it).
 
Remove empty directory ${TARGET_DIRECTORY}/usr/lib/nvidia/; where ${TARGET_DIRECTORY} is the target directory provided to CopyTarget.
Attribute
Value
destination
/usr/lib/nvidia/
source
-
perm
-
owner
-
group
-
create_symlink
false
remove
true
 
Create Symlink
Attribute
Requirement
destination
Required.
source
Required (unless an imported manifest already defines it).
perm
Should be absent (if specified, is ignored).
owner
Required (unless an imported manifest already defines it).
group
Required (unless an imported manifest already defines it).
create_symlink
Must be set to true (unless an imported manifest already defines it).
remove
Must be set to false (unless an imported manifest already defines it).
Setting this to true causes an error to be thrown.
 
Create symlink at ${TARGET_DIRECTORY}/usr/lib/lib_nvidia.so.1 pointing to /usr/lib/lib_nvidia.so; where ${TARGET_DIRECTORY} is the target directory provided to CopyTarget.
Attribute
Value
destination
/usr/lib/lib_nvidia.so.1
source
pdk_sdk_installed_path: /usr/lib/lib_nvidia.so
perm
-
owner
nvidia
group
nvidia
create_symlink
true
remove
false
 

Identifier Dictionary

An identifier dictionary must be provided to CopyTarget if username alias and/or groupname alias are to be translated to UID and GID, respectively. Alias is not allowed in CopyTarget file operations due to the potential mismatches between systems. However, alias is permitted in CopyTarget manifests but are translated to numeric identifiers prior to file operation. In order to support translation, username identifier and/or groupname identifier mappings are required.
It is not required to supply both user identifier and group identifier dictionaries; especially, if alias are only used in one of the two categories. If alias is used in both categories, then it is required to provide CopyTarget with both identifier dictionaries. If one or more alias is specified in the manifest but no corresponding identifier dictionary is provided, CopyTarget will throw an error. If an identifier dictionary is provided but the alias is not found within, an error will also be thrown.
Valid identifier dictionaries include any valid password or group files; these are normally, /etc/passwd, and /etc/group, respectively. Any other formatted files are uninterpretable, and an error will be thrown.

Default Identifier Dictionary

When no Identifier Dictionary is specified in the corresponding category (user, or group), CopyTarget will search for any existing Identifier Dictionary relative to the ${TARGET_DIRECTORY} that is specified by the user. The default search paths are ${TARGET_DIRECTORY}/etc/passwd and ${TARGET_DIRECTORY}/etc/group and if any one of these exist, CopyTarget will take the values from these dictionaries.
Occasionally, users may not wish to use the dictionaries residing in the ${TARGET_DIRECTORY}; however, if such dictionaries do exist, CopyTarget will attempt to use them. If the user does not want to use default search paths, the command arguments corresponding to the dictionaries must be provided and pointed to an empty string. This means that one or both argument parameters should be set to empty string as in --user_identifier_dictionary="" and/or --group_identifier_dictionary="".

Host Identifier Dictionary

When CopyTarget is invoked on a ${TARGET_DIRECTORY} intended for the host, the user has the option to use the default identifier dictionaries (/etc/passwd and /etc/group) when ${TARGET_DIRECTORY} is "/", the root most path. This is the ideal situation.
However, if ${TARGET_DIRECTORY} refers to any other subpath location, then the user must invoke CopyTarget with the arguments specifying the host's identifier dictionaries. This is required as the target directory does not make available the identifier dictionaries, unless of course, a different set of identifier dictionaries are to be used, or that the manifest does not contain any user or group name alias; then in this case, it is not required to invoke CopyTarget with such arguments.
The following is an example of executing CopyTarget on a target directory intended for the host but is not in the root most location.
/opt/nvidia/driveos/<DRIVEOS_RELEASE>/filesystems/copytarget/copytarget.py /target_directory/ /workspace/ MANIFEST.yaml --user_identifier_dictionary=/etc/passwd --group_identifier_dictionary=/etc/group
Where:
<DRIVEOS_RELEASE> is the release version of NVIDIA DRIVE OS.

Importing Manifests

Zero, one, or more additional manifests can be specified in the parent manifest. Further nested manifests can also be recursively achieved; since child manifests can have additional manifest imports. This behavior allows for hierarchical overlaying.

Overriding Parent Attributes

Hierarchical manifests allow for child manifests to be overridden, additional attributes to parent to be added, or ancestor manifests.
For example, a given child manifest may define a file attribute to have a permission attribute of 0777 and a parent manifest can override this permission attribute at will with another value such as 0666.

Mapping Overlays using Destination Field

Overlaying of manifests require the use of the destination key. When the destination key matches that of one of the parent manifest's specified file attribute, any values specified in the particular child manifest overlays (overrides) the running set of updated values, which in turn can be updated by another intermediate parent manifest.
Therefore, for overlaying to operate effectively, destination keys must match. Any destination keys that do not match are treated as a new file attribute, with its own set of specified required attributes. One or more missing attributes result in an error.

Sequence of Manifest Overlaying

The sequence of manifest processing is dictated by the ordering specified in the import section of the parent manifest and the processing of this list follows a depth first list.
Consider the following set of manifest examples, which causes the final file attribute to have a resultant value depending on the ordering of the root most manifest (which is provided first to CopyTarget). See the result below.
#manifest0.yaml
imports:
- manifest1a.yaml
- manifest1b.yaml
fileList:
- destination: /destination.txt
source:
pdk_sdk_installed_path: /source.txt
perm: 644
owner: 0
group: 0
 
#manifest1a.yaml
imports:
- manifest2a.yaml
- manifest2b.yaml
fileList:
- destination: /destination.txt
source:
pdk_sdk_installed_path: /source.txt
perm: 644
owner: 1000
group: 1000
 
#manifest2a.yaml
fileList:
- destination: /destination.txt
source:
pdk_sdk_installed_path: /source.txt
perm: 655
owner: 2000
group: 1500
 
#manifest2b.yaml
fileList:
- destination: /destination.txt
source:
pdk_sdk_installed_path: /source2.txt
perm: 777
group: 3000
 
#manifest1b.yaml
fileList:
- destination: /destination2.txt
source:
pdk_sdk_installed_path: /source.txt
perm: 644
owner: 1000
group: 1000
Resultant Table
Starting Manifest
Copied File(s)
Ownership
Permission
manifest0.yaml
1. /source2.txt to /destination.txt
2. /source.txt to /destination2.txt
1. 0:0
2. 1000:1000
1. 0644
2. 0644
manifest1a.yaml
1. /source2.txt to /destination.txt
1. 1000:1000
1. 0644
manifest1b.yaml
1. /source.txt to /destination2.txt
1. 1000:1000
1. 0644
manifest2a.yaml
1. /source.txt to /destination.txt
1. 2000:1500
1. 0655
manifest2b.yaml
Error, because owner attribute is not defined.
-
-

Exports

The exports section can be used for variable dereferencing in the current and child manifests.

Syntax

The syntax follows a key value pair, delimited by a colon. This is follows the standard YAML syntax format. More than one export can be specified. The key must not have any spaces.
For example, the following code statement assigns the value VALUE to the variable named KEY.
exports:
- KEY: VALUE

Dereferencing a Variable

To dereference or otherwise obtain the value stored in a particular key of an export, enclose the name of the variable between opening and closing braces {} and prepended with a dollar sign $.
For example, the variable named KEY can be dereferenced when specified as ${KEY}, as illustrated in the following example, which sets the attribute destination to VALUE.
exports:
- KEY: VALUE
fileList:
- destination: ${KEY}

Overriding Parent Assigned Values

Values assigned previously to a variable from a parent manifest can be overriden by any child manifest and thus taken forward.
Variable assignments are part of the preprocessing step, which means that all variables are assigned the final values prior to iteration of any filelist section. This is intended to prevent variable value aliasing problems.
For example, in the following scenario, the attribute source of destination dest is assigned the value FINAL3, as would the destination dest2. The source attribute of destination dest2 is never assigned the value FINAL2, even though it appears in the intermediate manifest import because of the nature of preprocessing requirement.
#manifest1c.yaml
exports:
- KEY: FINAL1
imports:
- manifest2c.yaml
- manifest2d.yaml
fileList:
- destination: dest
source:
pdk_sdk_installed_path: ${KEY}
#manifest2c.yaml
exports:
- KEY: FINAL2
fileList:
- destination: dest
source:
pdk_sdk_installed_path: ${KEY}
- destination: dest2
source:
pdk_sdk_installed_path: ${KEY}
#manifest2d.yaml
exports:
- KEY: FINAL3
fileList:
- destination: dest
source:
pdk_sdk_installed_path: ${KEY}

Examples: Creating CopyTarget Manifest

Copying a File

The following file attribute instructs CopyTarget to copy the file from ${WORKSPACE}/home/nvidia/file.txt to ${TARGET_DIRECTORY}/file.txt with permission 0644 and ownership nvidia:nvidia, where ${TARGET_DIRECTORY} is the target directory provided to CopyTarget and where ${WORKSPACE} is the workspace directory provided to CopyTarget. Since filesystems field is not defined, this file is copied to ALL filesystem-types.
fileList:
- destination: /file.txt
source:
pdk_sdk_installed_path: /home/nvidia/file.txt
perm: 644
owner: nvidia
group: nvidia

Copying a File to Specific FIleSystem Type

The following file attribute instructs CopyTarget to copy the file from ${WORKSPACE}/home/nvidia/file.txt to ${TARGET_DIRECTORY}/file.txt with permission 0644, and ownership nvidia:nvidia; where ${TARGET_DIRECTORY} is the target directory provided to CopyTarget and where ${WORKSPACE} is the workspace directory provided to CopyTarget. Based on the filesystems field, this file is copied to only "safety" or "safety-debug" filesystem-type.
fileList:
- destination: /file.txt
source:
pdk_sdk_installed_path: /home/nvidia/file.txt
perm: 644
owner: nvidia
group: nvidia
filesystems:
standard:
required: no
safety:
required: yes
jama: DRV5X-STAKEHLDREQPLCL3-2429
safety_debug:
required: yes
jama: DRV5X-STAKEHLDREQPLCL3-2429

Creating a Directory

The following file attribute instructs CopyTarget to create the directory ${TARGET_DIRECTORY}/usr/bin/ with permission 0644 and ownership nvidia:nvidia, where ${TARGET_DIRECTORY} is the target directory provided to CopyTarget.
Note:
If the destination directory already exists, the metadata of the ${TARGET_DIRECTORY}/usr/bin/ is set to values specified, overriding any original values..
fileList:
- destination: /usr/bin/
perm: 644
owner: nvidia
group: nvidia

Updating a File's Metadata

The following file attribute instructs CopyTarget to set the file ${TARGET_DIRECTORY}/file.txt with permission 0644 and ownership nvidia:nvidia, where ${TARGET_DIRECTORY} is the target directory provided to CopyTarget.
fileList:
- destination: /file.txt
perm: 644
owner: nvidia
group: nvidia

Removing a File

The following file attribute instructs CopyTarget to remove the file ${TARGET_DIRECTORY}/file.txt, where ${TARGET_DIRECTORY} is the target directory provided to CopyTarget.
fileList:
- destination: /file.txt
remove: true

Creating a Symlink

The following file attribute instructs CopyTarget to create a symlink at ${TARGET_DIRECTORY}/link.txt that points to /file.txt, where ${TARGET_DIRECTORY} is the target directory provided to CopyTarget.
fileList:
- destination: /link.txt
source:
pdk_sdk_installed_path: /file.txt
create_symlink: true

Comprehensive Example: copytarget-manifest.yaml

An example of a comprehensive copytarget-manifest.yaml looks like the following.
version: '1.4'
 
# Exports environment variables
exports:
- SAMPLES_HOME: /home/nvidia/drive-t186ref-linux/samples/
- FILE_VERSION: 1
 
 
# Itemised file list
fileList:
# The following attribute creates a directory "${TARGET_DIRECTORY}/nvidia/"
# with ownership 0:0 and permission 0755; where ${TARGET_DIRECTORY} is the target directory specified to CopyTarget.
- destination: /nvidia/
perm: 0755
owner: 0
group: 0
filesystems:
standard:
required: yes
safety:
required: yes
jama: DRV5X-STAKEHLDREQPLCL3-2429
safety_debug:
required: yes
jama: DRV5X-STAKEHLDREQPLCL3-2429
 
# The following attribute copies the file from "${WORKSPACE}/home/drive/samples/nvidia_sample"
# to "${TARGET_DIRECTORY}/nvidia/nvidia_sample" with ownership 1000:1000 and permission 0777 when "pdk_sdk_installed_path" source-type is chosen.
# The file is only copied when the chosen filesystem-type is either safety or safety-debug.
- destination: /nvidia/nvidia_sample
source:
pdk_sdk_installed_path: nvidia_sample
build_tree_path: nvidia_sample_internal
perm: 0777
owner: 1000
group: 1000
filesystems:
standard:
required: no
safety:
required: yes
jama: DRV5X-STAKEHLDREQPLCL3-2429
safety_debug:
required: yes
jama: DRV5X-STAKEHLDREQPLCL3-2429
 
# The following attribute creates a symlink at "${TARGET_DIRECTORY}/nvidia_sample_1"
# pointing to "/nvidia/nvidia_sample"; where ${TARGET_DIRECTORY} is the target directory specified to CopyTarget.
# In this example, the symlink is only created for "standard" filesystem.
- destination: /nvidia_sample_${FILE_VERSION}
source:
pdk_sdk_installed_path: /nvidia/nvidia_sample
build_tree_path: /nvidia/nvidia_sample
create_symlink: true
filesystems:
standard:
required: yes
jama: DRV5X-STAKEHLDREQPLCL3-1234
safety:
required: no
safety_debug:
required: no
 
# The following attribute removes file "${TARGET_DIRECTORY}/nvidia/nvidia_sample";
# where ${TARGET_DIRECTORY} is the target directory specified to CopyTarget.
# Since filesystems field is not defined, this item will be process for ALL filesystem-types.
- destination: ${targetdir}/nvidia/nvidia_sample
remove: true

Errors

To enable proper tracking of files and to prevent erroneous file copies, CopyTargetv1.4 enforces the following guidelines. Violations are reported with an error and the line of the offending code.
Fault
Description
Error
Files cannot be copied implicitly.
Copying directories is not permitted.
In case of violation, CopyTarget throws an error saying, for example, Error: CopyTarget does not allow directory to directory copy. Please itemize the files to copy.
Use of wildcards in file names in not permitted.
Wildcard expansion is not permitted.
In case of violation, CopyTarget throws an error saying, for example, FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/*'.
Directory path entries must end with a slash (/).
Directories must end in a trailing slash to differentiate from files.
In case of violation, CopyTarget throws an error saying Error: Directory entries must end with a trailing slash.
Metadata of each file must be defined.
All metadata must be specified.
In case of violation, CopyTarget throws an error saying, for example, Error: Expected key 'owner' is not defined.

DRIVE OS SDK Copytarget Manifests

DRIVE OS SDK ships the copytarget manifest files that contain an itemized list of files in the filesystem and their locations in the SDK. The listing of each manifest .yaml file is as follows:
Copytarget YAML file
Description of copy listings
driveos-core-rfs
driveos-oobe-rfs
copytarget-setup-rootfs
Core DRIVE OS files.
YES
YES
copytarget-configs
DRIVE OS Linux configuration files, services, helper scripts, and library metadata.
YES
YES
copytarget-security
Overlay files to enforce security features on the filesystem.
YES
YES
copytarget-firmware
DRIVE OS Linux platform firmware images and related files from BSP.
YES
YES
copytarget-headers
DRIVE OS Linux graphics opengl, khronos, headers.
YES
YES
copytarget-kernel-modules
DRIVE OS Linux kernel modules: both realtime and standard variant.
YES
YES
copytarget-libraries
DRIVE OS Linux driver and middleware libraries.
YES
YES
copytarget-others
Miscellaneous files added to /root.
YES
YES
copytarget-tools
DRIVE OS Linux tools and applications.
YES
YES
copytarget-dpx
DRIVE OS Linux platform-specific applications, middleware, and services.
YES
YES
copytarget-aurix
DRIVE OS AURIX firmware.
YES
YES
copytarget-samples
DRIVE OS Linux samples for graphics, multimedia, security, and system software modules.
NO
YES