RPI 5 Zephyr xenlib - oleksiimoisieiev/rpi5-knowledge-base GitHub Wiki
repo: https://github.com/xen-troops/zephyr-xenlib.git
branch: main
- In Zephyr source project folder add below file named zephyr-xenlib.yaml into the folder submanifests/
# Copyright (C) 2024 EPAM Systems.
#
# Enable zephyr-xenlib support
manifest:
projects:
- name: zephyr-xenlib
url: https://github.com/xen-troops/zephyr-xenlib.git
revision: main
- run west update in the root of the Zephyr project. The west will checkout zephyr-xenlib into Zephyr root folder
zephyr_proj/
|- zephyr/
|- modules/
| ...
|- zephyr-xenlib/ <-------
- the below commits from pull request https://github.com/xen-troops/zephyr-xenlib/pull/53 have to be applied on top of zephyr-xenlib project:
zephyr: Add _POSIX_C_SOURCE definition to fix build
zephyr: Switch to new barrier API
xen-dom-mgmt: Use DIV_ROUND_UP instead of ceiling_fraction
- In Zephyr project enable below Kconfig options:
CONFIG_XEN_REGIONS=y
CONFIG_XEN_GRANT_TABLE=y
CONFIG_COMMON_LIBC_MALLOC=y
CONFIG_XEN_EVENTS=y
- In Zephyr project enable below Kconfig options on top of samples/hello_world (or any other application) to test build of zephyr-xenlib:
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_DISK_ACCESS=y
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_FS_LITTLEFS_BLK_DEV=y
CONFIG_XEN_LIBFDT=y
CONFIG_XEN_STORE_SRV=y
CONFIG_XEN_DOMAIN_MANAGEMENT=y
CONFIG_XRUN=y
CONFIG_XEN_CONSOLE_SRV=y
#CONFIG_XEN_SHELL=y
CONFIG_XRUN_SHELL_CMDS=y
CONFIG_XEN_VCH=y
CONFIG_XSTAT=y
CONFIG_XSTAT_SHELL_CMDS=y
To test CONFIG_XEN_SHELL below diff can be applied to samples/hello_world main.c
:
--- a/samples/hello_world/src/main.c
+++ b/samples/hello_world/src/main.c
@@ -6,8 +6,14 @@
#include <stdio.h>
+#include <xen_dom_mgmt.h>
+#include <vch.h>
+
+struct xen_domain_cfg domd_cfg;
+
int main(void)
{
printf("Hello World! %s\n", CONFIG_BOARD);
+ vch_open(1, "abc", 1000, 1000, NULL);
return 0;
}