doc: clean up the docs in try using acrn table.

Move acrn_ootb / building_acrn_in_docker / up2 gsg to the
develop using acrn guide;

Signed-off-by: lirui34 <ruix.li@intel.com>
This commit is contained in:
lirui34
2019-11-07 17:55:10 +08:00
committed by David Kinder
parent cc7bf1a506
commit 705ba86da2
8 changed files with 3 additions and 3 deletions

View File

@@ -1,531 +0,0 @@
.. _acrn_ootb:
Install ACRN Out-of-the-box
###########################
In this tutorial, we will learn to generate an out-of-the-box (OOTB) Service VM or a Preempt-RT VM image so that we can use ACRN or RTVM immediately after installation without any configuration or modification.
Set up a Build Environment
**************************
#. Follow the `Clear Linux OS installation guide
<https://clearlinux.org/documentation/clear-linux/get-started/bare-metal-install-server>`_
to install a native Clear Linux OS on a development machine.
#. Log in to the Clear Linux OS and install these bundles::
$ sudo swupd bundle-add clr-installer vim network-basic
.. _set_up_ootb_service_vm:
Generate a Service VM image
***************************
Step 1: Create a Service VM YAML file and script
================================================
**Scenario 1: ACRN SDC**
#. Create the ACRN SDC ``service-os.yaml`` file:
.. code-block:: none
$ mkdir -p ~/service-os && cd ~/service-os
$ vim service-os.yaml
Update the ``service-os.yaml`` file to:
.. code-block:: bash
:emphasize-lines: 51
block-devices: [
{name: "bdevice", file: "sos.img"}
]
targetMedia:
- name: ${bdevice}
size: "108.54G"
type: disk
children:
- name: ${bdevice}1
fstype: vfat
mountpoint: /boot
size: "512M"
type: part
- name: ${bdevice}2
fstype: swap
size: "32M"
type: part
- name: ${bdevice}3
fstype: ext4
mountpoint: /
size: "108G"
type: part
bundles: [
bootloader,
editors,
network-basic,
openssh-server,
os-core,
os-core-update,
sysadmin-basic,
systemd-networkd-autostart,
service-os
]
autoUpdate: false
postArchive: false
postReboot: false
telemetry: false
hostname: clr-sos
keyboard: us
language: en_US.UTF-8
kernel: kernel-iot-lts2018-sos
post-install: [
{cmd: "${yamlDir}/service-os-post.sh ${chrootDir}"},
]
version: 30970
.. note:: Update the version value to your target Clear Linux version.
#. Create the ACRN SDC ``service-os-post.sh`` script:
.. code-block:: none
$ vim service-os-post.sh
Update the ``service-os-post.sh`` script to:
.. code-block:: bash
#!/bin/bash
# ACRN SOS Image Post Install steps
set -ex
CHROOTPATH=$1
# acrn.efi path
acrn_efi_path="$CHROOTPATH/usr/lib/acrn/acrn.efi"
# copy acrn.efi to efi partition
mkdir -p "$CHROOTPATH/boot/EFI/acrn" || exit 1
cp "$acrn_efi_path" "$CHROOTPATH/boot/EFI/acrn" || exit 1
# create load.conf
echo "Add default (5 seconds) boot wait time"
echo "timeout 5" >> "$CHROOTPATH/boot/loader/loader.conf" || exit 1
chroot $CHROOTPATH systemd-machine-id-setup
chroot $CHROOTPATH systemctl enable getty@tty1.service
echo "Welcome to the Clear Linux* ACRN SOS image!
Please login as root for the first time!
" >> $1/etc/issue
exit 0
**Scenario 2: ACRN INDUSTRY**
#. Create the ACRN INDUSTRY ``service-os-industry.yaml`` file:
.. code-block:: none
$ mkdir -p ~/service-os-industry && cd ~/service-os-industry
$ vim service-os-industry.yaml
Update the ``service-os-industry.yaml`` file to:
.. code-block:: bash
:emphasize-lines: 52
block-devices: [
{name: "bdevice", file: "sos-industry.img"}
]
targetMedia:
- name: ${bdevice}
size: "108.54G"
type: disk
children:
- name: ${bdevice}1
fstype: vfat
mountpoint: /boot
size: "512M"
type: part
- name: ${bdevice}2
fstype: swap
size: "32M"
type: part
- name: ${bdevice}3
fstype: ext4
mountpoint: /
size: "108G"
type: part
bundles: [
bootloader,
editors,
network-basic,
openssh-server,
os-core,
os-core-update,
sysadmin-basic,
systemd-networkd-autostart,
service-os
]
autoUpdate: false
postArchive: false
postReboot: false
telemetry: false
hostname: clr-sos
keyboard: us
language: en_US.UTF-8
kernel: kernel-iot-lts2018-sos
post-install: [
{cmd: "${yamlDir}/service-os-industry-post.sh ${chrootDir}"},
]
version: 30970
.. note:: Update the version value to your target Clear Linux version.
#. Create the ``service-os-industry-post.sh`` script:
.. code-block:: none
$ vim service-os-industry-post.sh
Update the ``service-os-industry-post.sh`` script to:
.. code-block:: bash
#!/bin/bash
# ACRN SOS Image Post Install steps
set -ex
CHROOTPATH=$1
# acrn.kbl-nuc-i7.industry.efi path
acrn_industry_efi_path="$CHROOTPATH/usr/lib/acrn/acrn.kbl-nuc-i7.industry.efi"
# copy acrn.efi to efi partition
mkdir -p "$CHROOTPATH/boot/EFI/acrn" || exit 1
cp "$acrn_industry_efi_path" "$CHROOTPATH/boot/EFI/acrn/acrn.efi" || exit 1
# create load.conf
echo "Add default (5 seconds) boot wait time"
echo "timeout 5" >> "$CHROOTPATH/boot/loader/loader.conf" || exit 1
chroot $CHROOTPATH systemd-machine-id-setup
chroot $CHROOTPATH systemctl enable getty@tty1.service
echo "Welcome to the Clear Linux* ACRN SOS Industry image!
Please login as root for the first time!
" >> $1/etc/issue
exit 0
Step 2: Build the Service VM image
==================================
Use the clr-installer to build the Service VM image.
**Scenario 1: ACRN SDC**
.. code-block:: none
$ cd ~/service-os
$ sudo clr-installer -c service-os.yaml
The ``service-os.img`` will be generated at current directory.
**Scenario 2: ACRN INDUSTRY**
.. code-block:: none
$ cd ~/service-os-industry
$ sudo clr-installer -c service-os-industry.yaml
The ``service-os-industry.img`` will be generated at current directory.
.. _deploy_ootb_service_vm:
Step 3: Deploy the Service VM image
===================================
#. Prepare a U disk with at least 8GB memory.
#. Follow these steps to create two partitions on the U disk.
Keep 4GB in the first partition and leave free space in the second parition.
.. code-block:: none
# sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.3
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): n
Partition number (1-128, default 1):
First sector (34-15249374, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-15249374, default = 15249374) or {+-}size{KMGTP}: +4G
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
Command (? for help): n
Partition number (2-128, default 2):
First sector (34-15249374, default = 8390656) or {+-}size{KMGTP}:
Last sector (8390656-15249374, default = 15249374) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
Command (? for help): p
Disk /dev/sdb: 15249408 sectors, 7.3 GiB
Model: USB FLASH DRIVE
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 8C6BF21D-521A-49D5-8BC8-5B319FAF3F91
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 15249374
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 8390655 4.0 GiB 8300 Linux filesystem
2 8390656 15249374 3.3 GiB 8300 Linux filesystem
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.
#. Download and install a bootable Clear Linux on the U disk:
.. code-block:: none
$ wget https://download.clearlinux.org/releases/30970/clear/clear-30970-live-server.iso.xz
$ xz -d clear-30970-live-server.iso.xz
$ sudo dd if=clear-30970-live-server.iso of=/dev/sdb1 bs=4M oflag=sync status=progress
#. Copy the ``service-os.img`` or ``service-os-industry.img`` to the U disk:
.. code-block:: none
$ sudo mkfs.ext4 /dev/sdb2
$ sudo mount /dev/sdb2 /mnt
- ACRN SDC scenario:
.. code-block:: none
$ cp ~/service-os/service-os.img /mnt
$ sync && umount /mnt
- ACRN INDUSTRY scenario:
.. code-block:: none
$ cp ~/service-os-industry/service-os-industry.img /mnt
$ sync && umount /mnt
#. Unplug the U disk from the development machine and plug it in to your test machine.
#. Reboot the test machine and boot from the USB.
#. Log in to the Live Service Clear Linux OS with your "root" account and
mount the second partition on the U disk:
.. code-block:: none
# mount /dev/sdb2 /mnt
#. Format the disk that will install the Service VM image:
.. code-block:: none
# sudo gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.3
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): Y
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sda.
The operation has completed successfully.
#. Delete the old ACRN EFI firmware info:
.. code-block:: none
# efibootmgr | grep ACRN | cut -d'*' -f1 | cut -d't' -f2 | xargs -i efibootmgr -b {} -B
#. Write the Service VM:
- ACRN SDC scenario:
.. code-block:: none
# dd if=/mnt/sos.img of=/dev/sda bs=4M oflag=sync status=progress
- ACRN INDUSTRY scenario:
.. code-block:: none
# dd if=/mnt/sos-industry.img of=/dev/sda bs=4M oflag=sync status=progress
#. Configure the EFI firmware to boot the ACRN hypervisor by default:
.. code-block:: none
# efibootmgr -c -l "\EFI\acrn\acrn.efi" -d /dev/sda -p 1 -L "ACRN"
#. Unplug the U disk and reboot the test machine. After the Clear Linux OS boots, log in as "root" for the first time.
.. _set_up_ootb_rtvm:
Generate a User VM Preempt-RT image
***********************************
Step 1: Create a Preempt-RT image YAML file and script
======================================================
#. Create the ``preempt-rt.yaml`` file:
.. code-block:: none
$ mkdir -p ~/preempt-rt && cd ~/preempt-rt
$ vim preempt-rt.yaml
Update the ``preempt-rt.yaml`` file to:
.. code-block:: bash
:emphasize-lines: 46
block-devices: [
{name: "bdevice", file: "preempt-rt.img"}
]
targetMedia:
- name: ${bdevice}
size: "8.54G"
type: disk
children:
- name: ${bdevice}1
fstype: vfat
mountpoint: /boot
size: "512M"
type: part
- name: ${bdevice}2
fstype: swap
size: "32M"
type: part
- name: ${bdevice}3
fstype: ext4
mountpoint: /
size: "8G"
type: part
bundles: [
bootloader,
editors,
network-basic,
openssh-server,
os-core,
os-core-update,
sysadmin-basic,
systemd-networkd-autostart
]
autoUpdate: false
postArchive: false
postReboot: false
telemetry: false
hostname: clr-preempt-rt
keyboard: us
language: en_US.UTF-8
kernel: kernel-lts2018-preempt-rt
version: 30970
.. note:: Update the version value to your target Clear Linux version
Step 2: Build a User VM Preempt-RT image
========================================
.. code-block:: none
$ sudo clr-installer -c preempt-rt.yaml
The ``preempt-rt.img`` will be generated at the current directory.
.. _deploy_ootb_rtvm:
Step 3: Deploy the User VM Preempt-RT image
===========================================
#. Log in to the Service VM and copy the ``preempt-rt.img`` from the development machine:
.. code-block:: none
$ mkdir -p preempt-rt && cd preempt-rt
$ scp <development username>@<development machine ip>:<path to preempt-rt.img> .
#. Write ``preempt-rt.img`` to disk:
.. code-block:: none
$ sudo dd if=<path to preempt-rt.img> of=/dev/nvme0n1 bs=4M oflag=sync status=progress
#. Launch the Preempt-RT User VM:
.. code-block:: none
$ sudo /usr/share/acrn/samples/nuc/launch_hard_rt_vm.sh

View File

@@ -1,174 +0,0 @@
.. _building-acrn-in-docker:
Building ACRN in Docker
#######################
This tutorial shows how to build ACRN in a Clear Linux Docker image.
Install Docker
**************
#. Install Docker according to the `Docker installation instructions <https://docs.docker.com/install/>`_.
#. If you are behind an HTTP or HTTPS proxy server, follow the
`HTTP/HTTPS proxy instructions <https://docs.docker.com/config/daemon/systemd/#httphttps-proxy>`_
to set up an HTTP/HTTPS proxy to pull the Docker image and
`Configure Docker to use a proxy server <https://docs.docker.com/network/proxy/>`_
to set up an HTTP/HTTPS proxy for the Docker container.
#. Docker requires root privileges by default.
Follow these `additional steps <https://docs.docker.com/install/linux/linux-postinstall/>`_
to enable a non-root user.
.. note::
Performing these post-installation steps is not required. If you
choose not to, add `sudo` in front of every `docker` command in
this tutorial.
Get the Docker Image
********************
This tutorial presents two ways to get the Clear Linux Docker image that's needed to build ACRN.
Build the Docker Image from Dockerfile
======================================
#. Download `Dockerfile <https://raw.githubusercontent.com/projectacrn/acrn-hypervisor/master/doc/getting-started/Dockerfile>`_
to your development machine.
#. Build the Docker image:
.. code-block:: none
$ docker build -t clearlinux-acrn-builder:latest -f <path/to/Dockerfile> .
if you are behind an HTTP or HTTPS proxy server, use this command instead:
.. code-block:: none
$ docker build --build-arg HTTP_PROXY=http://<proxy_host>:<proxy_port> \
--build-arg HTTPS_PROXY=https://<proxy_host>:<proxy_port> \
-t clearlinux-acrn-builder:latest -f <path/to/Dockerfile> .
Get the Docker Image from Docker Hub
====================================
As an alternative, you can pull a pre-built Docker image from Docker Hub to your development machine. Use this command:
.. code-block:: none
$ docker pull acrn/clearlinux-acrn-builder:latest
Build ACRN from Source in Docker
********************************
#. Clone the acrn-hypervisor repo:
.. code-block:: none
$ mkdir -p ~/workspace && cd ~/workspace
$ git clone https://github.com/projectacrn/acrn-hypervisor
$ cd acrn-hypervisor
#. Build the acrn-hypervisor with the default configuration (Software Defined Cockpit [SDC] configuration):
For the Docker image build from Dockerfile, use this command to build ACRN:
.. code-block:: none
$ docker run -u`id -u`:`id -g` --rm -v $PWD:/workspace \
clearlinux-acrn-builder:latest bash -c "make clean && make"
For the Docker image downloaded from Docker Hub, use this command to build ACRN:
.. code-block:: none
$ docker run -u`id -u`:`id -g` --rm -v $PWD:/workspace \
acrn/clearlinux-acrn-builder:latest bash -c "make clean && make"
The build artifacts are found in the `build` directory.
Build the ACRN Service VM Kernel in Docker
******************************************
#. Clone the acrn-kernel repo:
.. code-block:: none
$ mkdir -p ~/workspace && cd ~/workspace
$ git clone https://github.com/projectacrn/acrn-kernel
$ cd acrn-kernel
#. Build the ACRN Service VM kernel:
For the Docker image built from Dockerfile, use this command to build ACRN:
.. code-block:: none
$ cp kernel_config_sos .config
$ docker run -u`id -u`:`id -g` --rm -v $PWD:/workspace \
clearlinux-acrn-builder:latest \
bash -c "make clean && make olddefconfig && make && make modules_install INSTALL_MOD_PATH=out/"
For the Docker image downloaded from Docker Hub, use this command to build ACRN:
.. code-block:: none
$ cp kernel_config_sos .config
$ docker run -u`id -u`:`id -g` --rm -v $PWD:/workspace \
acrn/clearlinux-acrn-builder:latest \
bash -c "make clean && make olddefconfig && make && make modules_install INSTALL_MOD_PATH=out/"
The commands build the bootable kernel image as ``arch/x86/boot/bzImage``,
and the loadable kernel modules under the ``./out/`` folder.
Build the ACRN User VM PREEMPT_RT Kernel in Docker
**************************************************
#. Clone the preempt-rt kernel repo:
.. code-block:: none
$ mkdir -p ~/workspace && cd ~/workspace
$ git clone -b 4.19/preempt-rt https://github.com/projectacrn/acrn-kernel preempt-rt
$ cd preempt-rt
#. Build the ACRN User VM PREEMPT_RT kernel:
For the Docker image built from Dockerfile, use this command to build ACRN:
.. code-block:: none
$ cp x86-64_defconfig .config
$ docker run -u`id -u`:`id -g` --rm -v $PWD:/workspace \
acrn/clearlinux-acrn-builder:latest \
bash -c "make clean && make olddefconfig && make && make modules_install INSTALL_MOD_PATH=out/"
For the Docker image downloaded from Docker Hub, use this command to build ACRN:
.. code-block:: none
$ cp x86-64_defconfig .config
$ docker run -u`id -u`:`id -g` --rm -v $PWD:/workspace \
acrn/clearlinux-acrn-builder:latest \
bash -c "make clean && make olddefconfig && make && make modules_install INSTALL_MOD_PATH=out/"
The commands build the bootable kernel image as ``arch/x86/boot/bzImage``,
and the loadable kernel modules under the ``./out/`` folder.
Build the ACRN documentation
****************************
#. Make sure you have both the ``acrn-hypervisor`` and ``acrn-kernel`` repositories already available in your workspace
(see steps above for instructions on how to clone them).
#. Build the ACRN documentation:
.. code-block:: none
$ cd ~/workspace
$ docker run -u`id -u`:`id -g` --rm -v $PWD:/workspace \
acrn/clearlinux-acrn-builder:latest \
bash -c "cd acrn-hypervisor && make clean && make doc"
The HTML documentation can be found in ``acrn-hypervisor/build/doc/html``

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 KiB

View File

@@ -1,121 +0,0 @@
.. _getting-started-up2:
Getting started guide for UP2 board
###################################
Hardware setup
**************
The `UP Squared board <http://www.up-board.org/upsquared/specifications/>`_ (UP2) is
an x86 maker board based on the Intel Apollo Lake platform. The UP boards
are used in IoT applications, industrial automation, digital signage, and more.
The UP2 features Intel `Celeron N3550
<https://ark.intel.com/products/95598/Intel-Celeron-Processor-N3350-2M-Cache-up-to-2_4-GHz>`_
and Intel `Pentium N4200
<https://ark.intel.com/products/95592/Intel-Pentium-Processor-N4200-2M-Cache-up-to-2_5-GHz>`_
SoCs. Both have been confirmed to work with ACRN.
Connecting to the serial port
=============================
The UP2 board has two serial ports. The following figure shows the UP2 board's
40-pin HAT connector we'll be using as documented in the `UP2 Datasheet
<https://up-board.org/wp-content/uploads/datasheets/UP-Square-DatasheetV0.5.pdf>`_.
.. image:: images/the-bottom-side-of-UP2-board.png
:align: center
We'll access the serial port through the I/O pins in the
40-pin HAT connector using a `USB TTL serial cable
<http://www.ftdichip.com/Products/USBTTLSerial.htm>`_,
and show how to connect a serial port with
``PL2303TA USB to TTL serial cable`` for example:
.. image:: images/USB-to-TTL-serial-cable.png
:align: center
Connect pin 6 (``Ground``), pin 8 (``UART_TXD``) and pin 10 (``UART_RXD``) of the HAT
connector to respectively the ``GND``, ``RX`` and ``TX`` pins of your
USB serial cable. Plug the USB TTL serial cable into your PC and use a
console emulation tool such as ``minicom`` or ``putty`` to communicate
with the UP2 board for debugging.
.. image:: images/the-connection-of-serial-port.png
:align: center
Software setup
**************
Setting up the ACRN hypervisor (and associated components) on the UP2
board is no different than other hardware platforms so please follow
the instructions provided in the :ref:`rt_industry_setup`, with
the additional information below.
There are a few parameters specific to the UP2 board that differ from
what is referenced in the :ref:`rt_industry_setup` section:
1. Serial Port settings
#. Storage device name
You will need to keep these in mind in a few places:
* When mounting the EFI System Partition (ESP)
.. code-block:: none
# mount /dev/mmcblk0p1 /mnt
* When adjusting the ``acrn.conf`` file
* Set the ``root=`` parameter using the ``PARTUUID`` or device name directly
* When configuring the EFI firmware to boot the ACRN hypervisor by default
.. code-block:: none
# efibootmgr -c -l "\EFI\acrn\acrn.efi" -d /dev/mmcblk0 -p 1 -L "ACRN Hypervisor" \
-u "bootloader=\EFI\org.clearlinux\bootloaderx64.efi uart=bdf@0:18.1"
UP2 serial port setting
=======================
The serial port (ttyS1) in the 40-pin HAT connector is located at ``serial PCI BDF 0:18.1``.
You can check this from the ``lspci`` output from the initial Clearlinux installation.
Also you can use ``dmesg | grep tty`` to get its IRQ information for console setting; and update
SOS bootargs ``console=ttyS1`` in acrn.conf to match with console setting.
.. code-block:: none
# lspci | grep UART
00:18.0 . Series HSUART Controller #1 (rev 0b)
00:18.1 . Series HSUART Controller #2 (rev 0b)
# dmesg | grep tty
dw-apb-uart.8: ttyS0 at MMIO 0x91524000 (irq = 4, base_baud = 115200) is a 16550A
dw-apb-uart.9: ttyS1 at MMIO 0x91522000 (irq = 5, base_baud = 115200) is a 16550A
The second entry associated with ``00:18.1 @irq5`` is the one on the 40-pin HAT connector.
UP2 block device
================
The UP2 board has an on-board eMMC device. The device name to be used
throughout the :ref:`getting_started` therefore is ``/dev/mmcblk0``
(and ``/dev/mmcblk0pX`` for any partition).
The UUID of the partition ``/dev/mmcblk0p3`` can be found by
.. code-block:: none
# blkid /dev/mmcblk
.. note::
You can also use the device name directly, e.g.: ``root=/dev/mmcblk0p3``
Running the hypervisor
**********************
Now that the hypervisor and Service OS have been installed on your UP2 board,
you can proceed with the rest of the instructions in the
:ref:`kbl-nuc-sdc` and install the User OS (UOS).