Overview
This white paper provides an overview of the features and use cases of the NI LabWindows/CVI Real-Time System Replication functions.
For developers creating real-time or embedded systems, having a consistent software stack – including run-time engines and hardware drivers – is crucial for reducing the maintenance burden associated with deploying code to multiple systems. The process of verifying that all software is identical on each machine can be time-consuming and error-prone. National Instruments offers the Measurement & Automation Explorer (MAX) configuration utility to aid in this process. Additionally, LabWindows/CVI Real-Time provides a light-weight utility that you can use to replicate real-time targets without MAX and an FTP client. You can also fully customize this streamlined utility using the Real-Time System Replication functions available in the LabWindows/CVI Real-Time Module Version 8.5 and later.
Table of Contents
Introduction
Images are useful for restoring a known, working configuration to a system that has become unstable over time. Also, because an image is a complete archive of the files on a system at a given time, saving periodic images can help track system states over time for quality assurance. Saving an image also makes it possible to install or restore drivers and software from a host Windows machine that does not have any drivers or NI Measurement & Automation Explorer (MAX) configuration software installed.
Using images for cloning can also greatly simplify the process of deploying a particular system configuration to multiple production targets. Once you have configured and tested your development system, you can create an image of that system and apply it to any number of unconfigured, identical systems.
Figure 1. Multiple System Replication Scenarios
You can configure the Source and Destination sections to allow for the following use cases:
-
RT Target » Folder – Backing up a target to a folder on the host machine
-
RT Target » RT Target – Replicating one system to another on the same network
-
Folder » RT Target – Deploying a saved image to a target
It is important to remember that you can deploy images only to identical real-time systems. This is due to the fact that different versions of the operating system, driver files, and databases that maintain hardware identification are deployed based on the type of hardware target.
Creating and Storing a Real-Time Image
LabWindows/CVI includes the Real-Time System Replication Utility, which you can use to run on a Windows desktop.
Ordinarily, the development process results in a LabWindows/CVI Real-Time target with the necessary set of drivers and a built executable. For later replication to identical systems, the replication executable stores the image of these drivers and, optionally, the rest of the hard drive contents. To copy the contents of the remote hard drive to the local file system, only a few steps are necessary:
1. Select a LabWindows/CVI Real-Time target to be the source as in the screen capture below. Then, press the adjacent Browse… button to choose a LabWindows/CVI Real-Time target to serve as the master. By selecting "Installed Software Only" here, you generate an image that contains only system files and software packages installed from NI MAX. This option is useful for capturing the NI driver/software configuration of a system without including user programs or other data or output files.

Figure 2. Launch the Real-Time System Imaging Utility
2. Pressing the browse button creates a list of LabWindows/CVI Real-Time targets available on the local subnet, as shown below. The IP address is given to help identify the right remote machine. Choose the machine you would like to replicate and press OK.

Figure 3. Select a Real-Time System
3. Next choose a destination. For this demonstration, use a folder on the local drive. Select the directory in the local file system where you would like to keep the master image. "Require System Match" ensures that the specified image is applied only to the system in which it was created. By default, an image must match only the target system's device code (in other words, hardware model). This option imposes an additional restriction that source and target machines be not only the same model of system but also the same system.

Figure 4. Select the Source and Destination of the Replication
4. Press "Create Image" to begin the replication process. At the end of the process, the Messages window should indicate the process is finished with no errors.

Figure 5. System Replication Completed
Deploying a Stored Real-Time Image
You can deploy the image with a similar process. This program assumes that targets are ready to accept file transfers. This means that they must have valid IP addresses assigned from within MAX, and, for the purposes of this utility, assigned by someone with a copy of MAX and knowledge of setting IP addresses for remote LabWindows/CVI Real-Time targets.
-
Follow the steps above but select Image as the source. Type or browse to the image stored on the local file system.
-
Select RT System as the destination. Either type in the IP address of the desired target or use the Browse… button to interactively select a target.
-
Now press Apply Image to begin the process of copying the previously stored image. Note that you can deploy images only to identical systems.
System Replication Functions
Developers who want to create their own system replication tools with unique customizations should use the following two functions in the System Replication Library shown below.
CreateRTSystemImage()
|
CreateRTSystemImage (IP_ADDRESS, OUTPUT_DIR_PATH, OPTIONS, PROGRESS_CALLBACK, CALLBACK_DATA); |
Creates an image of the target LabWindows/CVI Real-Time system that you can use for system restoration or cloning.
ApplyRTSystemImage()
| ApplyRTSystemImage (IP_ADDRESS, IMAGE_PATH, OPTIONS, PROGESS_CALLBACK, CALLBACK_DATA); |
Applies an image to a target system, replacing its current configuration with that of the image.
View the LabWindows/CVI Help documentation for more detailed information on the system replication functions and associated parameters.
LabWindows/CVI System Query and System Configuration Functions
LabWindows/CVI includes additional real-time System Query and System Configuration functions that you can use with the System Replication Library functions to create custom applications for performing replication, upgrade, or backup operations. Some of these functions include:
FindAllRTSystemsOnSubnet ()
| FindAllRTSystemsOnSubnet (SYSTEMS, NUM_OF_SYSTEMS); |
Discovers all real-time systems present on the local subnet and returns an array of system information pointers (RTSystemInfoPtr) containing information about each target. FindAllRTSystemsOnSubnet finds only systems that are booted and running, though the systems do not need to have IP settings configured or have any software installed. The returned array of pointers contains details about each target found: Name, MAC address, model code, IP address, and more. You can use these to filter the list for certain target models. This is especially useful for automated imaging because an image should be applied only to an identical target.
GetRTSystemInfo ()
| GetRTSystemInfo (IPADDRESS_OR_MAC, AddressType_IP, SYSTEM_INFO); |
Queries a specific real-time system on the network for information about its identity and configuration. Returns the information in a system information pointer ( RTSystemInfoPtr) that includes the system IP settings, MAC address, hostname, serial number, model description, system status, firmware revision, and so on. It is useful for verifying that the IP or MAC address corresponds to the right model, for example.
FormatRTSystem()
| FormatRTSystem (IPADDRESS_OR_MAC, AddressType_IP, OPTIONS, PROGRESS_CALLBACK, CALLBACK_DATA); |
Reformats the system hard drive, completely erasing all data. After you reformat, the target is in an unconfigured state without an IP address and continues to boot into safe mode until you configure the target with software. This can prove useful for targets that may create several files during execution or may need frequent upgrades or application changes.
SetRTIPConfiguration()
|
SetRTIPConfiguration (IPADDRESS_OR_MAC, AddressType_IP, IP_SETTINGS); |
Changes the IP configuration settings of a real-time system. This function can enable or disable DHCP (automatic IP assignment) and set IP, Subnet, Gateway, and DNS addresses. It also applies a hostname to the target. After calling this function and rebooting the target, GetRTSystemInfo returns the assigned IP address, which is especially useful for DHCP, which automatically finds an available IP address and could, therefore, result in unpredictable addresses.
View the LabWindows/CVI Help document for more detailed information on the system replication functions and associated parameters.
Conclusion
You can create a variety of system replication applications using the system replication functions and the examples provided. This is ideal for system integrators who wish to prevent their users from opening or installing MAX, and for any users who intend to duplicate or back up real-time systems.
Additional Resources
-
Introduction to LabWindows/CVI Real-Time (Tutorial)
-
Convert a Desktop PC to a Real-Time Target (Tutorial)
-
Additional Documentation in the LabWindows/CVI 30-Day Evaluation (Software)
The mark LabWindows is used under a license from Microsoft Corporation.
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
