Skip to the main content.

2 min read

Using and Sharing RAM Disks in LYNXOS-178

Based on several customers inquiries the purpose of this blog is to outline how to 

  • Allocate memory to a RAM disk
  • Mount and unmount a RAM disk
  • Create a shared read-only RAM disk between two subjects

allocating memory to a ram disk

The root file system is commonly a RAM disk that is a shared resource, potentially across multiple partitions inside the LynxOS-178 operating system. Because it's a shared resource, it is configured to be read-only. To provide a read-write RAM disk to each partition, a private RAM disk is allocated to each partition and mounted as the partition’s /tmp directory.

The size of the RAM disk is specified in the VCT file. The amount of memory for this comes from the total amount allocated to the partition. One can adjust the partition’s private RAM disk through the VCT file. This is a simple way to create more RAM disk space. Customers carry large payloads, such as another LynxOS-178 image in the RAM disk (for example: to run FITP protocols discussed in another blog), so adjusting the RAM disk’s size is a common practice. A simple change to the VCT file and a reboot will provide a LynxOS-178 subject with a new-sized RAM disk.

File system images (lynxfs) can be created using the host development utility mkimage. When a LynxOS-178 (or indeed LynxElement) Kernel Downloadable Image (KDI) is designed with “make all”, the mkimage utility is run. This takes the .spec file in LynxOS-178 and creates the RAM disk for the root file system. That RAM disk is then appended to the kernel itself (a.out) and is used to create the KDI file or MDI file depending on the headers that are appended. 

mounting vs. unmounting

There are several command line utilities and APIs which can be used in both “dev” and “production” mode.

  • “dd”; Perform read/write operations to/from files and devices (which are POSIX file system nodes)
  • “mount” and “unmount”; As the names suggest, these utilities and like-named API calls are used by apps to mount and unmount devices
  • “rdc”; A wrapper for the RAM disk driver’s ioctl() functions. There are three ioctl calls:
    • One to allocate memory to a RAM disk
    • One to deallocate memory
    • One to glean information about the different RAM disks that are connected

How can these be used?

The image to the right shows the steps that can be taken to load a RAM disk with a lynxfs image. More specifically, this shows how to allocate one megabyte of memory to this particular RAM disk (in this case, raw RAM disk seven).


loading a ramdisk

 

Setting Up A Shared RAM Disk

Let’s look at how to set up a RAM disk that is shared between two subjects. The subjects only have read-only access to the shared memory region. The Lynx Simple Application (LSA) has read-write access. We deliver a new image up to the LSA using the FIFO Image Transfer Protocol (FITP) down into the shared memory region, mount the file systems and create the shared read-only RAM disk. 

FITP uses lock-step messages to issue commands to the receiver and transfer data between subjects. It has commands to overwrite or zeros the boot image regions of the LynxOS-178 (or LynxElement) subjects. It also supports commands to stop, restart, pause and resume subjects. Finally, there are commands to change the scheduling policy of LynxSecure

ram disks subjects

In order to do this, the shared memory region must be declared in the autoconfig script, so it is identifiable by the LynxOS-178 subjects, meaning that:

  • The LynxOS-178 subjects must have access to the memory region
  • The shared memory region must be mapped to a fixed guest physical address (GPA)

The RAM disk driver of each LynxOS-178 instance needs to have an entry for the RAM disk’s GPA and size. By adding an entry to the LynxOS-178’s VCT file, the RAM disk can autoload on boot.

The image to the right shows the specific commands we use to initiate the creation of this shared RAM disk.

Let's connect or continue the conversation! If you have questions or comments, don't hesitate to reach out. Just fill out your details in the form below. 

Screenshot (280)

 

Adjusting System Functionality and Capabilities in LYNX MOSA.ic

Adjusting System Functionality and Capabilities in LYNX MOSA.ic

I recently set up a demo to showcase how a customer can use subjects, also known as rooms, like containers. What I mean by that is that software...

Read More
Using and Sharing RAM Disks in LYNXOS-178

Using and Sharing RAM Disks in LYNXOS-178

Based on several customers inquiries the purpose of this blog is to outline how to Allocate memory to a RAM disk Mount and unmount a RAM disk ...

Read More
IMPORTANCE OF SYSTEM ARCHITECTURE AND PLATFORM CHOICE ON SAFETY CERTIFICATION

IMPORTANCE OF SYSTEM ARCHITECTURE AND PLATFORM CHOICE ON SAFETY CERTIFICATION

Not many companies have the expertise to build software to meet the DO-178C (Aviation), IEC61508 (Industrial), or ISO26262 (Automotive) safety...

Read More