Skip to content

Commit

Permalink
zephyr-image-package: add support for zephyr uos package
Browse files Browse the repository at this point in the history
For example:
IMAGE_INSTALL_append_pn-acrn-image-base = " zephyr-image-package"

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
  • Loading branch information
saininav committed Dec 17, 2019
1 parent 70af583 commit a5ffdae
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
24 changes: 24 additions & 0 deletions recipes-guests/yocto/zephyr-image-package.bb
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"
42 changes: 42 additions & 0 deletions recipes-guests/yocto/zephyr-image-package/launch_zephyr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

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 "${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 -c $2 -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 1

0 comments on commit a5ffdae

Please sign in to comment.