1. Introduction

acontis technologies GmbH provides a Windows service for configuration and restoring of the real-time extension (RtE) environment in some of the following cases:

  • Configuration, preparing and setup of a new PC. Configuring the PC.

  • Restoring of the RtE environment after Windows Updates, modifications, etc.

  • Repairing the system in case of some system failure.

At the current stage the service is delivered as source code for .NET5 and as pre-compiled binaries. The customer can adapt it on own purposes and requirements. The required steps to compile the service is described in chapter Compiling the RtosSystemConfigurationService.

The service contains currently 5 groups of ‘actions’:

  • General RtE environment (like RTE_ROOT envvar, etc)

  • RtosDevice actions

  • bcdedit actions

  • registry actions

  • memcfg actions

Each group consist of some checks and restore options, which will be executed serially. As some actions needs a reboot to be active, at the end of the actions the service will detect, if a reboot is required and will initiate it, if an automatic reboot is configured.

The actions will be performed either:

  • the PC/Windows was booted (if service is auto-started).

  • the service is stopped and manually started again.

Caution

This version of the service contains some hard-coded actions and therefore a custom recompile is needed, if specific changes are desired!

2. Basic Configuration Options

The generic configuration values reside in RtosSystemConfigurationService.xml. This file must be edited to reflect the customer-depend system.

The following assumptions were made:

  • Default user: RTE.

  • Default install path: C:\Program Files\acontis_technologies\.

  • Default AppData user dir: C:\Users\RTE\AppData\.

  • Default installed product: LxWin.

Important

At least the yellow marked lines must be reviewed/edited to match the customer requirements.

<?xml version="1.0" encoding="utf-8"?>
<!-- Rtos System Configuration Service Settings -->
<!-- This file is read only by the configuration service -->
<Settings>
  <!-- =================================================================================================
       Customer-depend settings...
       ================================================================================================= -->

  <!-- CAUTION: Edit this value to reflect the amount of cores, which will be used by Windows.
                Remaining cores will be used by the Rtos(es). -->
  <Setting Key="CpuCountWin" Value="3" /> <!--  -->

  <!-- Customer specific paths... Edit it on behalf... -->
  <Setting Key="WorkspacePath" Value="C:\Users\RTE\AppData\Roaming\acontis_technologies\workspaces\default" /> <!--  -->
  <Setting Key="RteConfigFilePath" Value="C:\Users\RTE\AppData\Roaming\acontis_technologies\workspaces\default\config\startup.config" /> <!--  -->
  <Setting Key="RteImageFilePath" Value="C:\Program Files\acontis_technologies\LxWin\Bin\Linux\x86\lxwinboot.bin" /> <!--  -->

  <!-- =================================================================================================
       System logic settings...
       ================================================================================================= -->
  <!-- Automatic restore/reboot settings! -->
  <Setting Key="AutomaticReboot" Value="True" /> <!--  -->
  <Setting Key="AutomaticRestore" Value="True" /> <!--  -->
  <Setting Key="MaxChainedReboots" Value="3" /> <!-- How many automatic (chained) reboots are allowed to get a running system?-->

  <!-- =================================================================================================
       System settings...
       ================================================================================================= -->
  <!-- Further xml configuraton files for several sections...  -->
  <Setting Key="RtosDevicesFilename" Value="RtosDevices.xml" /> <!--  -->
  <Setting Key="RegEntriesFilename" Value="Registry.xml" /> <!--  -->
  <Setting Key="BcdSettingsFilename" Value="BcdEdit.xml" /> <!--  -->
</Settings>

The customer must edit the following entries to meet his requirements or his system design:

  • CpuCountWin This value reflects the number of cores, which are assigned to Windows. All other remaining cores will be assigned to Rtos or remain free. It depends on the configuration of the RtE system. This value must correspondent with the value configured in the System Manager.

  • WorkspacePath This is the workspace path of the used System Manager configuration.

  • RteConfigFilePath This is path to the used .config file for the RtosUploader. In the normal case this path is part of the workspace path.

  • RteImageFilePath This path reflects the RTOS image, which will be started. [Installed product-depend!]

The following values can be altered, if needed:

  • AutomaticReboot If set then the service will perform an automatic reboot, if some action detects a reboot required state. [default: TRUE]

  • AutomaticRestore If set then the service will perform an automatic restore, if an action detects a misconfiguration. [default: TRUE]

  • MaxChainedReboots The maximum (chained) automatic reboot count. After maximum reached, the reboots are stopped. This value is only valid in conjunction with AutomaticReboot! [default: 3]

3. Logging

The logging is done through following file RtosSystemConfigurationServiceLog.txt residing in the same directory as the service.

The service provides 2 kind of log level logging.

  • Minimal This is the default log level. It provides minimal outputs to the log file.

  • Extended This log level gives verbose information about what is done, including the outputs of the called exe and tools. This level should be used for detailed error detection in failure cases, etc.

Important

The extended log level must be activated in the source code! Go to RtosSystemConfigurationService.cs and comment in //LoggingService.LogLevel = LogLevel.Extended; (approx. line 12) and rebuild project.

4. Basic Service Actions

To get the service installed/uninstalled/started/stopped a cmdline interface is supplied. This section describes the available cmdline actions.

4.1. Install

Run .\RtosSystemConfigurationService.exe install in Admin-CMD/Powershell to install the service. The service will be automatically started at power-up and will perform the needed actions at Windows start-up time.

Hint

For more options about the install, run RtosSystemConfigurationService.exe help!

4.2. Uninstall

Run .\RtosSystemConfigurationService.exe uninstall in Admin-CMD/Powershell to uninstall the service.

Hint

For more options about the uninstall, run RtosSystemConfigurationService.exe help!

4.3. Help

For more information about possible cmd line parameters, please run RtosSystemConfigurationService.exe help in CMD/Powershell.

4.4. Start

Run .\RtosSystemConfigurationService.exe start in Admin-CMD/Powershell to start the service if it is not already running.

Caution

If service is started and therefore the actions are performed, a reboot will be initiated immediately, if automatic reboot is active and a reboot required is detected!

4.5. Stop

Run .\RtosSystemConfigurationService.exe stop in Admin-CMD/Powershell to stop the service if it is running.

5. Check/Restore Service Actions

Some of the actions are currently hard-coded and therefore manual changes at source code level are needed to alter/edit/add/etc. several actions. This should be done only, if needed!

5.1. RtE Environment checks

These actions are hard-coded, as they provide basic checks for the RtE environment. Currently the following checks are done:

  • RTE_ROOT env var available?

  • RtosUpload.exe could be found?

  • Check, if driver directory (%RTE_ROOT%\Drivers\RTOS_Installer.inf) is available.

5.2. RtosDevice actions

All action can be found at the file RtosDevices.xml. Add/alter entries in this file regarding RtosDevices.

<RtosDevices>
...
  <RtosDevice Parameter="" />
...
</RtosDevices>
  • Parameter Contains the RtosDevice parameter string, which will be used. Special care is needed to get a valid string!

Hint

The syntax of the parameter string must be in valid xml notation and must ‘evaluate’ to a valid RtosDevice string.

Important

Some parameter strings need double &quot; and &amp; in device ID’s to be valid! Please check the existing file!

Examples:

<!-- INFO: Devices - ensuring RtE device support -->
<RtosDevice Parameter="-noui rte_install -inf:&quot;&quot;C:\Program Files\acontis_technologies\RteRuntime\Drivers\RTOS_Installer.inf&quot;&quot;" />
<!-- INFO: Devices - ensuring assignment of a network card. -->
<RtosDevice Parameter="-noui rte_add -inf:&quot;&quot;C:\Program Files\acontis_technologies\RteRuntime\Drivers&quot;&quot; @PCI\VEN_8086&amp;DEV_10D3&amp;SUBSYS_07D015AD&amp;REV_00\000C29FFFFFF5E8000" />
<!-- INFO: Devices - ensuring polling mode for the network card. -->
<RtosDevice Parameter="-noui rte_configure -int_mode:1 @PCI\VEN_8086&amp;DEV_10D3&amp;SUBSYS_07D015AD&amp;REV_00\000C29FFFFFF5E8000" />
<!-- INFO: Devices - ensuring assignment of COM1. -->
<RtosDevice Parameter="-noui rte_add -inf:&quot;&quot;C:\Program Files\acontis_technologies\RteRuntime\Drivers&quot;&quot; @ACPI\PNP0501\1" />

5.3. bcdedit actions

Currently ONE action is hard-coded, as the value is configured in the main configuration file. The entry CpuCountWin is processed as a hard-coded action. For more information about this entry please check chapter Basic Configuration Options.

All other actions are configured through BcdEdit.xml, where all calls to bcdedit.exe are handled.

<BcdEntries>
...
  <BcdEntry Store="Current" Property="UsePlatformTick" Value="Yes" MustExist="False" />
...
</BcdEntries>
  • Store Which bcd store should be checked?

  • Property Which property is desired?

  • Value Expected value of the property. The entry will be restored, if the found value differs to the expected value.

  • MustExist The entry must exist. An omitted entry will be added, if this value is true. Otherwise, a missing entry is handled as ok and no further action is needed!

5.4. registry actions

All actions, which affects the registry should be configured in Registry.xml.

<RegEntries>
  <RegEntry Key="HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Power" Value="HiberbootEnabled" Data="0" AsDWORD="True" />
  <RegEntry Key="HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\DeviceGuard" Value="EnableVirtualizationBasedSecurity" Data="0" AsDWORD="True" />
</RegEntries>
  • Key Key of the registry value.

  • Value Value name of the registry entry.

  • Data Desired data value. if value is the same as found value, no action is done, else a restore is performed.

  • AsDWORD Data attribute will be treated as DWORD, if set to True. Otherwise as string.

Caution

if key and/or value is not found, no restore will be done! An omitted value is valid (‘ok’).

5.5. memcfg actions

These actions are hard-coded, because changes herein shouldn’t be needed at all. Parametrization will be done through the main configuration file implicit.

6. Compiling the RtosSystemConfigurationService

6.1. Prerequisites:

  • .NET5

  • Latest Visual Studio 2019

  • Powershell

6.2. Using supplied build.ps1

The distribution package contains a powershell build script build.ps1.

The powershell script will:

1. create the project file
2. restore the nuget packages
3. build debug [and] release version

Open powershell and goto [UNZIP_PACKAGE_FOLDER].

Hint

The [UNZIP_PACKAGE_FOLDER] is the place, where the zip content was unzipped.

Goto sub dir src:

cd .\src

Execute powershell script:

.\build.ps1

Important

The powershell script uses the dotnet tool to perform the needed steps.