Skip to content

Commit

Permalink
fix(doc): improve documentation readability
Browse files Browse the repository at this point in the history
Signed-off-by: Diogo21Costa <diogoandreveigacosta@gmail.com>
  • Loading branch information
Diogo21Costa committed Dec 6, 2023
1 parent ee5f294 commit fe599cd
Showing 1 changed file with 36 additions and 48 deletions.
84 changes: 36 additions & 48 deletions source/bao_hyp/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ The Bao hypervisor's configuration is managed through a dedicated configuration
in the form of a C source file. This section provides an in-depth description
of the various configuration options available.

The configuration file follows a specific structure, as outlined below:
The configuration file requires a global variable named ``config`` of the type ``struct config``,
which contains two distinct lists: (i) a list of shared memory regions (``shmemlist``) and (ii) a
list of VMs (``vmlist``). While the list of shared memory regions is optional and may be omitted
from the configuration, the list of VMs is mandatory and must include at least 1 VM. Additionally,
for each list, it is necessary to specify the list size using the parameters ``shmemlist_size`` and
``vmlist_size``.

.. code-block:: c
Expand Down Expand Up @@ -38,6 +43,13 @@ The configuration file follows a specific structure, as outlined below:
}
};
.. warning::
Inconsistencies between the specified list sizes (``shmemlist_size`` and
``vmlist_size``) and the actual sizes of their respective lists, may
result in unpredictable behavior. Ensure that any changes made to the
configuration lists' number of elements is reflected in the respective
list size.

Before the configuration itself, it is necessary to declare the VM images using
the ``VM_IMAGE`` macro. This macro directly embeds the guest binary file into
the hypervisor image. Here's an example usage of the ``VM_IMAGE``:
Expand All @@ -54,53 +66,6 @@ The ``VM_IMAGE`` macro has two parameters:
2. A C string with the guest image's binary file path. It can be either an
absolute path or a path relative to the config source file.

The configuration takes the form of a C struct (``struct config``) defining
name ``config``. This struct containing two distinct lists: (i) a list of
shared memory regions (``shmemlist``) and (ii) a list of VMs (``vmlist``).
While the list of shared memory regions is optional and may be omitted from the
configuration, the list of VMs is mandatory and must include at least 1 VM.
Additionally, for each list, it is necessary to specify the list size using the
parameters ``shmemlist_size`` and ``vmlist_size``.

Building Bao Hypervisor
-----------------------
The configuration files for the Bao hypervisor are stored in a designated
folder known as the configuration repository - ``CONFIG_REPO``. By default,
the ``CONFIG_REPO`` is set to the ``configs`` folder located in the top-level
directory of the Bao hypervisor. However, users have the flexibility to specify
a different folder by using the ``CONFIG_REPO`` option in the make command
during the hypervisor building process. For instance, the build command of Bao
follows the nomenclature presented below:

.. code-block:: console
make -C /path/to/bao-dir\
PLATFORM=target-platform\
CONFIG_REPO=/path/to/config\
CONFIG=config-name\
Considering a configuration named ``config-name``, the configuration naming can
be provided in two formats:

**1. Single C Source File**: Save the configuration as a C source file with the
name ``config-name.c``.

**2. Directory Format:**: Alternatively, you can organize it as a directory
named ``config-name`` and place the C source file within, naming it
``config.c``.

In both cases, the build system will search for the configuration in the
specified ``CONFIG_REPO`` using the defined naming convention. This allows
users to seamlessly integrate their custom configurations into the Bao
hypervisor build process.

.. warning::
Inconsistencies between the specified list sizes (``shmemlist_size`` and
``vmlist_size``, respectively) and the actual sizes of the lists, may
result in unpredictable behavior. Ensure that any changes made to the
configuration lists' number of elements is reflected in the respective
list size.

Guests Configuration
--------------------

Expand Down Expand Up @@ -136,3 +101,26 @@ Coloring

Shared Memory Configuration
---------------------------

Configuration File Location
---------------------------

The configuration files for the Bao hypervisor are stored in a designated
folder known as the configuration repository , identified by the make variable ``CONFIG_REPO``. By default,
the ``CONFIG_REPO`` is set to the ``configs`` folder located in the top-level
directory of the Bao hypervisor. However, users have the flexibility to specify
a different folder by setting the ``CONFIG_REPO`` option in the make command
during the hypervisor building process. For instance, a typical build command for Bao
would be:

.. code-block:: console
make PLATFORM=target-platform\
CONFIG_REPO=/path/to/config\
CONFIG=config-name\
Considering a configuration named ``config-name``, the configuration source file can be located in the ``CONFIG_REPO`` directory in two formats:

**1. Single C Source File**: a C source file with the name ``config-name.c``.

**2. Directory Format:**: a directory named ``config-name`` with a single ``config.c`` file within it.

0 comments on commit fe599cd

Please sign in to comment.