Skip to content

Commit dc135bd

Browse files
Geoffroy Van Cutsemjren1
authored andcommitted
Documentation: tutorial on how to use Ubuntu as the SOS
Add a tutorial explaining how to use Ubuntu as the Service OS running on ACRN and providing all the device sharing services (devicemodel) and tools to manage virtual machines. Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com> Signed-off-by: Ailin Yang <ailin.yang@intel.com>
1 parent bf5088e commit dc135bd

File tree

1 file changed

+272
-0
lines changed

1 file changed

+272
-0
lines changed

doc/tutorials/using_ubuntu_as_sos.rst

Lines changed: 272 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,272 @@
1+
.. _Ubuntu Service OS:
2+
3+
Using Ubuntu as the Service OS
4+
##############################
5+
6+
This document builds on the :ref:`getting_started`, and explains how to use
7+
Ubuntu instead of using `Clear Linux`_ as the Service OS with the ACRN
8+
hypervisor. (Note that different OSes can be used for the Service and User OS.)
9+
In the following instructions we'll build on material in the
10+
:ref:`getting-started-apl-nuc`.
11+
12+
Install Ubuntu (natively)
13+
*************************
14+
15+
Ubuntu 16.04.4 LTS was used throughout this document, other versions such as
16+
18.04 may work too.
17+
18+
* Download Ubuntu 16.04 from the `Ubuntu 16.04.4 LTS (Xenial Xerus) page
19+
<https://www.ubuntu.com/download/desktop>`_ and select the `ubuntu-16.04.4-desktop-amd64.iso
20+
<http://releases.ubuntu.com/16.04/ubuntu-16.04.4-desktop-amd64.iso>`_ image.
21+
22+
* Follow Ubuntu's `online instructions <https://tutorials.ubuntu.com/tutorial/tutorial-install-ubuntu-desktop?_ga=2.114179015.1954550575.1530817291-1278304647.1523530035>`_
23+
to install it on your device.
24+
25+
.. note::
26+
Configure your device's proxy settings to have full internet access.
27+
28+
* While not strictly required, enabling SSH gives the user a very useful
29+
mechanism for accessing the Service OS remotely or when running one or more
30+
User OS (UOS). Follow these steps to enable it on the Ubuntu SOS:
31+
32+
.. code-block:: console
33+
34+
sudo apt-get install openssh-server
35+
sudo service ssh status
36+
sudo service ssh start
37+
38+
Install ACRN
39+
************
40+
41+
ACRN components are distributed in source form, so you'll need to download
42+
the source code, build it, and install it on your device.
43+
44+
1. Install the build tools and dependencies
45+
46+
Follow the instructions found in the :ref:`getting-started-apl-nuc` to
47+
install all the build tools and dependencies on your system.
48+
49+
#. Clone the `Project ACRN <https://github.com/projectacrn/acrn-hypervisor>`_
50+
code repository
51+
52+
.. code-block:: console
53+
54+
cd ~
55+
git clone https://github.com/projectacrn/acrn-hypervisor
56+
git checkout <known-good-tag/release>
57+
58+
.. note::
59+
We clone the git repository below but it is also possible to download the
60+
tarball for any specific tag or release from the `Project ACRN Github
61+
release page <https://github.com/projectacrn/acrn-hypervisor/releases>`_
62+
63+
#. Build and install ACRN
64+
65+
Here is the short version of how to build and install ACRN from source.
66+
67+
.. code-block:: console
68+
69+
cd ~/acrn-hypervisor
70+
make PLATFORM=uefi
71+
sudo make install
72+
73+
For more details, please refer to the :ref:`getting_started`.
74+
75+
#. Install the hypervisor
76+
77+
The ACRN devicemodel and tools were installed as part of the previous step.
78+
However, ``make install`` does not install the hypervisor (``acrn.efi``) on
79+
your EFI System Partition (ESP), nor does it configure your EFI firmware to
80+
boot it automatically. Follow the steps below to perform these operations
81+
and complete the ACRN installation.
82+
83+
#. Mount the EFI System Partition (ESP) and add the ACRN hypervisor and
84+
Service OS kernel to it (as ``root``)
85+
86+
.. code-block:: console
87+
88+
sudo umount /boot/efi
89+
sudo lsblk
90+
sudo mount /dev/sda1 /mnt
91+
ls /mnt/EFI/ubuntu
92+
93+
You should see the following output:
94+
95+
.. code-block:: none
96+
97+
fw fwupx64.efi grub.cfg grubx64.efi MokManager.efi shimx64.efi
98+
99+
#. Install the hypervisor (``acrn.efi``)
100+
101+
.. code-block:: console
102+
103+
sudo mkdir /mnt/EFI/acrn/
104+
sudo cp ~/acrn-hypervisor/build/hypervisor/acrn.efi /mnt/EFI/acrn
105+
106+
#. Configure the EFI firmware to boot the ACRN hypervisor by default
107+
108+
.. code-block:: console
109+
110+
sudo efibootmgr -c -l "\EFI\acrn\acrn.efi" -d /dev/sda -p 1 \
111+
-L "ACRN Hypervisor" -u "bootloader=\EFI\ubuntu\grubx64.efi"
112+
# Verify that the "ACRN Hypervisor" will be booted first
113+
sudo efibootmgr -v
114+
115+
You can change the boot order at any time using ``efibootmgr
116+
-o XXX,XXX,XXX``
117+
118+
.. note::
119+
By default, the “ACRN Hypervisor” you have just added should be
120+
the first one to boot. Verify this by using ``efibootmgr -v`` or
121+
by entering the EFI firmware at boot (using :kbd:`F10`)
122+
123+
Install the Service OS kernel
124+
*****************************
125+
126+
You can download latest Service OS kernel from
127+
`<https://download.clearlinux.org/releases/current/clear/x86_64/os/Packages/>`_
128+
(**We need to update the URL to one that is known to work, and matches the
129+
tag/release we use above!!!**). We will extract it and install it in the next
130+
few steps.
131+
132+
a. Download and extract the Service OS kernel
133+
134+
.. code-block:: console
135+
136+
mkdir ~/kernel-build
137+
cd ~/kernel-build
138+
wget https://download.clearlinux.org/releases/current/clear/x86_64/os/Packages/linux-pk414-sos-4.14.41-39.x86_64.rpm
139+
sudo apt-get install rpm2cpio
140+
rpm2cpio linux-pk414-sos-4.14.41-39.x86_64.rpm | cpio -idmv
141+
142+
#. Install the SOS kernel and its drivers (modules)
143+
144+
.. code-block:: console
145+
146+
sudo cp -r ~/kernel-build/usr/lib/modules/4.14.41-39.pk414-sos/ /lib/modules/
147+
sudo cp ~/kernel-build/usr/lib/kernel/org.clearlinux.pk414-sos.4.14.41-39 /boot/acrn/
148+
149+
#. Configure Grub to load the Service OS kernel
150+
151+
* Modify the ``/etc/grub.d/40_custom`` file to create a new Grub entry that
152+
will boot the SOS kernel.
153+
154+
.. code-block:: none
155+
156+
menuentry 'ACRN ubuntu SOS' {
157+
recordfail
158+
load_video
159+
insmod gzio
160+
insmod part_gpt
161+
insmod ext4
162+
linux /boot/acrn/org.clearlinux.pk414-sos.4.14.41-39 pci_devices_ignore=(0:18:1) maxcpus=1 console=tty0 console=ttyS0
163+
i915.nuclear_pageflip=1 root=PARTUUID=<ID of rootfs partition> rw rootwait ignore_loglevel no_timer_check consoleblank=0
164+
i915.tsd_init=7 i915.tsd_delay=2000 i915.avail_planes_per_pipe=0x00000F i915.domain_plane_owners=0x011111110000
165+
i915.enable_guc_loading=0 i915.enable_guc_submission=0 i915.enable_preemption=1 i915.context_priority_mode=2
166+
i915.enable_gvt=1 hvlog=2M@0x1FE00000
167+
}
168+
169+
.. note::
170+
You need to adjust this to use your partition UUID (``PARTUUID``) for
171+
the ``root=`` parameter (or use the device node directly).
172+
173+
.. note::
174+
You will also need to adjust the kernel name if you used a different
175+
RPM file as the source of your Service OS kernel.
176+
177+
* Update Grub on your system
178+
179+
.. code-block:: console
180+
181+
sudo update-grub
182+
183+
At this point, you need to modify ``/boot/grub/grub.cfg`` file manually to
184+
enable the timeout so that the system has an opportunity to show you the
185+
grub menu. (Without this the grub choice menu won't display.)
186+
187+
.. code-block:: none
188+
189+
#set timeout_style=hidden
190+
set timeout = 10
191+
192+
#. Reboot the system
193+
194+
Reboot system. You should see the Grub menu with the new “ACRN ubuntu SOS”
195+
entry. Select it and proceed to booting the platform. The system will start
196+
the Ubuntu Desktop and you can now log in (as before).
197+
198+
To check if the hypervisor is effectively running, check ``dmesg``. The
199+
typical output of a successful installation will look like this:
200+
201+
.. code-block:: none
202+
203+
dmesg | grep ACRN
204+
[ 0.000000] Hypervisor detected: ACRN
205+
[ 0.862942] ACRN HVLog: acrn_hvlog_init
206+
207+
Prepare the User OS (UOS)
208+
*************************
209+
210+
We are using a User OS based on `Clear Linux`_.
211+
212+
* Download the Clear Linux image from `<https://download.clearlinux.org>`_
213+
214+
.. code-block:: console
215+
216+
cd ~
217+
wget https://download.clearlinux.org/releases/22780/clear/clear-22780-kvm.img.xz
218+
unxz clear-22780-kvm.img.xz
219+
220+
* Download the Production Kenrel (PK) kernel
221+
222+
.. code-block:: console
223+
224+
wget https://download.clearlinux.org/releases/22780/clear/x86_64/os/Packages/linux-pk414-standard-4.14.47-44.x86_64.rpm
225+
rpm2cpio linux-pk414-standard-4.14.47-44.x86_64.rpm | cpio -idmv
226+
227+
* Update the UOS kernel modules
228+
229+
.. code-block:: console
230+
231+
sudo losetup -f -P --show /root/clear-22789-kvm.img
232+
sudo mount /dev/loop0p3 /mnt
233+
sudo cp -r /root/usr/lib/modules/4.14.47-44.pk414-standard /mnt/lib/modules/
234+
sudo cp -r /root/usr/lib/kernel /lib/modules/
235+
sudo umount /mnt
236+
sync
237+
238+
If you encounter a permission issue, follow these steps:
239+
240+
.. code-block:: console
241+
242+
sudo chmod 777 /dev/acrn_vhm
243+
244+
* One additional package is needed
245+
246+
.. code-block:: console
247+
248+
sudo apt-get instal iasl
249+
sudo cp /usr/bin/iasl /usr/sbin/iasl
250+
251+
* Adjust ``launch_uos.sh``
252+
253+
You need to adjust the ``/usr/share/acrn/samples/nuc/launch_uos.sh`` script
254+
to match your installation. These are the couple of lines you need to modify:
255+
256+
.. code-block:: none
257+
258+
-s 3,virtio-blk,/root/clear-22780-kvm.img
259+
-k /lib/modules/kernel/org.clearlinux.pk414-standard.4.14.47-44
260+
261+
Start the User OS (UOS)
262+
***********************
263+
264+
You are now all set to start the User OS (UOS)
265+
266+
.. code-block:: console
267+
268+
sudo /usr/share/acrn/samples/nuc/launch_uos.sh
269+
270+
**Congratulations**, you are now watching the User OS booting up!
271+
272+
.. _Clear Linux: https://clearlinux.org

0 commit comments

Comments
 (0)