1.. _overview_dev:
2
3Configuration and Development Overview
4######################################
5
6This overview is for developers who are new to ACRN and are responsible for
7configuring and building the hypervisor and the VMs for applications. It will
8introduce you to the general development process, including ACRN components and
9tools.
10
11The overview covers the process at an abstract and universal level.
12
13* Abstract: the overall structure rather than detailed instructions
14* Universal: applicable to most use cases
15
16This overview complements the :ref:`gsg`. The guide provides
17step-by-step instructions to enable an ACRN example for first-time use, while
18the overview provides background information and serves as a gateway to
19additional features and resources that can help you develop your solution.
20
21See :ref:`introduction` for information about ACRN benefits, use cases, and
22architecture.
23
24.. _overview_dev_dev_env:
25
26Development Environment
27***********************
28
29The recommended development environment for ACRN consists of two machines:
30
31* **Development computer** where you configure and build ACRN images
32* **Target system** where you install and run ACRN images
33
34.. image:: ./images/overview_host_target.png
35
36ACRN requires a serial output from the target system to the development computer
37for :ref:`debugging and system messaging <acrn-debug>`. If your target doesn't
38have a serial output, :ref:`here are some tips for connecting a serial output
39<connect_serial_port>`.
40
41You need a way to copy the built ACRN images and other files between the
42development computer and target system. ACRN documentation, such as the
43:ref:`gsg`, offers steps for copying via USB disk as a simple solution.
44
45General Process for Building an ACRN Hypervisor
46***********************************************
47
48The general process for configuring and building an ACRN hypervisor is
49illustrated in the following figure. Additional details follow.
50
51.. image:: ./images/overview_flow-1-0.6x.png
52
53.. _overview_dev_hw_scenario:
54
55|icon_light| Step 1: Select Hardware and Scenario
56*************************************************
57
58.. |icon_light| image:: ./images/icon_light.png
59
60ACRN configuration is hardware and scenario specific. You will need to learn
61about supported ACRN hardware and scenarios, and select the right ones for your
62needs.
63
64Select Your Hardware
65====================
66
67ACRN supports certain Intel processors. Development kits are widely available.
68See :ref:`hardware`.
69
70.. _overview_dev_select_scenario:
71
72Select Your Scenario
73====================
74
75A scenario defines a specific ACRN configuration, such as hypervisor
76capabilities, the type and number of VMs that can be run, their attributes, and
77the resources they have access to.
78
79This image shows an example of an ACRN scenario to illustrate the types of VMs
80that ACRN offers:
81
82.. image:: ./images/ACRN_terms-1-0.75x.png
83
84ACRN offers three types of VMs:
85
86* **Pre-launched User VMs**: These VMs run independently of other VMs and own
87  dedicated hardware resources, such as CPU cores, memory, and I/O devices.
88  Other VMs, including the Service VM, may not even be aware of a pre-launched
89  VM's existence. The configuration of pre-launched VMs is static and must be
90  defined at build time. They are well-suited for safety-critical applications
91  and where very strict isolation, including from the Service VM, is desirable.
92
93* **Service VM**: A special VM, required for scenarios that have post-launched
94  User VMs. The Service VM can access hardware resources directly by running
95  native drivers and provides device sharing services to post-launched User VMs
96  through the :ref:`ACRN Device Model (DM) <hld-devicemodel>` ``acrn-dm``
97  application. The Device Model runs inside the Service VM and is responsible
98  for creating and launching a User VM and then performing device emulation for
99  the devices configured for sharing with that User VM. ACRN supports one
100  Service VM.
101
102* **Post-launched User VMs**: These VMs typically share hardware resources via
103  the Service VM and Device Model. They can also access hardware devices
104  directly if they've been configured as passthrough devices. The configuration
105  of a post-launched VM can be static (defined at build time) or dynamic
106  (defined at runtime without rebuilding ACRN). They are well-suited for
107  non-safety applications, including human machine interface (HMI), artificial
108  intelligence (AI), computer vision, real-time, and others.
109
110The names "pre-launched" and "post-launched" refer to the boot order of these
111VMs. The ACRN hypervisor launches the pre-launched VMs first, then launches the
112Service VM. The Service VM launches the post-launched VMs.
113
114Pre-launched VMs are recommended only if you need complete isolation from the
115rest of the system. Most use cases can meet their requirements without
116pre-launched VMs. Even if your application has stringent real-time requirements,
117start by testing the application on a post-launched VM before considering a
118pre-launched VM.
119
120Scenario Types
121---------------
122
123ACRN categorizes scenarios into :ref:`three types <usage-scenarios>`:
124
125* **Shared scenario:** This scenario represents a traditional computing, memory,
126  and device resource sharing model among VMs. It has post-launched User VMs and
127  the required Service VM. There are no pre-launched VMs in this scenario.
128
129* **Partitioned scenario:** This scenario has pre-launched User VMs only. It
130  demonstrates VM partitioning: the User VMs are independent and isolated, and
131  they do not share resources. For example, a pre-launched VM may not share a
132  storage device with any other VM, so each pre-launched VM requires its own
133  boot device. There is no need for the Service VM or Device Model because all
134  partitioned VMs run native device drivers and directly access their configured
135  resources.
136
137* **Hybrid scenario:** This scenario simultaneously supports both sharing and
138  partitioning on the consolidated system. It has pre-launched VMs and
139  post-launched VMs, along with the Service VM.
140
141While designing your scenario, keep these concepts in mind as you will see them
142mentioned in ACRN components and documentation.
143
144|icon_host| Step 2: Prepare the Development Computer
145****************************************************
146
147.. |icon_host| image:: ./images/icon_host.png
148
149Your development computer requires certain dependencies to configure and build
150ACRN:
151
152* Ubuntu OS (ACRN development is not supported on Windows.)
153* Build tools
154* ACRN hypervisor source code
155* If your scenario has a Service VM: ACRN kernel source code
156
157.. _overview_dev_board_config:
158
159|icon_target| Step 3: Generate a Board Configuration File
160*********************************************************
161
162.. |icon_target| image:: ./images/icon_target.png
163
164The :ref:`board_inspector_tool`, found in the ACRN
165hypervisor source code, enables you to generate a board configuration file on
166the target system.
167
168A **board configuration file** stores hardware-specific information extracted
169from the target system. This XML file describes the capacity of hardware
170resources (such as processors and memory), platform power states, available
171devices, and BIOS settings. The file is used to configure and build the ACRN
172hypervisor, because each hypervisor instance is specific to your target
173hardware.
174
175The following sections provide an overview and important information to keep
176in mind when using the Board Inspector.
177
178Configure BIOS Settings
179=======================
180
181You must configure all of your target's BIOS settings before running the Board
182Inspector tool, because the tool records the current BIOS settings in the board
183configuration file.
184
185ACRN requires the BIOS settings listed in :ref:`gsg-board-setup` of
186the Getting Started Guide.
187
188Use the Board Inspector to Generate a Board Configuration File
189==============================================================
190
191The Board Inspector requires certain dependencies to be present on the target
192system:
193
194* Ubuntu OS
195* Tools and kernel command-line options that allow the Board Inspector to
196  collect information about the target hardware
197
198After setting up the dependencies, you run the Board Inspector via command-line.
199The tool generates the board configuration file specific to your hardware.
200
201.. important:: Whenever you change the configuration of the board, such as BIOS
202   settings or PCI ports, you must generate a new board configuration file.
203
204You will need the board configuration file in :ref:`overview_dev_config_editor`
205and :ref:`overview_dev_build`.
206
207.. _overview_dev_config_editor:
208
209|icon_host| Step 4: Generate a Scenario Configuration File and Launch Scripts
210*****************************************************************************
211
212The :ref:`acrn_configurator_tool` lets you configure your scenario settings via
213a graphical user interface (GUI) on your development computer.
214
215The tool imports the board configuration file that you generated in
216:ref:`overview_dev_board_config`. Then you can configure your scenario, such as
217set hypervisor capabilities, add VMs, modify their attributes, and delete VMs.
218The tool validates your inputs against your board configuration file to ensure
219the scenario is supported by the target hardware. The tool saves your settings
220to a **scenario configuration file** in XML format. You will need this file in
221:ref:`overview_dev_build`.
222
223If your scenario configuration has post-launched User VMs, the tool also
224generates a **launch script** for each of those VMs. The launch script contains
225the settings needed to launch the User VM and emulate the devices configured for
226sharing with that User VM. You will run this script in the Service VM in
227:ref:`overview_dev_install`.
228
229.. _overview_dev_build:
230
231|icon_host| Step 5: Build ACRN
232******************************
233
234The ACRN hypervisor source code provides a makefile to build the ACRN hypervisor
235binary and associated components. In the ``make`` command, you need to specify
236your board configuration file and scenario configuration file. The build
237typically takes a few minutes.
238
239If your scenario has a Service VM, you also need to build the ACRN kernel for
240the Service VM. The ACRN kernel source code provides a predefined configuration
241file and a makefile to build the ACRN kernel binary and associated components.
242The kernel build can take 15 minutes or less on a fast computer, but could take
243an hour or more depending on the performance of your development computer.
244
245.. _overview_dev_install:
246
247|icon_target| Step 6: Install and Run ACRN
248******************************************
249
250The last step is to make final changes to the target system configuration and
251then boot ACRN.
252
253At a high level, you will:
254
255* Copy the built ACRN hypervisor files, Service VM kernel files, and launch
256  scripts from the development computer to the target.
257
258* Configure GRUB to boot the ACRN hypervisor, pre-launched VMs, and Service VM.
259  Reboot the target, and launch ACRN.
260
261* If your scenario contains a post-launched User VM, install an OS image for the
262  post-launched VM and run the launch script you created in
263  :ref:`overview_dev_config_editor`. The script invokes the Service VM's Device
264  Model to create the User VM.
265
266Learn More
267**********
268
269* To get ACRN up and running for the first time, see the :ref:`gsg` for
270  step-by-step instructions.
271
272* If you have already completed the :ref:`gsg` , see the :ref:`develop_acrn` for
273  more information about configuring and debugging ACRN.
274