-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zephyr-image-package: add support for zephyr uos package
For example: IMAGE_INSTALL_append_pn-acrn-image-base = " zephyr-image-package" Signed-off-by: Naveen Saini <[email protected]>
- Loading branch information
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
SUMMARY = "Package for ${IMAGE_NAME}" | ||
# This license statement is a lie. Ideally set it to something more appropriate. | ||
LICENSE = "CLOSED" | ||
|
||
PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
PACKAGES = "${PN}" | ||
|
||
INHIBIT_DEFAULT_DEPS = "1" | ||
|
||
# Variables to control where images are found: the multiconfig name, and the deploy dir. | ||
CONTAINER_PACKAGE_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}" | ||
|
||
# Where to install the image | ||
containerdir ?= "${localstatedir}/lib/machines" | ||
|
||
SRC_URI = "file://launch_zephyr.sh" | ||
|
||
do_install() { | ||
install -d ${D}${containerdir} | ||
install ${CONTAINER_PACKAGE_DEPLOY_DIR}/zephyr.img ${D}${containerdir}/ | ||
install -m 755 ${WORKDIR}/launch_zephyr.sh ${D}/var/lib/machines/ | ||
} | ||
|
||
RDEPENDS_${PN} += "bash procps" |
44 changes: 44 additions & 0 deletions
44
recipes-guests/yocto/zephyr-image-package/launch_zephyr.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
# Copyright (C) 2019 Intel Corporation. | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
function launch_zephyr() | ||
{ | ||
vm_name=zephyr_vm$1 | ||
|
||
#check if the vm is running or not | ||
vm_ps=$(pgrep -a -f acrn-dm) | ||
result=$(echo $vm_ps | grep -w "${vm_name}") | ||
if [[ "$result" != "" ]]; then | ||
echo "$vm_name is running, can't create twice!" | ||
exit | ||
fi | ||
|
||
#for memsize setting | ||
mem_size=128M | ||
|
||
acrn-dm -A -m $mem_size -s 0:0,hostbridge -s 1:0,lpc -l com1,stdio \ | ||
-s 5,virtio-console,@pty:pty_port \ | ||
-s 3,virtio-blk,/var/lib/machines/zephyr.img \ | ||
--ovmf /usr/share/acrn/bios/OVMF.fd \ | ||
$vm_name | ||
} | ||
|
||
# offline SOS CPUs except BSP before launch UOS | ||
for i in `ls -d /sys/devices/system/cpu/cpu[1-99]`; do | ||
online=`cat $i/online` | ||
idx=`echo $i | tr -cd "[1-99]"` | ||
echo cpu$idx online=$online | ||
if [ "$online" = "1" ]; then | ||
echo 0 > $i/online | ||
# during boot time, cpu hotplug may be disabled by pci_device_probe during a pci module insmod | ||
while [ "$online" = "1" ]; do | ||
sleep 1 | ||
echo 0 > $i/online | ||
online=`cat $i/online` | ||
done | ||
echo $idx > /sys/class/vhm/acrn_vhm/offline_cpu | ||
fi | ||
done | ||
|
||
launch_zephyr 1 |