|
| 1 | +.. _using_vxworks_as_uos: |
| 2 | + |
| 3 | +Using VxWorks* as User OS |
| 4 | +######################### |
| 5 | + |
| 6 | +`VxWorks`_\* is a real-time proprietary OS designed for use in embedded systems requiring real-time, deterministic |
| 7 | +performance. This tutorial describes how to run VxWorks as the User OS on the ACRN hypervisor. |
| 8 | + |
| 9 | +.. note:: You'll need to be a WindRiver* customer and have purchased VxWorks to follow this tutorial. |
| 10 | + |
| 11 | +Steps for Using VxWorks as User OS |
| 12 | +********************************** |
| 13 | + |
| 14 | +#. Build VxWorks |
| 15 | + |
| 16 | + Follow the `VxWorks Getting Started Guide <https://docs.windriver.com/bundle/vxworks_7_tutorial_kernel_application_workbench_sr0610/page/rbu1422461642318.html>`_ |
| 17 | + to setup the VxWorks development environment and build the VxWorks Image. |
| 18 | + |
| 19 | + .. note:: |
| 20 | + The following kernel configuration should be **excluded**: |
| 21 | + * INCLUDE_PC_CONSOLE |
| 22 | + * DRV_SIO_PCI_NS16550 |
| 23 | + * SELECT_PC_CONSOLE_KBD |
| 24 | + |
| 25 | + The following kernel configuration should be **included**: |
| 26 | + * DRV_SIO_IA_NS16550 |
| 27 | + * DRV_SIO_FDT_NS16550 |
| 28 | + |
| 29 | + The following kernel configuration value should be **set**: |
| 30 | + * CONSOLE_BAUD_RATE = 115200 |
| 31 | + * SYS_CLK_RATE_MAX = 1000 |
| 32 | + |
| 33 | +#. Build GRUB2 BootLoader Image |
| 34 | + |
| 35 | + We use grub-2.02 as the bootloader of VxWorks in this tutorial; other versions may also work. |
| 36 | + |
| 37 | + .. code-block:: none |
| 38 | +
|
| 39 | + $ curl ftp://ftp.gnu.org/gnu/grub/grub-2.02.tar.xz | tar xJv |
| 40 | + $ cd grub-2.02 |
| 41 | + $ ./autogen.sh |
| 42 | + $ ./configure --with-platform=efi --target=x86_64 |
| 43 | + $ make |
| 44 | + $ ./grub-mkimage -p /EFI/BOOT -d ./grub-core/ -O x86_64-efi -o grub_x86_64.efi \ |
| 45 | + boot efifwsetup efi_gop efinet efi_uga lsefimmap lsefi lsefisystab \ |
| 46 | + exfat fat multiboot2 multiboot terminal part_msdos part_gpt normal \ |
| 47 | + all_video aout configfile echo file fixvideo fshelp gfxterm gfxmenu \ |
| 48 | + gfxterm_background gfxterm_menu legacycfg video_bochs video_cirrus \ |
| 49 | + video_colors video_fb videoinfo video net tftp |
| 50 | +
|
| 51 | + This will build a ``grub_x86_64.efi`` image in the current directory. |
| 52 | + |
| 53 | +#. Preparing the Boot Device |
| 54 | + |
| 55 | + .. code-block:: none |
| 56 | +
|
| 57 | + $ dd if=/dev/zero of=VxWorks.img bs=1M count=35 |
| 58 | + $ mkfs.vfat -F 32 VxWorks.img |
| 59 | + $ sudo mount `sudo losetup -f -P --show VxWorks.img` /mnt |
| 60 | +
|
| 61 | + Create the following directories. |
| 62 | + |
| 63 | + .. code-block:: none |
| 64 | +
|
| 65 | + $ sudo mkdir -p /mnt/efi/boot |
| 66 | + $ sudo mkdir -p /mnt/kernel |
| 67 | +
|
| 68 | + Copy ``vxWorks`` and ``grub_x86_64.efi``. |
| 69 | + |
| 70 | + .. code-block:: none |
| 71 | +
|
| 72 | + $ sudo cp vxWorks /mnt/kernel/ |
| 73 | + $ sudo cp grub-2.02/grub_x86_64.efi /mnt/efi/boot/bootx64.efi |
| 74 | +
|
| 75 | + Create ``/mnt/efi/boot/grub.cfg`` containing the following: |
| 76 | + |
| 77 | + .. code-block:: none |
| 78 | +
|
| 79 | + set default=0 |
| 80 | + set timeout=5 |
| 81 | +
|
| 82 | + menuentry "VxWorks Guest" { |
| 83 | + multiboot /kernel/vxWorks |
| 84 | + } |
| 85 | +
|
| 86 | + Unmount the loopback device: |
| 87 | + |
| 88 | + .. code-block:: none |
| 89 | +
|
| 90 | + $ sudo umount /mnt |
| 91 | +
|
| 92 | + You now have a virtual disk image with bootable VxWorks in ``VxWorks.img``. |
| 93 | + |
| 94 | +#. Follow :ref:`getting-started-apl-nuc` to boot "The ACRN Service OS". |
| 95 | + |
| 96 | +#. Boot VxWorks as User OS. |
| 97 | + |
| 98 | + On the ACRN SOS, prepare a directory and populate it with VxWorks files. |
| 99 | + |
| 100 | + .. code-block:: none |
| 101 | +
|
| 102 | + $ mkdir vxworks && cd vxworks |
| 103 | + $ cp /usr/share/acrn/samples/nuc/launch_vxworks.sh . |
| 104 | + $ cp /usr/share/acrn/bios/OVMF.fd . |
| 105 | +
|
| 106 | + You will also need to copy the ``VxWorks.img`` created in the VxWorks build environment into directory |
| 107 | + ``vxworks`` (via, e.g. a USB stick or network). |
| 108 | + |
| 109 | + Run the ``launch_vxworks.sh`` script to launch VxWorks as Uos. |
| 110 | + |
| 111 | + .. code-block:: none |
| 112 | +
|
| 113 | + $ sudo ./launch_vxworks.sh |
| 114 | +
|
| 115 | + Then VxWorks will boot up automatically. You will see the prompt. |
| 116 | + |
| 117 | + .. code-block:: console |
| 118 | +
|
| 119 | + VxWorks 7 SMP 64-bit |
| 120 | +
|
| 121 | + Copyright 1984-2019 Wind River Systems, Inc. |
| 122 | +
|
| 123 | + Core Kernel version: 1.2.7.0 |
| 124 | + Build date: May 5 2019 21:40:28 |
| 125 | + Board: x86 Processor (ACPI_BOOT_OP) SMP/SMT |
| 126 | + CPU Count: 1 |
| 127 | + OS Memory Size: ~1982MB |
| 128 | + ED&R Policy Mode: Permanently Deployed |
| 129 | +
|
| 130 | + Adding 9315 symbols for standalone. |
| 131 | +
|
| 132 | + -> |
| 133 | +
|
| 134 | + Finally, you can type ``help`` to check whether the VxWorks works well. |
| 135 | + |
| 136 | + .. code-block:: console |
| 137 | +
|
| 138 | + -> help |
| 139 | +
|
| 140 | + help Print this list |
| 141 | + dbgHelp Print debugger help info |
| 142 | + edrHelp Print ED&R help info |
| 143 | + ioHelp Print I/O utilities help info |
| 144 | + nfsHelp Print nfs help info |
| 145 | + netHelp Print network help info |
| 146 | + rtpHelp Print process help info |
| 147 | + spyHelp Print task histogrammer help info |
| 148 | + timexHelp Print execution timer help info |
| 149 | + h [n] Print (or set) shell history |
| 150 | + i [task] Summary of tasks' TCBs |
| 151 | + ti task Complete info on TCB for task |
| 152 | + sp adr,args... Spawn a task, pri=100, opt=0x19, stk=20000 |
| 153 | + taskSpawn name,pri,opt,stk,adr,args... Spawn a task |
| 154 | + tip "dev=device1#tag=tagStr1", "dev=device2#tag=tagStr2", ... |
| 155 | + Connect to one or multiple serial lines |
| 156 | + td task Delete a task |
| 157 | + ts task Suspend a task |
| 158 | + tr task Resume a task |
| 159 | +
|
| 160 | + Type <CR> to continue, Q<CR> or q<CR> to stop: |
| 161 | +
|
| 162 | +.. _VxWorks: https://www.windriver.com/products/vxworks/ |
0 commit comments