├── .gitignore ├── .travis.yml ├── COPYING.MIT ├── README.md ├── SECURITY.md ├── classes ├── acrn-bootconf.bbclass ├── acrn-sblimage.bbclass ├── container-package.bbclass └── image-acrn.bbclass ├── conf ├── distro │ ├── acrn-demo-service-vm.conf │ ├── acrn-demo-user-vm.conf │ └── include │ │ └── acrn-demo.inc └── layer.conf ├── docs ├── dm-verity.md ├── getting-started.md ├── logical-partition.md ├── qa.md ├── references.md └── slimbootloader.md ├── recipes-bsp ├── grub │ ├── acrn-grub-bootconf.inc │ └── grub-bootconf_1.00.bbappend └── setserial │ ├── setserial │ ├── setserial │ └── setserial.service │ └── setserial_%.bbappend ├── recipes-core ├── acrn │ ├── acrn-common.inc │ ├── acrn-devicemodel.bb │ ├── acrn-devicemodel │ │ ├── 0001-No-need-to-build-install-the-tools.patch │ │ ├── 0002-Makefile-allow-to-pass-compiler-and-linker-flags.patch │ │ └── 0003-devicemodel-Makefile-skip-Werror-address-error-check.patch │ ├── acrn-hypervisor.bb │ ├── acrn-hypervisor │ │ └── hypervisor-dont-build-pre_build.patch │ ├── acrn-life-mngr.bb │ ├── acrn-tools.bb │ └── files │ │ └── 0001-acrn-Use-std-gnu11-to-fix-build-with-GCC-15.patch ├── images │ ├── acrn-image-base.bb │ ├── acrn-image-minimal.bb │ ├── acrn-image-sato.bb │ └── acrn-image-weston.bb ├── networkd-config │ ├── networkd-config.bb │ └── networkd-config │ │ └── 80-dhcp.network └── packagegroups │ └── packagegroup-acrn.bb ├── recipes-devtools └── python │ ├── python3-elementpath_3.0.2.bb │ └── python3-xmlschema_3.0.1.bb ├── recipes-guests └── yocto │ ├── core-image-base-package.bb │ ├── core-image-base-package │ └── launch-base.sh │ ├── core-image-sato-package.bb │ ├── core-image-sato-package │ └── launch-sato.sh │ ├── core-image-weston-package.bb │ └── core-image-weston-package │ └── launch-weston.sh ├── recipes-kernel └── linux │ ├── files │ ├── 0001-efi-libstub-Use-std-gnu11-to-fix-build-with-GCC-15.patch │ ├── 0001-lib-build_OID_registry-fix-reproducibility-issues.patch │ ├── 0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch │ ├── 0001-vt-conmakehash-improve-reproducibility.patch │ ├── 0002-x86-boot-Use-std-gnu11-to-fix-build-with-GCC-15.patch │ ├── 0003-x86-boot-Compile-boot-code-with-std-gnu11-too.patch │ ├── acrn-common.cfg │ ├── fix-perf-reproducibility.patch │ ├── service-vm.cfg │ ├── service-vm_6.1.cfg │ ├── service-vm_6.1.scc │ ├── user-rtvm.cfg │ ├── user-rtvm_6.1.scc │ ├── user-vm.cfg │ ├── user-vm_6.1.cfg │ └── user-vm_6.1.scc │ ├── linux-intel-acrn-rtvm_6.1.bb │ ├── linux-intel-acrn-service-vm_6.1.bb │ ├── linux-intel-acrn-user-vm_6.1.bb │ ├── linux-intel-acrn.inc │ └── linux-intel-acrn_6.1.inc ├── scripts └── lib │ └── wic │ └── plugins │ └── source │ └── acrn-bootimg-efi.py └── wic ├── acrn-bootdisk-dmverity.wks.in └── acrn-bootdisk-microcode.wks.in /.gitignore: -------------------------------------------------------------------------------- 1 | build*/ 2 | pyshtables.py 3 | *.swp 4 | *.orig 5 | *.rej 6 | /*.patch 7 | *~ 8 | scripts/lib/wic/plugins/source/__pycache__ 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: bionic 2 | language: python 3 | python: 4 | - "3.6" 5 | 6 | addons: 7 | apt: 8 | packages: 9 | - chrpath 10 | - diffstat 11 | - texinfo 12 | 13 | env: 14 | global: 15 | - MACHINE=intel-corei7-64 16 | - DISTRO=acrn-demo-sos 17 | 18 | install: 19 | - git clone --depth=10 --branch=master git://git.yoctoproject.org/meta-intel ../meta-intel 20 | - git clone --depth=50 --branch=master git://git.yoctoproject.org/poky ../poky 21 | - git clone --depth=50 --branch=master git://git.openembedded.org/meta-openembedded ../meta-openembedded 22 | - . ../poky/oe-init-build-env $TRAVIS_BUILD_DIR/build 23 | - bitbake-layers add-layer ../../meta-intel 24 | - bitbake-layers add-layer ../../meta-openembedded/meta-oe 25 | - bitbake-layers add-layer ../../meta-openembedded/meta-python 26 | - bitbake-layers add-layer ../../meta-acrn 27 | 28 | script: 29 | - yocto-check-layer ../../meta-acrn --dependency ../../meta-intel 30 | - bitbake packagegroup-acrn --parse-only 31 | - bitbake packagegroup-acrn --dry-run 32 | - devtool latest-version acrn-hypervisor 33 | -------------------------------------------------------------------------------- /COPYING.MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy 2 | of this software and associated documentation files (the "Software"), to deal 3 | in the Software without restriction, including without limitation the rights 4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5 | copies of the Software, and to permit persons to whom the Software is 6 | furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17 | THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Integration layer for the [ACRN Hypervisor](http://projectacrn.org/). 2 | 3 | See the [Getting Started](docs/getting-started.md) for more information. -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation. 3 | 4 | ## Reporting a Vulnerability 5 | Please report any security vulnerabilities in this project [utilizing the guidelines here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html). 6 | 7 | -------------------------------------------------------------------------------- /classes/acrn-bootconf.bbclass: -------------------------------------------------------------------------------- 1 | # Add acrn-bootconf bbclass to hold variable for boot configuration. 2 | # 3 | # ACRN_EFI_BOOT_CONF can be difficult to read and write, add new variable 4 | # to allow configure boot configuration for each vm in more readable way. 5 | # 6 | # VMFLAGS - list of pre-launched VM including Service vm 7 | # VM_APPEND - VM kernel commandline 8 | # KERNEL_IMAGE - kernel image like bzImage for each vm 9 | # KERNEL_MOD - kern_mod tag in acrn scenario xml for each 10 | # ACPI_TAG - ACPI tag for specific VM 11 | # ACPI_BIN - binary of ACPI tables for a specific vm 12 | # Optional: 13 | # PART_LABEL - Partition Label, if set, it allow grub bootloader to pick modules/kernel binaries by partition label 14 | # 15 | # using hybrid scenario for nuc7i7dnb as example: 16 | # VMFLAGS = "vm0 vm1" 17 | # # vm0 18 | # VM_APPEND_vm0 = "xxx" 19 | # KERNEL_IMAGE_vm0 = "zephyr.bin" 20 | # KERNEL_MOD_vm0 = "Zephyr_RawImage" 21 | # ACPI_TAG_vm0 = "ACPI_VM0" 22 | # ACPI_BIN_vm0 = "ACPI_VM0.bin" 23 | # PART_LABEL_vm0 = "boot" 24 | # 25 | # # vm1 26 | # VM_APPEND_vm1 = "xxx" 27 | # KERNEL_IMAGE_vm1 = "bzImage" 28 | # KERNEL_MOD_vm1 = "Linux_bzImage" 29 | # PART_LABEL_vm1 = "boot" 30 | # 31 | 32 | 33 | def get_acrn_efi_boot_conf(d): 34 | vmflags = d.getVar("VMFLAGS") 35 | 36 | bootconf = "" 37 | for flag in vmflags.split(): 38 | append = d.getVar("VM_APPEND_%s" % flag) or "" 39 | kernelimage = d.getVar("KERNEL_IMAGE_%s" % flag) or "" 40 | partlabel = d.getVar("PART_LABEL_%s" % flag) or "" 41 | kernelmod = d.getVar("KERNEL_MOD_%s" % flag) or "" 42 | acpibin = d.getVar("ACPI_BIN_%s" % flag) or "" 43 | acpitag = d.getVar("ACPI_TAG_%s" % flag) or "" 44 | 45 | if kernelimage == "" or kernelmod == "": 46 | bb.warn("KERNEL_IMAGE_{s} or KERNEL_MOD_{s} set to blank, this might cause error to boot VM({s}).".format(s = flag)) 47 | 48 | bootconf += "%s:%s:%s:%s;" % (kernelimage, kernelmod, append, partlabel) 49 | if not acpibin == "" and not acpitag == "": 50 | bootconf += "%s:%s;" % (acpibin, acpitag) 51 | 52 | return bootconf 53 | 54 | # list of pre-launched vm including Service vm 55 | VMFLAGS ??= " vm0 " 56 | 57 | # default value for vm0 based on industry scenario for nuc7i7dnb 58 | VM_APPEND_vm0 ??= "${APPEND}" 59 | KERNEL_IMAGE_vm0 ??= "/${KERNEL_IMAGETYPE}" 60 | KERNEL_MOD_vm0 ??= "Linux_bzImage" 61 | ACPI_TAG_vm0 ??= "" 62 | ACPI_BIN_vm0 ??= "" 63 | 64 | # in format of 65 | # ::; 66 | # for each module, split each module with semicolon. 67 | # below example show zephyr.bin as VM0 without bootargs and 68 | # bzImage as VM1 with bootargs eg : 69 | # ACRN_EFI_BOOT_CONF ?= "zephyr.bin:Zephyr_RawImage;bzImage:Linux_bzImage:rootwait root=/dev/sda1;" 70 | ACRN_EFI_BOOT_CONF ??= "${@get_acrn_efi_boot_conf(d)}" 71 | 72 | 73 | # ACRN_EFI_GRUB2_MOD_CFG is semicolon (;) sperated list of auxiliary grub2 modules/commands to make 74 | # entries right before multiboot2 acrn.bin 75 | # Fox example: 76 | # ACRN_EFI_GRUB2_MOD_CFG = “insmod ext2;insmod …” 77 | # 78 | # menuentry 'ACRN (Yocto)'{ 79 | # insmod ext2 80 | # insmod … 81 | # … 82 | # multiboot2 /acrn.bin 83 | # .. 84 | # } 85 | ACRN_EFI_GRUB2_MOD_CFG ??= "" 86 | ACRN_HV_EFI_CFG ??= "" 87 | -------------------------------------------------------------------------------- /classes/acrn-sblimage.bbclass: -------------------------------------------------------------------------------- 1 | inherit python3native 2 | DEPENDS += "slimboot-tools-native" 3 | 4 | MB_DEPENDENCY ?= "" 5 | MB_MC_DEPENDENCY ?= "" 6 | MB_ACRN_BINARY ?= "${DEPLOY_DIR_IMAGE}/acrn.32.out" 7 | MB_ACRN_CMDLINE ?= "" 8 | MB_ACRN_MODULES ?= "${TOPDIR}/conf/linux.txt;${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}" 9 | BASE_SBLIMAGE ?= "sbl_os" 10 | SBLIMAGE_NAME ?= "${BASE_SBLIMAGE}" 11 | PREGENERATED_SIGNING_KEY_SLIMBOOT_KEY_SHA256 ?= "${TOPDIR}/cert/TestSigningPrivateKey.pem" 12 | BB_CURRENT_MC ?= "" 13 | EFI_STUB_BINARY ?= "${DEPLOY_DIR_IMAGE}/boot.efi" 14 | 15 | python do_acrn_sblimage() { 16 | import re 17 | import os 18 | import subprocess 19 | 20 | mbAcrnBinaryDeployDir = d.getVar('MB_ACRN_BINARY').lstrip().rstrip() 21 | if not os.path.isfile(mbAcrnBinaryDeployDir): 22 | bb.fatal("acrn %s not found!" % mbAcrnBinaryDeployDir) 23 | 24 | mbAcrnCmdlineDeployDir = d.getVar('MB_ACRN_CMDLINE').lstrip().rstrip() 25 | if mbAcrnCmdlineDeployDir == "": 26 | hv_cmdline = d.getVar('WORKDIR') + "/hv_cmdline" 27 | bb.debug(1, "hv_cmdline: %s" % (hv_cmdline)) 28 | subprocess.check_call("echo '' > %s" % (hv_cmdline), shell=True) 29 | else: 30 | hv_cmdline = mbAcrnCmdlineDeployDir 31 | 32 | mbAcrnBinaryDeployDirPairList = re.split(" +", d.getVar('MB_ACRN_MODULES').lstrip().rstrip()) 33 | 34 | genContainerPath = "%s/%s/slimboot/Tools/GenContainer.py" % (d.getVar('STAGING_DIR_NATIVE'), d.getVar('libexecdir')) 35 | 36 | genContainerCmd = "%s" % d.getVar('PYTHON') 37 | genContainerCmd = genContainerCmd + " %s create" % (genContainerPath) 38 | genContainerCmd = genContainerCmd + " -cl" 39 | genContainerCmd = genContainerCmd + " CMDL:%s" % (hv_cmdline) 40 | genContainerCmd = genContainerCmd + " ACRN:%s" % (mbAcrnBinaryDeployDir) 41 | counter = 0 42 | for mbAcrnBinaryDeployDirPair in mbAcrnBinaryDeployDirPairList: 43 | mbAcrnBinaryDeployDirPairMods = re.split(";", mbAcrnBinaryDeployDirPair.strip()) 44 | bb.debug(1, "module[%s]: %s" % (counter, mbAcrnBinaryDeployDirPairMods[0])) 45 | bb.debug(1, "module[%s]: %s" % (counter+1, mbAcrnBinaryDeployDirPairMods[1])) 46 | 47 | if not os.path.isfile(mbAcrnBinaryDeployDirPairMods[0]): 48 | bb.fatal("module %s not found!" % mbAcrnBinaryDeployDirPairMods[0]) 49 | 50 | if not os.path.isfile(mbAcrnBinaryDeployDirPairMods[1]): 51 | bb.fatal("module %s not found!" % mbAcrnBinaryDeployDirPairMods[1]) 52 | 53 | genContainerCmd = genContainerCmd + " MOD%s:%s MOD%s:%s" % (counter, mbAcrnBinaryDeployDirPairMods[0], counter+1, mbAcrnBinaryDeployDirPairMods[1]) 54 | counter = counter + 2 55 | genContainerCmd = genContainerCmd + " -o %s/%s" % (d.getVar('WORKDIR'), d.getVar('SBLIMAGE_NAME')) 56 | genContainerCmd = genContainerCmd + " -k %s" % (d.getVar('PREGENERATED_SIGNING_KEY_SLIMBOOT_KEY_SHA256')) 57 | genContainerCmd = genContainerCmd + " -t MULTIBOOT" 58 | 59 | bb.debug(1, "genContainerCmd: %s" % (genContainerCmd)) 60 | subprocess.check_call(genContainerCmd, shell=True) 61 | subprocess.check_call("install -d %s/boot; install -m 644 %s/%s %s/boot" % (d.getVar('IMAGE_ROOTFS'), d.getVar('WORKDIR'), d.getVar('SBLIMAGE_NAME'), d.getVar('IMAGE_ROOTFS')), shell=True) 62 | 63 | if d.getVar('ACRN_FIRMWARE') == 'uefi': 64 | subprocess.check_call("objcopy --add-section .hv=%s/%s --change-section-vma .hv=0x6e000 --set-section-flags "\ 65 | ".hv=alloc,data,contents,load --section-alignment 0x1000 %s/boot.efi %s/acrn.efi" % 66 | (d.getVar('WORKDIR'), d.getVar('SBLIMAGE_NAME'), d.getVar('DEPLOY_DIR_IMAGE'), d.getVar('DEPLOY_DIR_IMAGE')), shell=True) 67 | } 68 | 69 | python() { 70 | import re 71 | 72 | currentMultibootConfig = d.getVar('BB_CURRENT_MC') 73 | multibootPackageDependencyList = re.split(" +", d.getVar('MB_DEPENDENCY').lstrip().rstrip()) 74 | multibootPackageMcDependencyList = re.split(" +", d.getVar('MB_MC_DEPENDENCY').lstrip().rstrip()) 75 | 76 | bb.debug(1, "Multiboot variable parsing check") 77 | 78 | for multibootPackageDependency in multibootPackageDependencyList: 79 | if multibootPackageDependency: 80 | dependency = "%s" % (multibootPackageDependency) 81 | bb.debug(1, "MultibootDependency: %s" % (dependency)) 82 | d.appendVarFlag('do_acrn_sblimage', 'depends', ' ' + dependency) 83 | 84 | for multibootPackageMcDependency in multibootPackageMcDependencyList: 85 | if multibootPackageMcDependency: 86 | mcdependency = "mc:%s:%s" % (currentMultibootConfig, multibootPackageMcDependency) 87 | bb.debug(1, "MultibootMcDependency: %s" % (mcdependency)) 88 | d.appendVarFlag('do_acrn_sblimage', 'mcdepends', ' ' + mcdependency) 89 | 90 | # fix host-user-contaminated QA warnings 91 | d.setVarFlag('do_acrn_sblimage', 'fakeroot', '1') 92 | d.setVarFlag('do_acrn_sblimage', 'umask', '022') 93 | 94 | } 95 | 96 | addtask do_acrn_sblimage after do_rootfs before do_image 97 | -------------------------------------------------------------------------------- /classes/container-package.bbclass: -------------------------------------------------------------------------------- 1 | SUMMARY = "Package for ${IMAGE_NAME}" 2 | # This license statement is a lie. Ideally set it to something more appropriate. 3 | LICENSE = "CLOSED" 4 | 5 | PACKAGE_ARCH = "${MACHINE_ARCH}" 6 | PACKAGES = "${PN}" 7 | 8 | INHIBIT_DEFAULT_DEPS = "1" 9 | 10 | # Variables to control where images are found: the multiconfig name, and the deploy dir. 11 | CONTAINER_PACKAGE_MC ?= "" 12 | CONTAINER_PACKAGE_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}" 13 | 14 | # The name of the image 15 | IMAGE_NAME := "${@d.getVar('PN').replace('-package', '')}" 16 | # Where to install the image 17 | containerdir ?= "${localstatedir}/lib/machines" 18 | 19 | # multiconfig build 20 | ACRN_CURRENT_MC = "${@ "" if (d.getVar("BB_CURRENT_MC") == "default") else d.getVar("BB_CURRENT_MC") }" 21 | do_install[mcdepends] += "mc:${ACRN_CURRENT_MC}:${CONTAINER_PACKAGE_MC}:${IMAGE_NAME}:do_image_complete" 22 | 23 | do_install () { 24 | install -d ${D}${containerdir} 25 | install ${CONTAINER_PACKAGE_DEPLOY_DIR}/${IMAGE_NAME}-${MACHINE}.rootfs.wic ${D}${containerdir}/${IMAGE_NAME}.wic 26 | } 27 | -------------------------------------------------------------------------------- /classes/image-acrn.bbclass: -------------------------------------------------------------------------------- 1 | IMAGE_FSTYPES += "ext4 wic" 2 | 3 | inherit acrn-bootconf 4 | 5 | WICVARS:append = " ACRN_EFI_GRUB2_MOD_CFG ACRN_EFI_BOOT_CONF IMAGE_EFI_BOOT_FILES ACRN_HV_EFI_CFG " 6 | -------------------------------------------------------------------------------- /conf/distro/acrn-demo-service-vm.conf: -------------------------------------------------------------------------------- 1 | require conf/distro/include/acrn-demo.inc 2 | 3 | DISTRO .= "-service-vm" 4 | DISTRO_NAME += "(Service VM)" 5 | DISTRO_FEATURES += "ServiceVM" 6 | 7 | PREFERRED_PROVIDER_virtual/kernel ?= "linux-intel-acrn-service-vm" 8 | PREFERRED_VERSION_linux-intel-acrn-service-vm ?= "6.1%" 9 | 10 | # elementpath 4.0.1 has removed 'SYMBOLS' attribute, which causing failure in ACRN 3.1.0 11 | # https://github.com/sissaschool/elementpath/commit/a76aeb88b0d103420239df1d5d001f7d7f56b5c9 12 | # 13 | # misc/config_tools/scenario_config/elementpath_overlay.py", line 24, in CustomParser 14 | #| SYMBOLS = BaseParser.SYMBOLS | { 15 | #| ^^^^^^^^^^^^^^^^^^ 16 | #| AttributeError: type object 'XPath2Parser' has no attribute 'SYMBOLS' 17 | # Carry python3-elementpath 3.0.2 version locally, until it gets fixed upstream 18 | PREFERRED_VERSION_python3-elementpath = "3.0.2" 19 | PREFERRED_VERSION_python3-elementpath-native = "3.0.2" 20 | 21 | # Newer version throw TypeError: 22 | # build_schema_node_tree() got an unexpected keyword argument 'uri' 23 | PREFERRED_VERSION_python3-xmlschema = "3.0.1" 24 | PREFERRED_VERSION_python3-xmlschema-native = "3.0.1" 25 | 26 | 27 | # ACRN hypervisor log setting, sensible defaults 28 | LINUX_ACRN_APPEND ?= "hvlog=2M@0xE00000 ${@bb.utils.contains('EFI_PROVIDER','grub-efi','memmap=2M\$0xE00000','memmap=2M$0xE00000',d)} " 29 | # GVT enabling. Service VM has pipe 0, one UOS has the rest. 30 | LINUX_GVT_APPEND ?= "i915.enable_gvt=1 i915.nuclear_pageflip=1 " 31 | 32 | APPEND += "${LINUX_ACRN_APPEND} ${LINUX_GVT_APPEND}" 33 | 34 | EFI_PROVIDER = "grub-efi" 35 | GRUB_BUILDIN:append = " multiboot2 " 36 | WKS_FILE = "${@bb.utils.contains_any("IMAGE_CLASSES", "dm-verity-img", "acrn-bootdisk-dmverity.wks.in", "acrn-bootdisk-microcode.wks.in", d)}" 37 | 38 | # Disable auto ethernet DHCP as its handled by ACRN tools 39 | PACKAGECONFIG:remove:pn-systemd-conf = "dhcp-ethernet" 40 | -------------------------------------------------------------------------------- /conf/distro/acrn-demo-user-vm.conf: -------------------------------------------------------------------------------- 1 | require conf/distro/include/acrn-demo.inc 2 | 3 | DISTRO .= "-user-vm" 4 | DISTRO_NAME += "(User VM)" 5 | 6 | PREFERRED_PROVIDER_virtual/kernel ?= "linux-intel-acrn-user-vm" 7 | PREFERRED_VERSION_linux-intel-acrn-user-vm ?= "6.1%" 8 | PREFERRED_VERSION_linux-intel-acrn-rtvm ?= "6.1%" 9 | 10 | # UOS images are always ext4 11 | IMAGE_FSTYPES = "wic ext4" 12 | 13 | # Ensure images typically include networkd-config so that networking is 14 | # configured. 15 | MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "networkd-config" 16 | 17 | LINUX_RT_APPEND ?= "${@bb.utils.contains('PREFERRED_PROVIDER_virtual/kernel', 'linux-intel-rt-acrn-uos', 'clocksource=tsc tsc=reliable x2apic_phys processor.max_cstate=0 intel_idle.max_cstate=0 intel_pstate=disable mce=ignore_ce audit=0 isolcpus=nohz,domain,1 nohz_full=1 rcu_nocbs=1 nosoftlockup idle=poll irqaffinity=0 no_ipi_broadcast=1', '', d)}" 18 | APPEND += " rw nohpet console=hvc0 console=ttyS0 no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable \ 19 | i915.nuclear_pageflip=1 ${LINUX_RT_APPEND}" 20 | -------------------------------------------------------------------------------- /conf/distro/include/acrn-demo.inc: -------------------------------------------------------------------------------- 1 | DISTRO = "acrn-demo" 2 | DISTRO_NAME = "ACRN Demo" 3 | DISTRO_VERSION = "4.2+snapshot-${DATE}" 4 | 5 | DISTRO_FEATURES = "${DISTRO_FEATURES_DEFAULT} \ 6 | systemd efi largefile opengl ptest multiarch \ 7 | wayland vulkan pulseaudio bluez5 gobject-introspection-data \ 8 | pam usrmerge" 9 | 10 | VIRTUAL-RUNTIME_init_manager = "systemd" 11 | DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" 12 | # systemd hardcodes /root in its source codes, other values are not offically supported 13 | ROOT_HOME = "/root" 14 | 15 | WARN_TO_ERROR_QA = "already-stripped compile-host-path install-host-path \ 16 | installed-vs-shipped ldflags pn-overrides rpaths staticdev \ 17 | unknown-configure-option useless-rpaths" 18 | WARN_QA:remove = "${WARN_TO_ERROR_QA}" 19 | ERROR_QA:append = " ${WARN_TO_ERROR_QA}" 20 | 21 | require conf/distro/include/no-static-libs.inc 22 | require conf/distro/include/yocto-uninative.inc 23 | require conf/distro/include/security_flags.inc 24 | INHERIT += "uninative" 25 | 26 | # Set the Sato network manager to be systemd, instead of connman. 27 | # The Service VM needs to use networkd to get the bridges working correctly, and 28 | # networkd makes guest networking trivial. 29 | NETWORK_MANAGER = "systemd" 30 | -------------------------------------------------------------------------------- /conf/layer.conf: -------------------------------------------------------------------------------- 1 | BBPATH .= ":${LAYERDIR}" 2 | 3 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ 4 | ${LAYERDIR}/recipes-*/*/*.bbappend" 5 | 6 | BBFILE_COLLECTIONS += "meta-acrn" 7 | BBFILE_PATTERN_meta-acrn = "^${LAYERDIR}/" 8 | BBFILE_PRIORITY_meta-acrn = "5" 9 | 10 | LAYERDEPENDS_meta-acrn = "core intel meta-python" 11 | LAYERSERIES_COMPAT_meta-acrn = "scarthgap styhead walnascar" 12 | -------------------------------------------------------------------------------- /docs/dm-verity.md: -------------------------------------------------------------------------------- 1 | To enable Dm-verity for service OS: 2 | 3 | Add meta-security and depedency layers in bblayer.conf 4 | 5 | ~/meta-intel \ 6 | ~/meta-acrn \ 7 | ~/meta-openembedded/meta-oe \ 8 | ~/meta-openembedded/meta-filesystems \ 9 | ~/meta-openembedded/meta-python \ 10 | ~/meta-openembedded/meta-networking \ 11 | ~/meta-openembedded/meta-perl \ 12 | ~/meta-virtualization \ 13 | ~/meta-security \ 14 | 15 | 16 | Create conf/multiconfig/sos.conf. 17 | 18 | 19 | ``` 20 | MACHINE = "intel-corei7-64" 21 | TMPDIR = "${TOPDIR}/master-acrn-sos" 22 | DISTRO = "acrn-demo-service-vm" 23 | 24 | CONTAINER_PACKAGE_DEPLOY_DIR = "${TOPDIR}/master-acrn-uos/deploy/images/${MACHINE}" 25 | CONTAINER_PACKAGE_MC = "uos" 26 | 27 | PREFERRED_PROVIDER_virtual/kernel = "linux-intel-acrn-service-vm" 28 | PREFERRED_VERSION_linux-intel-acrn-service-vm = "5.10%" 29 | 30 | IMAGE_CLASSES += "dm-verity-img" 31 | 32 | #ACRN image, which you want to build i.e acrn-image-base, acrn-image-sato, acrn-image-weston etc 33 | DM_VERITY_IMAGE = "acrn-image-*" 34 | DM_VERITY_IMAGE_TYPE = "ext4" 35 | 36 | INITRAMFS_IMAGE = "dm-verity-image-initramfs" 37 | INITRAMFS_FSTYPES = "cpio.gz" 38 | INITRAMFS_IMAGE_BUNDLE = "1" 39 | 40 | # list of pre-launched vm including Service vm 41 | VMFLAGS = " vm0 " 42 | 43 | # update the ACRN_EFI_BOOT_CONF for the kernel image with initramfs bundled 44 | # default value for vm0 based on industry scenario for nuc7i7dnb 45 | VM_APPEND_vm0 = "${APPEND}" 46 | KERNEL_IMAGE_vm0 = "${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin" 47 | KERNEL_MOD_vm0 = "Linux_bzImage" 48 | ``` 49 | 50 | conf/local.conf should enable multiconfig build for Service VM (sos) 51 | 52 | ``` 53 | BBMULTICONFIG = "sos" 54 | 55 | # Or, to buid User VM too 56 | BBMULTICONFIG = "sos uos" 57 | ``` 58 | 59 | Trigger bitbake to build acrn image: 60 | ``` 61 | $ bitbake mc:sos:acrn-image-base 62 | 63 | ``` 64 | 65 | On Boot of *.wic image, rootfs filesystem will be Read-only. 66 | -------------------------------------------------------------------------------- /docs/getting-started.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | This guide will show how to set up the host machine for Yocto build and then how to build and boot ACRN Hypervisor, Service VM and User VMs on Intel platforms. 4 | 5 | ## Table of Contents 6 | ================= 7 | 8 | I. [Overview](#overview) 9 | 10 | II. [Set Up Build Host](#set-up-build-host) 11 | * [Compatible Linux Distribution](#compatible-linux-distribution) 12 | * [Required Packages for Build Host](#required-packages-for-build-host) 13 | 14 | III. [Building ACRN Bootable Image](#building-acrn-bootable-image) 15 | * [Dependencies](#dependencies) 16 | * [Build Image](#build-image) 17 | - [Download Layers and Initialize Build Environment](#download-layers-and-initialize-build-environment) 18 | - [Configure Service VM (SOS)](#configure-service-vm-sos) 19 | - [Configure Post-launched User VM (UOS)](#configure-post-launched-user-vm-uos) 20 | - [Build User VM (UOS) image via multiconfig](#build-uos-image-via-multiconfig) 21 | - [Build ACRN image](#build-acrn-image) 22 | 23 | IV. [Booting ACRN Image](#booting-acrn-image) 24 | * [Boot ACRN and Service OS](#boot-acrn-and-sos) 25 | * [Launching User VM](#launching-uos) 26 | - [USB Passthrough](#usb-passthrough) 27 | 28 | V. [Configurations](#configurations) 29 | * [MACHINE Configuration](#machine-configuration) 30 | * [Adding Guests](#adding-guests) 31 | * [ACRN Configuration](#acrn-configuration) 32 | - [ACRN BOARD Configuration](#acrn-board-configuration) 33 | - [ACRN SCENARIO Configuration](#acrn-scenario-configuration) 34 | - [ACRN BUILD MODE Configuration](#acrn-build-mode-configuration) 35 | * [Kernel Configuration](#kernel-configuration) 36 | - [Service VM](#service-os) 37 | - [User VM](#user-os) 38 | * [GRUB Configuration](#grub-configuration) 39 | * [Override distro configuration](#override-distro-configuration) 40 | 41 | VI. [Build WIC Installer Image](#build-wic-installer-image) 42 | 43 | VII. [Tested Hardware](#tested-hardware) 44 | 45 | VIII.[Contributing](#contributing) 46 | 47 | ## Overview 48 | This layer provides ACRN Hypvervisor integration with Yocto Project. 49 | 50 | ## Supported Hardware 51 | 52 | ACRN is supported on the following Intel platforms: 53 | * Tiger Lake 54 | * Alder Lake 55 | * Raptor Lake 56 | 57 | About minimum system requirements and limitations, please find more information at [Supported Hardware](https://projectacrn.github.io/3.2/reference/hardware.html) 58 | 59 | 60 | ## Set Up Build Host 61 | 62 | ### Compatible Linux Distribution 63 | Make sure your build host meets the following requirements: 64 | 65 | - 90 Gbytes of free disk space 66 | - 8 Gbytes of RAM 67 | - Runs a supported Linux distribution 68 | 69 | Currently, the Yocto Project is supported on a number of Linux Distributions. This guide covers only for Ubuntu 22.04 (LTS). To know more about the complete list of supported Linux distributions, please visit [Supported Linux Distributions](https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#detailed-supported-distros) 70 | - Git 1.8.3.1 or greater 71 | - tar 1.28 or greater 72 | - Python 3.8.0 or greater 73 | - gcc 8.0 or greater 74 | - GNU make 4.0 or greater 75 | 76 | ### Required Packages for Build Host 77 | Install essential host packages on your build host (Ubuntu): 78 | 79 | ``` 80 | $ sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev python3-subunit mesa-common-dev zstd liblz4-tool file locales 81 | $ sudo locale-gen en_US.UTF-8 82 | ``` 83 | 84 | ## Building ACRN Bootable Image 85 | 86 | 87 | ### Dependencies 88 | 89 | meta-acrn layer depends on: 90 | * [poky](https://git.yoctoproject.org/cgit/cgit.cgi/poky), branch master [or kirkstone] 91 | * [meta-oe](https://github.com/openembedded/meta-openembedded/tree/master/meta-oe), branch master [or kirkstone] 92 | * [meta-python](https://github.com/openembedded/meta-openembedded/tree/master/meta-python), branch master [or kirkstone] 93 | * [meta-filesystems](https://github.com/openembedded/meta-openembedded/tree/master/meta-filesystems), branch master [or kirkstone] 94 | * [meta-networking](https://github.com/openembedded/meta-openembedded/tree/master/meta-networking), branch master [or kirkstone] 95 | * [meta-virtualization](https://git.yoctoproject.org/cgit/cgit.cgi/meta-virtualization), branch master [or kirkstone] 96 | * [meta-intel](https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel), branch master [or kirkstone] 97 | 98 | ### Build Image 99 | 100 | #### Download Layers and Initialize Build Environment 101 | 102 | * Create build workspace 103 | ``` 104 | $ mkdir workspace 105 | ``` 106 | 107 | * Clone poky 108 | ``` 109 | $ cd workspace 110 | $ git clone https://git.yoctoproject.org/git/poky 111 | ``` 112 | * Clone all dependent layers 113 | ``` 114 | $ cd poky 115 | $ git clone https://github.com/openembedded/meta-openembedded.git 116 | $ git clone https://git.yoctoproject.org/git/meta-virtualization 117 | $ git clone https://git.yoctoproject.org/git/meta-intel 118 | $ git clone https://github.com/intel/meta-acrn.git 119 | ``` 120 | * Initialize build environment 121 | ``` 122 | $ source oe-init-build-env 123 | ``` 124 | 125 | * Add layers to build environment `conf/bblayers.conf` 126 | ``` 127 | $ bitbake-layers add-layer ../meta-openembedded/meta-oe 128 | $ bitbake-layers add-layer ../meta-openembedded/meta-python 129 | $ bitbake-layers add-layer ../meta-openembedded/meta-filesystems 130 | $ bitbake-layers add-layer ../meta-openembedded/meta-networking 131 | $ bitbake-layers add-layer ../meta-virtualization 132 | $ bitbake-layers add-layer ../meta-intel 133 | $ bitbake-layers add-layer ../meta-acrn 134 | ``` 135 | 136 | #### Configure Service VM (SOS) 137 | 138 | meta-acrn maintains prototype DISTRO configurations for both Servcie VM OS (SOS) and User VM OS (UOS). `acrn-demo-service-vm` for Service VM OS and `acrn-demo-user-vm` for User VM OS. 139 | `local.conf` carries the common configuration, which can be overwritten by individual multiconfigs `conf/multiconfig/xxx.conf` 140 | For the Service VM OS, we carry configuration in `conf/local.conf` and for User VM OS we carry in `conf/multiconfig/uos.conf` 141 | 142 | 143 | Append the following configuration in `conf/local.conf`: 144 | 145 | ``` 146 | MACHINE = "intel-corei7-64" 147 | TMPDIR = "${TOPDIR}/master-acrn-sos" 148 | DISTRO = "acrn-demo-service-vm" 149 | 150 | # Also use the 'uos' configuration 151 | BBMULTICONFIG = "uos" 152 | 153 | # The packages-from-images class (container-package.bbclass) needs to know where images are 154 | CONTAINER_PACKAGE_DEPLOY_DIR = "${TOPDIR}/master-acrn-uos/deploy/images/${MACHINE}" 155 | CONTAINER_PACKAGE_MC = "uos" 156 | 157 | # Add core-image-base-package to acrn-image-base 158 | IMAGE_INSTALL:append:pn-acrn-image-base = " core-image-base-package" 159 | # Add core-image-weston-package to acrn-image-sato 160 | IMAGE_INSTALL:append:pn-acrn-image-sato = " core-image-weston-package" 161 | 162 | # set preferred kernel for sos 163 | PREFERRED_PROVIDER_virtual/kernel = "linux-intel-acrn-service-vm" 164 | ``` 165 | 166 | #### Configure Post-launched User VM (UOS) 167 | 168 | Add the following in `conf/multiconfig/uos.conf`: 169 | 170 | ``` 171 | DISTRO = "acrn-demo-user-vm" 172 | TMPDIR = "${TOPDIR}/master-acrn-uos" 173 | PREFERRED_PROVIDER_virtual/kernel = "linux-intel-acrn-user-vm" 174 | ``` 175 | 176 | > Note how the parent `local.conf` refers to what `DEPLOY_DIR_IMAGE` will be in `uos.conf`. Remember to keep these in sync. 177 | 178 | #### Build ACRN image 179 | 180 | > Based on your target image, It can be: 181 | > - acrn-image-base 182 | > - acrn-image-sato 183 | > - acrn-image-weston 184 | > - acrn-image-minimal 185 | 186 | ``` 187 | $ bitbake acrn-image-base 188 | ``` 189 | 190 | By default, building `acrn-image-base` will build a `.wic` image and can be located at `build/master-acrn-sos/deploy/images/intel-corei7-64/`. 191 | 192 | Based on configuration, it will also build post-launched VM and install on acrn-image-*.wic along with launch script. Separately user VMs can be located at `build/master-acrn-uos/deploy/images/intel-corei7-64/`. User VM images can be core-image-base, core-image-sato and core-image-weston. 193 | 194 | ## Booting ACRN Image 195 | 196 | ### Boot ACRN and Service VM 197 | 198 | On successful build, you will find the ACRN bootable image `acrn-image-base-intel-corei7-64.wic` in the `build/master-acrn-sos/deploy/images/intel-corei7-64/` directory. 199 | 200 | Under Linux, insert a USB flash drive. Assuming the USB flash drive 201 | takes device `/dev/sdf`, use `dd` to copy the image to it. Before the image 202 | can be burned onto a USB drive, it should be un-mounted. Some Linux distros 203 | may automatically mount a USB drive when it is plugged in. Using USB device 204 | /dev/sdf as an example, find all mounted partitions: 205 | ``` 206 | $ mount | grep sdf 207 | ``` 208 | and un-mount those that are mounted, for example: 209 | ``` 210 | $ umount /dev/sdf1 211 | $ umount /dev/sdf2 212 | ``` 213 | Now burn the image onto the USB drive: 214 | ``` 215 | $ sudo dd if=acrn-image-base-intel-corei7-64.wic of=/dev/sdf status=progress 216 | $ sync 217 | $ eject /dev/sdf 218 | ``` 219 | This should give you a bootable USB flash device. Insert the device into a bootable USB socket on the target, and power on. It should give two boot options, 'boot' and 'ACRN (Yocto)'. Select 'ACRN (Yocto)' to spawn hypervisor, while 'boot' to boot as normal Linux. 220 | 221 | ### Launching User VM 222 | 223 | ``` 224 | $ /var/lib/machines/launch-base.sh 225 | ``` 226 | 227 | #### USB Passthrough 228 | 229 | Once a graphical UOS has been started you'll want to interact with it. One simple solution is to set the relevant variables so that logging into the console can access the display. 230 | 231 | For X: 232 | 233 | ``` 234 | $ export DISPLAY=:1 235 | ``` 236 | 237 | And for Weston: 238 | 239 | ``` 240 | $ export XDG_RUNTIME_DIR=/run/user/$(id -u) 241 | ``` 242 | 243 | That will let you start applications but you still can't interact with them: good enough for running glmark2 but not for anything interactive. For this, USB host virtualisation lets you pass specific USB ports through to the guest. Start by using `lsusb` to identify the bus and port you want to forward, and then edit `launch-weston.sh` or similar to pass another option to `acrn-dm`: 244 | 245 | ``` 246 | -s 7,xhci,1-1,1-2 247 | ``` 248 | 249 | This forwards ports 1-1 and 1-2 into the UOS, which on Skull Canyon is the two front ports (1-1 on the left, 1-2 on the right). You'll need two input devices for this to work, obviously. 250 | 251 | 252 | 253 | ## Configurations 254 | 255 | ### MACHINE Configuration 256 | 257 | [meta-intel](https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel) provides the following machine configurations: 258 | 259 | * intel-corei7-64 260 | 261 | * intel-skylake-64 262 | 263 | > intel-skylake-64 is 64-bit machine with -march=skylake and avx2 instruction-set set up. For more information, please check [intel-skylake-64.conf](http://git.yoctoproject.org/cgit/cgit.cgi/meta-intel/tree/conf/machine/intel-skylake-64.conf) 264 | 265 | > intel-skylake-64 machine must be used for Skylake and successor platforms 266 | 267 | 268 | To configure MACHINE, set the following in your `conf/local.conf` 269 | ``` 270 | MACHINE = "intel-corei7-64" 271 | ``` 272 | 273 | ### Adding Guests 274 | 275 | The multiconfig/package magic works with a `-package.bb` recipe that inherits `container-package`. This puts the wic image and launcher script into a package which can be added as usual. 276 | 277 | To add core-image-base.wic image into Service OS (Add core-image-base-package to your target ACRN image) 278 | ``` 279 | IMAGE_INSTALL:append:pn-acrn-image-base = " core-image-base-package" 280 | ``` 281 | 282 | To add core-image-weston-package to acrn-image-weston 283 | ``` 284 | IMAGE_INSTALL:append:pn-acrn-image-weston = " core-image-weston-package" 285 | ``` 286 | 287 | To add core-image-weston-package to acrn-image-base 288 | ``` 289 | IMAGE_INSTALL:append:pn-acrn-image-base = " core-image-weston-package" 290 | ``` 291 | 292 | ### ACRN Configuration 293 | 294 | #### ACRN BOARD Configuration 295 | 296 | To build for your target board, set `ACRN_BOARD` in your `conf/local.conf`. By default it is set to `nuc11tnbi5` 297 | ``` 298 | ACRN_BOARD = "whl-ipc-i5" 299 | ``` 300 | 301 | Supported Boards: 302 | - nuc11tnbi5 303 | - alderlake 304 | - raptorlake 305 | 306 | For More information, Please check [Supported Hardware](https://projectacrn.github.io/3.2/reference/hardware.html) 307 | 308 | #### ACRN SCENARIO Configuration 309 | 310 | To build for your acrn scenario, set `ACRN_SCENARIO` in your `conf/local.conf`. By default it is set to `shared` scenario. 311 | ``` 312 | ACRN_SCENARIO = "hybrid" 313 | ``` 314 | Supported scenarios: 315 | - sdc 316 | - shared 317 | - partitioned 318 | - hybrid 319 | - hybrid_rt 320 | 321 | For more information, please check [Generate a Scenario Configuration File and Launch Scripts](https://projectacrn.github.io/3.2/getting-started/getting-started.html#generate-a-scenario-configuration-file-and-launch-script) 322 | 323 | To customize ACRN Configruation, please check [Introduction to ACRN Configuration](https://projectacrn.github.io/3.2/tutorials/acrn_configuration_tool.html) 324 | 325 | #### ACRN BUILD MODE Configuration 326 | 327 | To build ACRN in `RELEASE` mode, set `y` to `ACRN_RELEASE` in your `conf/local.conf`. By default it is set to `n` 328 | ``` 329 | ACRN_RELEASE = "y" 330 | ``` 331 | 332 | To build ACRN in `DEBUG` mode, set `n` to `ACRN_RELEASE` in your `conf/local.conf`. 333 | ``` 334 | ACRN_RELEASE = "n" 335 | ``` 336 | 337 | ### Kernel Configuration 338 | 339 | There are multiple kernel variant available for both Service VM and User VM. 340 | 341 | #### Service VM 342 | 343 | To switch to linux-intel-acrn-service-vm LTS 5.15 kernel (default), in 'local.conf' replace with the following lines: 344 | ``` 345 | PREFERRED_PROVIDER_virtual/kernel = "linux-intel-acrn-service-vm" 346 | PREFERRED_VERSION_linux-intel-acrn-service-vm = "5.15%" 347 | ``` 348 | 349 | To switch to linux-intel-acrn-service-vm mainline tracking 5.19 kernel, in 'local.conf' replace with the following lines: 350 | ``` 351 | PREFERRED_PROVIDER_virtual/kernel = "linux-intel-acrn-service-vm" 352 | PREFERRED_VERSION_linux-intel-acrn-service-vm = "5.19%" 353 | ``` 354 | 355 | #### User VM 356 | 357 | 358 | To switch to linux-intel-acrn-user-vm LTS 5.15 kernel (default), in 'conf/multiconfig/uos.conf' replace with following lines: 359 | ``` 360 | PREFERRED_PROVIDER_virtual/kernel = "linux-intel-acrn-user-vm" 361 | PREFERRED_VERSION_linux-intel-acrn-user-vm = "5.15%" 362 | ``` 363 | 364 | To switch to linux-intel-acrn-user-vm mainline tracking 5.19 kernel, in 'conf/multiconfig/uos.conf' replace with following lines: 365 | ``` 366 | PREFERRED_PROVIDER_virtual/kernel = "linux-intel-acrn-user-vm" 367 | PREFERRED_VERSION_linux-intel-acrn-user-vm = "5.19%" 368 | ``` 369 | 370 | To switch to linux-intel-acrn-rtvm Preempt-RT 5.15 kernel, in 'conf/multiconfig/uos.conf' replace with following line: 371 | ``` 372 | PREFERRED_PROVIDER_virtual/kernel = "linux-intel-acrn-rtvm" 373 | PREFERRED_VERSION_linux-intel-acrn-rtvm = "5.15%" 374 | ``` 375 | 376 | To switch to linux-intel-acrn-rtvm Preempt-RT mainline tracking 5.19 kernel, in 'conf/multiconfig/uos.conf' replace with following line: 377 | ``` 378 | PREFERRED_PROVIDER_virtual/kernel = "linux-intel-acrn-rtvm" 379 | PREFERRED_VERSION_linux-intel-acrn-rtvm = "5.19%" 380 | ``` 381 | 382 | ### GRUB Configuration 383 | 384 | Following variables are used to prepare kernel command lines for Pre-launched User VMs and Service VM. Based on these variables an ACRN specific `grub.cfg` gets generated. 385 | These variables can be overwritten in your local config. 386 | 387 | * VMFLAGS - list of pre-launched VMs including Service VM 388 | For example: VMFLAGS = "vm0 vm1 ... vmx" 389 | 390 | * VM_APPEND - VM kernel commandline 391 | * KERNEL_IMAGE - kernel image like bzImage for each vm 392 | * KERNEL_MOD - kern_mod tag in acrn scenario xml for each 393 | * ACPI_TAG - ACPI tag for specific VM 394 | * ACPI_BIN - binary of ACPI tables for a specific vm 395 | * PART_LABEL - Partition Label, if set, it allow grub bootloader to pick modules/kernel binaries by partition label 396 | 397 | 398 | For example, using hybrid scenario for nuc7i7dnb: 399 | 400 | VMFLAGS = "vm0 vm1" 401 | # vm0 (prelaunch vm zephyr) 402 | VM_APPEND_vm0 = "xxx" 403 | KERNEL_IMAGE_vm0 = "/custom path/zephyr.bin" 404 | KERNEL_MOD_vm0 = "Zephyr_RawImage" 405 | ACPI_TAG_vm0 = "ACPI_VM0" 406 | ACPI_BIN_vm0 = "ACPI_VM0.bin" 407 | PART_LABEL_vm0 = "zephyr module partition label" 408 | 409 | # vm1 (sos) 410 | VM_APPEND_vm1 = "xxx" 411 | KERNEL_IMAGE_vm1 = "/custom path/bzImage" //Pass complete path 412 | KERNEL_MOD_vm1 = "Linux_bzImage" 413 | PART_LABEL_vm1 = "boot" 414 | 415 | * ACRN_EFI_GRUB2_MOD_CFG wic variable (semicolon (;) separated list) 416 | to make additional entries in grub.cfg i.e insmod ext3 417 | 418 | Additionaly grub bootloader uses 'search' command at grub menu entry to find the device by file (--file). 419 | 420 | * ACRN_HV_EFI_CFG wic variable to add ACRN Hyperviosr parameters 421 | 422 | For more information, please check [Update Ubuntu GRUB](https://projectacrn.github.io/3.2/tutorials/using_hybrid_mode_on_nuc.html#update-ubuntu-grub), [acrn-bootconf.bbclass](https://github.com/intel/meta-acrn/blob/master/classes/acrn-bootconf.bbclass) and [ACRN Hypervisor Parameters](https://projectacrn.github.io/latest/user-guides/hv-parameters.html#acrn-hypervisor-parameters) 423 | 424 | 425 | ### Override distro configuration 426 | 427 | Due to parsing sequence conflict with `meta-intel`, weak assignments are not used in `acrn-demo-service-vm` and `acrn-demo-user-vm` distros. So to override distro configuration in `conf/local.conf`, override syntax can be used i.e 428 | ``` 429 | WKS_FILE_acrn-demo-service-vm = "your-custom.wks.in" 430 | ``` 431 | 432 | 433 | ## Build WIC Installer Image 434 | 435 | To install the image on to NUC, you could burn the .wic image to the target hardware's internal storage. 436 | 437 | Alternatively, you could build a wic based installer image where you can burn the .wic image onto USB flash drive and use USB flash drive as installer. To build the installer image for ACRN, add the following lines to `conf/local.conf`: 438 | 439 | ``` 440 | BBMULTICONFIG:append = " installer " 441 | ``` 442 | 443 | Add followings in `conf/multiconfig/installer.conf`: 444 | 445 | ``` 446 | # use the installer wks file 447 | WKS_FILE:pn-acrn-image-base = "image-installer.wks.in" 448 | 449 | # build initramsfs to start the installation 450 | INITRD_IMAGE_LIVE="core-image-minimal-initramfs" 451 | 452 | # make sure initramfs and ext4 image are ready before building wic image 453 | do_image_wic[depends] += "${INITRD_IMAGE_LIVE}:do_image_complete" 454 | IMAGE_TYPEDEP_wic = "ext4" 455 | 456 | # content to be installed 457 | IMAGE_BOOT_FILES:append = "\ 458 | ${KERNEL_IMAGETYPE} \ 459 | acrn.bin;esp/acrn.bin \ 460 | microcode.cpio;esp/microcode.cpio \ 461 | grub-efi-bootx64.efi;EFI/BOOT/bootx64.efi \ 462 | ${IMAGE_ROOTFS}/boot/EFI/BOOT/grub.cfg;esp/EFI/BOOT/grub.cfg \ 463 | ${IMGDEPLOYDIR}/${IMAGE_BASENAME}-${MACHINE}.ext4;rootfs.img \ 464 | " 465 | ``` 466 | 467 | Now build the installer image: 468 | 469 | ``` 470 | $ bitbake mc:installer:acrn-image-base 471 | ``` 472 | 473 | ## Tested Hardware 474 | The following undergo regular basic testing with their respective MACHINE types. 475 | 476 | intel-corei7-64: 477 | NUC11TNHi5 478 | 479 | intel-skylake-64: 480 | NUC11TNHi5 481 | 482 | 483 | ## Contributing 484 | You are encouraged to follow Github Pull request workflow to share changes and following commit message guidelines are recommended [OE patch guidelines](https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines) 485 | 486 | Layer Maintainer: Chee Yang Lee 487 | -------------------------------------------------------------------------------- /docs/logical-partition.md: -------------------------------------------------------------------------------- 1 | # Setup for Logical partition 2 | 3 | Example on build and setup for logical partition, these are based on default configuration from acrn-hypervisor for nuc7i7dnb logical_partition scenario. In this case, vm0 have its rootfs on SATA while vm1 on USB storage. The target device/Nuc should set to boot from SATA first. 4 | 5 | ### Setup 6 | add multiconfig and common setting for both vm in local.conf 7 | ``` 8 | MACHINE = "intel-corei7-64" 9 | DISTRO = " acrn-demo-user-vm" 10 | BBMULTICONFIG = "vm0 vm1" 11 | 12 | # update fstab in this case can cause problem to mount rootfs 13 | WIC_CREATE_EXTRA_ARGS = " --no-fstab-update " 14 | ``` 15 | 16 | setting for VM0 in 'conf/multiconfig/vm0.conf' 17 | ``` 18 | TMPDIR = "${TOPDIR}/master-acrn-vm0" 19 | ACRN_SCENARIO = "logical_partition" 20 | 21 | EFI_PROVIDER = "grub-efi" 22 | GRUB_BUILDIN:append = " multiboot2 " 23 | 24 | # required setting for ESP 25 | WICVARS:append = " ACRN_EFI_BOOT_CONF " 26 | ACRN_EFI_BOOT_CONF = "${KERNEL_IMAGETYPE}:Linux_bzImage:root=/dev/sda2 ${APPEND};ACPI_VM0.bin:ACPI_VM0;ACPI_VM1.bin:ACPI_VM1;" 27 | IMAGE_EFI_BOOT_FILES = "ACPI_VM0.bin ACPI_VM1.bin" 28 | WKS_FILE = "acrn-bootdisk-microcode.wks.in" 29 | ``` 30 | 31 | setting for VM1 in 'conf/multiconfig/vm1.conf' 32 | ``` 33 | # output vm1 image to another directory 34 | TMPDIR = "${TOPDIR}/master-acrn-vm1" 35 | ``` 36 | 37 | In this case both vm are User VM, build acrn-hypervisor separately so it can be inject into VM0 ESP. 38 | ``` 39 | $ bitbake multiconfig:vm0:acrn-hypervisor 40 | $ bitbake multiconfig:vm0:core-image-base 41 | $ bitbake multiconfig:vm1:core-image-base 42 | ``` 43 | 44 | flash vm0 wic image to SATA device and flash vm1 wic image to USB storage. 45 | -------------------------------------------------------------------------------- /docs/qa.md: -------------------------------------------------------------------------------- 1 | # Testing Procedure 2 | 3 | ## Test Hardware 4 | 5 | All tests should be ran primarily on the supported platform: 6 | 7 | * Tiger Lake NUC ([details here](https://projectacrn.github.io/2.7/reference/hardware.html#verified-platforms-according-to-acrn-usage)) 8 | 9 | ### Console Guest Functional 10 | 11 | Verify that `acrn-image-base` SOS will start `core-image-base` UOS successfully. 12 | 13 | ### Graphical Guest Functional 14 | 15 | Verify that `acrn-image-sato` SOS will start `core-image-sato` UOS successfully. 16 | 17 | Verify that `acrn-image-sato` SOS will start `core-image-weston` UOS successfully. 18 | 19 | The SOS/UOS should be configured such that the SOS is on one display and the UOS is a second display. 20 | 21 | ### Graphical Performance 22 | 23 | Verify using benchmarks (e.g. glmark terrain, Unigine Valley) that GL performance inside the UOS is within 10% of the same benchmarks in the SOS under ACRN and within 10% of the same benchmarks in the UOS image using meta-intel's kernel. 24 | -------------------------------------------------------------------------------- /docs/references.md: -------------------------------------------------------------------------------- 1 | # References 2 | 3 | ## ACRN Overview 4 | 5 | * [Introduction to ACRN](https://projectacrn.github.io/2.7/introduction/index.html). Good overview. 6 | * [Virtio Supported Devices](https://projectacrn.github.io/2.7/developer-guides/hld/hld-virtio-devices.html#supported-virtio-devices). Some of these virtio devices are *not* upstream yet, and are only in Production Kernel. 7 | * [Configuring ACRN's memory use](https://projectacrn.github.io/2.7/faq.html#how-do-i-configure-acrn-s-memory-use). I hope one day this isn't required. Currently we don't expose a nice way to control this in the layer (see #12). 8 | 9 | ## GVT 10 | 11 | * [Enable GVT-d in ACRN](https://projectacrn.github.io/2.7/tutorials/gpu-passthru.html). 12 | * [GVT Kernel Options](https://projectacrn.github.io/2.7/user-guides/kernel-parameters.html#gvt-g-acrngt-kernel-options-details) 13 | * [Mesa Environment Variables](https://www.mesa3d.org/envvars.html). Useful to get FPS or force software paths for benchmarking. 14 | 15 | ## Other 16 | 17 | * [USB passthrough](https://projectacrn.github.io/2.7/developer-guides/hld/usb-virt-hld.html#usb-host-virtualization) 18 | 19 | ## Kernels 20 | 21 | * [Intel Production Kernel](https://github.com/intel/linux-intel-lts), as built in `meta-intel` by `linux-intel*.bb`. This is what `meta-acrn` builds. 22 | -------------------------------------------------------------------------------- /docs/slimbootloader.md: -------------------------------------------------------------------------------- 1 | # Boot ACRN Hypervisor with Slim Bootloader 2 | ACRN Hypervisor can boot with Slim Bootloader. This page shows a workflow to generate the multiboot compliant container image to boot ACRN Hypervisor in the hybrid scenario with Slim Bootloader. 3 | 4 | ### Build Requirements 5 | * openembedded-core, branch master 6 | * meta-intel, branch master 7 | * meta-acrn, branch master 8 | 9 | ### 1. Setup project 10 | ``` 11 | $ git clone https://git.yoctoproject.org/git/poky 12 | $ git clone https://git.yoctoproject.org/git/meta-intel 13 | $ git clone https://git.openembedded.org/meta-openembedded 14 | $ git clone https://github.com/intel/meta-acrn.git 15 | $ source poky/oe-init-build-env 16 | build $ bitbake-layers add-layer \ 17 | ../meta-intel \ 18 | ../meta-acrn \ 19 | ../meta-openembedded/meta-oe 20 | ``` 21 | 22 | ### 2. Configure local conf 23 | ``` 24 | build $ echo "MACHINE = \"intel-corei7-64\"" >> conf/local.conf 25 | build $ echo "BBMULTICONFIG = \"sos\"" >> conf/local.conf 26 | ``` 27 | 28 | ### 3. Create Service VM config file as below 29 | ``` 30 | build $ mkdir conf/multiconfig 31 | build $ cat conf/multiconfig/sos.conf 32 | TMPDIR = "${TOPDIR}/master-acrn-sos" 33 | DISTRO = "acrn-demo-service-vm" 34 | 35 | PREFERRED_PROVIDER_virtual/kernel = "linux-intel-acrn-service-vm" 36 | PREFERRED_VERSION_linux-intel-acrn-service-vm = "5.10%" 37 | 38 | ACRN_BOARD = "ehl-crb-b" 39 | ACRN_SCENARIO = "hybrid" 40 | 41 | IMAGE_CLASSES:append = " acrn-sblimage" 42 | MB_ACRN_MODULES = "\ 43 | ${TOPDIR}/conf/zephyr.txt;${TOPDIR}/conf/zephyr.bin \ 44 | ${TOPDIR}/conf/linux.txt;${TMPDIR}/deploy/images/${MACHINE}/${KERNEL_IMAGETYPE} \ 45 | " 46 | ``` 47 | Appending the acrn-sblimage class will run a bitbake task to generate the container image including the module files specified in the MB_ACRN_MODULES list. 48 | Note: You should not set acrn-sblimage in loca.conf because it will cause a build error when you build Yocto UOS. 49 | 50 | ### 4. Create module tag files 51 | ``` 52 | build$ echo Linux_bzImage > conf/linux.txt 53 | build$ echo Zephyr_RawImage > conf/zephyr.txt 54 | ``` 55 | 56 | ### 5. Copy Zephyr image file to the conf/zephyr.bin 57 | Please refer to [Using Zephyr as User OS](https://projectacrn.github.io/2.7/tutorials/using_zephyr_as_user_vm.html) about how to build Zephyr 58 | 59 | ### 6. Generate SBL sign key file 60 | ``` 61 | build$ python $(SBL_ROOT)/BootloaderCorePkg/Tools/GenerateKeys.py -k cert 62 | build$ cp cert/OS1_TestKey_Priv_RSA2048.pem cert/TestSigningPrivateKey.pem 63 | ``` 64 | 65 | Please refer to [SBL Keys Generation](https://slimbootloader.github.io/getting-started/build-host-setup.html#sbl-keys) for the details of SBL tools. 66 | 67 | ### 7. Build Service VM image 68 | ``` 69 | build$ bitbake mc:sos:acrn-image-minimal 70 | ``` 71 | 72 | ### 8. Check the sbl_os container image file has been deployed in the generated wic image 73 | ``` 74 | build$ sudo mount \ 75 | `sudo losetup -f -P --show master-acrn-sos/deploy/images/intel-corei7-64/acrn-image-minimal-intel-corei7-64.wic`p2 \ 76 | /mnt 77 | build$ ls /mnt/boot/ 78 | bzImage bzImage-5.10.*-linux-intel-acrn-sos EFI loader sbl_os 79 | ``` 80 | 81 | ### Optional Other Variables 82 | * MB_DEPENDENCY 83 | Set any tasks you want to run before the acrn_sblimage task start. Normally it is not needed since the acrn_sblimage is scheduled at the very last minute of the Service VM image creation. 84 | 85 | * MB_MC_DEPENDENCY 86 | Set any tasks of User VM you want to run before the acrn_sblimage task start. Typically, it can be used to wait the User VM Linux kernel build in case you want to add the User VM Linux kernel bzImage to the container image so that it can boot as the pre-launched VM. 87 | ``` 88 | MB_MC_DEPENDENCY = "\ 89 | uos:virtual/kernel:do_deply \ 90 | " 91 | ``` 92 | * MB_ACRN_BINARY 93 | Set the path to the ACRN Hypervisor binary file. Normally you don't need to change it from default. 94 | 95 | * MB_ACRN_CMDLINE 96 | Set the file path which includes the ACRN Hypervisor command line. 97 | 98 | * BASE_SBLIMAGE 99 | Set the file name of the generated container image. Default is "sbl_os". 100 | 101 | * PREGENERATED_SIGNING_KEY_SLIMBOOT_KEY_SHA256 102 | Set the path to the image signing key. Default is "${TOPDIR}/cert/TestSigningPrivateKey.pem" 103 | 104 | * BB_CURRENT_MC 105 | Get the Current Configuration using this variable when multiple configuration have specified in conf/local.conf using BBMULTICONFIG variable. 106 | Example: currentMultibootConfig = d.getVar('BB_CURRENT_MC') 107 | 108 | * ACRN_FIRMWARE 109 | Set ACRN_FIRMWARE="uefi" in your Service VM (sos) multiconfig file (Example: conf/multiconfig/sos.conf) to generate the ACRN EFI application which allows to boot your sbl_os image on UEFI-BIOS systems. 110 | See the "Enable ACRN Secure Boot With EFI-Stub" page on the "Project ACRN Documentation" for the details. 111 | The acrn.efi file will be generated in the deployment directory (Example: master-acrn-sos/deploy/images/intel-corei7-64/acrn.efi) 112 | -------------------------------------------------------------------------------- /recipes-bsp/grub/acrn-grub-bootconf.inc: -------------------------------------------------------------------------------- 1 | inherit image-acrn 2 | 3 | do_configure:append(){ 4 | bb.build.exec_func('update_acrn_efi_cfg', d) 5 | } 6 | 7 | python update_acrn_efi_cfg() { 8 | cfile = d.getVar('GRUB_CFG') 9 | if not cfile: 10 | bb.fatal('Unable to read GRUB_CFG') 11 | 12 | root = d.getVar('GRUB_ROOT') 13 | if not root: 14 | bb.fatal('GRUB_ROOT not defined') 15 | 16 | # read configuration generate by oe 17 | try: 18 | cfg = open(cfile, 'rt').read().splitlines() 19 | except OSError: 20 | bb.fatal('Unable to open %s' % cfile) 21 | 22 | # change default boot option 23 | for l in range(len(cfg)): 24 | if cfg[l].startswith("default="): 25 | cfg[l] = "default='ACRN (Yocto)'" 26 | break 27 | 28 | localdata = d.createCopy() 29 | cfg.append("\nmenuentry 'ACRN (Yocto)'{\n") 30 | 31 | cfg.append("multiboot2 /acrn.bin %s %s \n" % ( \ 32 | replace_rootfs_uuid(d, root), \ 33 | replace_rootfs_uuid(d, localdata.getVar('APPEND')) ) ) 34 | 35 | boot_confs = localdata.getVar("ACRN_EFI_BOOT_CONF").split(";") 36 | for boot_conf in boot_confs: 37 | if not boot_conf: 38 | continue 39 | conf = boot_conf.split(":") 40 | if not len(conf) in [2,3,4]: 41 | raise bb.error("unable to parse ACRN_EFI_BOOT_CONF, in \"%s\" (unexpected parameter count: %i) exiting" \ 42 | % boot_conf, len(conf) ) 43 | 44 | search_param = "--file %s" %(conf[0]) 45 | kernel_param = "%s" %(conf[0]) 46 | module_param = "%s" %(conf[1]) 47 | 48 | if len(conf) > 2 and conf[2] != "": 49 | module_param = "%s %s\n" %(conf[1] ,conf[2]) 50 | if len(conf) > 3 and conf[3] != "": 51 | search_param = "--label %s" %(conf[3]) 52 | 53 | cfg.append("search --set=mpath %s \n" %(search_param)) 54 | cfg.append("set modbin=($mpath)%s \n" %(kernel_param)) 55 | cfg.append("module2 $modbin %s\n" %(module_param)) 56 | 57 | cfg.append('\n}\n') 58 | 59 | open(cfile,'w+').write('\n'.join(cfg)) 60 | } 61 | -------------------------------------------------------------------------------- /recipes-bsp/grub/grub-bootconf_1.00.bbappend: -------------------------------------------------------------------------------- 1 | require ${@bb.utils.contains("DISTRO_FEATURES", "ServiceVM", "acrn-grub-bootconf.inc", "", d)} 2 | -------------------------------------------------------------------------------- /recipes-bsp/setserial/setserial/setserial: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # /etc/rc.serial 3 | # Initializes the serial ports on your system 4 | ### BEGIN INIT INFO 5 | # Provides: setserial 6 | # Required-Start: $remote_fs 7 | # Required-Stop: $remote_fs 8 | # Default-Start: S 9 | # Default-Stop: 0 1 6 10 | # Short-Description: controls configuration of serial ports 11 | # Description: Set and/or report the configuration information 12 | # associated with a serial port. This information 13 | # includes what I/O port and which IRQ a particular 14 | # serial port is using. 15 | ### END INIT INFO 16 | # chkconfig: 2345 50 75 17 | # description: This initializes the settings of the serial port 18 | # 19 | # Distributed with setserial version 2.15 20 | # 21 | # XXXX note: as of 2.15, the autosave feature doesn't work if you are 22 | # using the multiport feature; it doesn't save the multiport configuration 23 | # (for now). Autosave also doesn't work for the hayes devices. 24 | #Will fix later... 25 | # 26 | # 27 | # Note that this has been changed so that if /etc/serial.conf exists, 28 | # this script does not configure the ports. It uses 29 | # /var/lib/setserial/autoserial.conf # instead, which is handled by another 30 | # init.d script. However, the script is still used for module loads and 31 | # unloads, even if serial.conf exists. 32 | # 33 | 34 | SETSERIAL=@BINDIR@/setserial 35 | modconf=@LOCALSTATEDIR@/run/setserial.conf 36 | autoconfig=@LOCALSTATEDIR@/lib/setserial/autoserial.conf 37 | etcconfig=@SYSCONFDIR@/serial.conf 38 | 39 | # If the serial executable has been removed abort the configuration 40 | [ -x ${SETSERIAL} ] || exit 0 41 | 42 | # 43 | # make sure that a serial device is loaded... 44 | # insmod -k serial 2>/dev/null 45 | # 46 | 47 | # 48 | # Support devfs when it arrives. 49 | # 50 | if /bin/ls /dev/tts 2> /dev/null 1>&2 ; then 51 | ALLDEVS="/dev/tts/*" 52 | else 53 | # No devfs - old naming scheme 54 | ALLDEVS="/dev/ttyS?" 55 | if /bin/ls /dev/ttyS?? 2> /dev/null 1>&2 ; then 56 | ALLDEVS="$ALLDEVS /dev/ttyS??" 57 | fi 58 | fi 59 | 60 | # 61 | # Handle System V init conventions... 62 | # 63 | case $1 in 64 | start | restart | force-reload ) 65 | action="start"; 66 | ;; 67 | stop) 68 | action="stop"; 69 | ;; 70 | status) 71 | action="status"; 72 | ;; 73 | modload) 74 | action="modload"; 75 | ;; 76 | modsave) 77 | action="modsave"; 78 | ;; 79 | *) 80 | action="restart"; 81 | esac 82 | 83 | if test $action = modload ; then 84 | echo "Restoring persistent state of serial.o module due to module reload... " 85 | if test -f ${modconf} ; then 86 | while read device args 87 | do 88 | case "$device" in 89 | ""|\#*) 90 | continue 91 | ;; 92 | esac 93 | ${SETSERIAL} -z $device $args 94 | done < ${modconf} 95 | else 96 | echo "Warning - no module state found (ok if this is at bootup)" 97 | echo "Using the bootup configuration instead." 98 | action="start"; 99 | fi 100 | exit 0 101 | fi 102 | 103 | if test $action = stop ; then 104 | if [ -e ${etcconfig} ]; then 105 | #nothing to do 106 | dummy=0; 107 | elif test "`sed 1q $autoconfig`X" = "###AUTOSAVE###X" ; then 108 | echo -n "Saving state of known serial devices... " 109 | grep "^#" $autoconfig > ${autoconfig}.new 110 | ${SETSERIAL} -G -g ${ALLDEVS} | grep -v "uart unknown\|pcmcia" >> ${autoconfig}.new 111 | echo -n "backing up $autoconfig" 112 | mv $autoconfig ${autoconfig}.old 113 | mv ${autoconfig}.new $autoconfig 114 | echo " done." 115 | elif test "`sed 1q $autoconfig`X" = "###AUTOSAVE-FULL###X" ; then 116 | echo -n "Saving state (including unknowns) of serial devices... " 117 | grep "^#" $autoconfig > ${autoconfig}.new 118 | ${SETSERIAL} -G -g ${ALLDEVS} | grep -v "pcmcia" >> ${autoconfig}.new 119 | echo -n "backing up $autoconfig" 120 | mv $autoconfig ${autoconfig}.old 121 | mv ${autoconfig}.new $autoconfig 122 | echo " done." 123 | elif test "`sed 1q $autoconfig`X" = "###AUTOSAVE-ONCE###X" ; then 124 | echo -n "Saving state of known serial devices... " 125 | echo "###PORT STATE GENERATED USING AUTOSAVE-ONCE###" > ${autoconfig}.new 126 | grep "^#" $autoconfig >> ${autoconfig}.new 127 | ${SETSERIAL} -G -g ${ALLDEVS} | grep -v "uart unknown\|pcmcia" >> ${autoconfig}.new 128 | echo -n "backing up $autoconfig" 129 | mv $autoconfig ${autoconfig}.old 130 | mv ${autoconfig}.new $autoconfig 131 | echo " done." 132 | fi 133 | exit 0 134 | fi 135 | 136 | # 137 | # Is it Start 138 | # 139 | 140 | if test $action = start ; then 141 | echo "start command" 142 | outmsg="" 143 | echo "Loading the saved-state of the serial devices... " 144 | rm -f ${modconf} 145 | 146 | if test -f $etcconfig ; then 147 | readfrom=$etcconfig; 148 | else 149 | readfrom=$autoconfig; 150 | fi 151 | if test -f $readfrom ; then 152 | while read device args 153 | do 154 | case "$device" in 155 | "#KERNEL") 156 | outmsg="... handled by kernel" 157 | continue 158 | ;; 159 | ""|\#*) 160 | continue 161 | ;; 162 | esac 163 | outmsg="" 164 | ${SETSERIAL} -z $device $args 165 | ${SETSERIAL} -bg $device 166 | done < $readfrom 167 | if test ! "$outmsg" = "" ; then 168 | echo $outmsg 169 | fi 170 | 171 | else 172 | echo "###AUTOSAVE###" > $autoconfig 173 | fi 174 | fi 175 | 176 | if test $action = modsave ; then 177 | echo -n "Saving serial.o state to emulate module data persistence... " 178 | rm -f ${modconf} 179 | ${SETSERIAL} -G -g ${ALLDEVS} | grep -v "uart unknown\|pcmcia" > ${modconf} 180 | echo "done." 181 | exit 0 182 | fi 183 | 184 | if test $action = status ; then 185 | echo "Status of serial devices: ${ALLDEVS}" 186 | for d in ${ALLDEVS}; do 187 | ${SETSERIAL} -a ${d} 188 | done 189 | exit 0 190 | fi 191 | -------------------------------------------------------------------------------- /recipes-bsp/setserial/setserial/setserial.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Documentation=man:setserial(8) 3 | Description=controls configuration of serial ports 4 | Before=system-getty.slice 5 | 6 | [Service] 7 | Type=oneshot 8 | RemainAfterExit=yes 9 | ExecStart=@SYSCONFDIR@/setserial start 10 | ExecStop=@SYSCONFDIR@/setserial stop 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /recipes-bsp/setserial/setserial_%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS:prepend := "${THISDIR}/setserial:" 2 | SRC_URI:append = " \ 3 | file://setserial \ 4 | file://setserial.service \ 5 | " 6 | 7 | inherit systemd 8 | 9 | SYSTEMD_SERVICE:${PN} = "setserial.service" 10 | 11 | do_install:append() { 12 | install -d ${D}${sysconfdir}/ 13 | install -d ${D}${systemd_system_unitdir} 14 | install -m 0755 ${UNPACKDIR}/setserial ${D}${sysconfdir}/ 15 | install -m 0644 ${UNPACKDIR}/setserial.service \ 16 | ${D}${systemd_system_unitdir}/setserial.service 17 | sed -i \ 18 | -e 's,@SYSCONFDIR@,${sysconfdir},g' \ 19 | -e 's,@BINDIR@,${bindir},g' \ 20 | -e 's,@LOCALSTATEDIR@,${localstatedir},g' \ 21 | ${D}${sysconfdir}/setserial \ 22 | ${D}${systemd_system_unitdir}/setserial.service 23 | } 24 | -------------------------------------------------------------------------------- /recipes-core/acrn/acrn-common.inc: -------------------------------------------------------------------------------- 1 | SUMMARY = "A Type 1 hypervisor stack, running directly on the bare-metal hardware" 2 | HOMEPAGE = "https://projectacrn.org/" 3 | LICENSE = "BSD-3-Clause" 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=ba07c9571f2096ec6349ef0167ec5e60" 5 | 6 | SRC_URI = "git://github.com/projectacrn/acrn-hypervisor.git;protocol=https;branch=${SRCBRANCH}; \ 7 | file://0001-acrn-Use-std-gnu11-to-fix-build-with-GCC-15.patch \ 8 | " 9 | # Snapshot tags are of the format: 10 | # acrn-w.- 11 | PV = "3.3" 12 | SRCREV = "d68f223dde407a70df9f66384796ac15725addfd" 13 | SRCBRANCH = "release_3.3" 14 | 15 | UPSTREAM_CHECK_GITTAGREGEX = "^v(?P\d+(\.\d+)+)$" 16 | 17 | S = "${WORKDIR}/git" 18 | 19 | CVE_PRODUCT = "acrn" 20 | 21 | # y for release build, n for debug build. 22 | ACRN_RELEASE ?= "n" 23 | 24 | EXTRA_OEMAKE += "RELEASE=${ACRN_RELEASE} \ 25 | SYSROOT=${STAGING_DIR_TARGET} \ 26 | O=${B} \ 27 | DESTDIR=${D} \ 28 | prefix=${prefix} \ 29 | bindir=${bindir} \ 30 | libdir=${libdir} \ 31 | datadir=${datadir} \ 32 | includedir=${includedir} \ 33 | systemd_unitdir=${systemd_unitdir}" 34 | 35 | 36 | # acrn supports build objects out-of-tree but builds must be performed from 37 | # inside the source 38 | B = "${WORKDIR}/build" 39 | do_configure[cleandirs] = "${B}" 40 | do_configure[dirs] = "${S}" 41 | do_compile[dirs] = "${S}" 42 | do_install[dirs] = "${S}" 43 | 44 | CVE_STATUS[CVE-2019-18844] = "fixed-version: Fixed from version 1.2+" 45 | CVE_STATUS[CVE-2021-36145] = "fixed-version: Fixed from version 2.5+" 46 | 47 | # Skip TMPDIR [buildpaths] QA check 48 | ERROR_QA:remove = "buildpaths" 49 | -------------------------------------------------------------------------------- /recipes-core/acrn/acrn-devicemodel.bb: -------------------------------------------------------------------------------- 1 | require acrn-common.inc 2 | 3 | SRC_URI += "file://0001-No-need-to-build-install-the-tools.patch \ 4 | file://0002-Makefile-allow-to-pass-compiler-and-linker-flags.patch \ 5 | file://0003-devicemodel-Makefile-skip-Werror-address-error-check.patch \ 6 | " 7 | 8 | inherit python3native 9 | 10 | DEPENDS += "util-linux libusb1 openssl libpciaccess acrn-tools cjson virtual/libsdl2 pixman liburing" 11 | 12 | # Tell the build where to find acrn-tools 13 | EXTRA_OEMAKE += "COPTS=${STAGING_DIR_TARGET}${includedir}/acrn" 14 | 15 | EXTRA_OEMAKE += "ASL_COMPILER=${bindir}/iasl" 16 | 17 | PACKAGES += "${PN}-sample" 18 | 19 | RDEPENDS:${PN} += "acpica" 20 | RDEPENDS:${PN}-sample += "bash" 21 | 22 | FILES:${PN} += "${datadir}/acrn/bios" 23 | 24 | do_compile() { 25 | oe_runmake devicemodel 26 | } 27 | 28 | do_install() { 29 | oe_runmake devicemodel-install 30 | 31 | # Write a modprobe.d so that acrngt is loaded before i915, as otherwise i915 32 | # fails to initialise and output is disabled. 33 | install -d ${D}${sysconfdir}/modprobe.d 34 | echo "softdep i915 pre: acrngt" >${D}${sysconfdir}/modprobe.d/acrn.conf 35 | } 36 | 37 | FILES:${PN}-sample += "${datadir}/acrn/samples" 38 | -------------------------------------------------------------------------------- /recipes-core/acrn/acrn-devicemodel/0001-No-need-to-build-install-the-tools.patch: -------------------------------------------------------------------------------- 1 | From 15e3db7e8c57c92765570b4091093dfac3d5a044 Mon Sep 17 00:00:00 2001 2 | From: Naveen Saini 3 | Date: Thu, 14 Jul 2022 18:02:30 +0800 4 | Subject: [PATCH 1/3] No need to build & install the tools 5 | 6 | Tools are being built & installed by seperate recipe 7 | 8 | Upstream-Status: Inappropriate 9 | 10 | Signed-off-by: Naveen Saini 11 | --- 12 | Makefile | 4 ++-- 13 | 1 file changed, 2 insertions(+), 2 deletions(-) 14 | 15 | diff --git a/Makefile b/Makefile 16 | index 2c6fe5894..b9a7198f3 100644 17 | --- a/Makefile 18 | +++ b/Makefile 19 | @@ -141,7 +141,7 @@ hvdiffconfig: 20 | hvapplydiffconfig: 21 | @$(MAKE) applydiffconfig $(HV_MAKEOPTS) PATCH=$(abspath $(PATCH)) 22 | 23 | -devicemodel: tools 24 | +devicemodel: 25 | $(MAKE) -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) DM_BUILD_VERSION=$(BUILD_VERSION) DM_BUILD_TAG=$(BUILD_TAG) TOOLS_OUT=$(TOOLS_OUT) RELEASE=$(RELEASE) IASL_MIN_VER=$(IASL_MIN_VER) 26 | 27 | tools: 28 | @@ -171,7 +171,7 @@ hypervisor-install: hypervisor 29 | hypervisor-install-debug: 30 | $(MAKE) $(HV_MAKEOPTS) install-debug 31 | 32 | -devicemodel-install: tools-install devicemodel 33 | +devicemodel-install: devicemodel 34 | $(MAKE) -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) install 35 | 36 | tools-install: tools 37 | -- 38 | 2.37.3 39 | 40 | -------------------------------------------------------------------------------- /recipes-core/acrn/acrn-devicemodel/0002-Makefile-allow-to-pass-compiler-and-linker-flags.patch: -------------------------------------------------------------------------------- 1 | From 3f6d57f5bb48d9367bebb27f7b296f5c07445b31 Mon Sep 17 00:00:00 2001 2 | From: Naveen Saini 3 | Date: Thu, 14 Jul 2022 18:05:21 +0800 4 | Subject: [PATCH 2/3] Makefile: allow to pass compiler and linker flags 5 | 6 | Upstream-Status: Inappropriate [oe-specific] 7 | 8 | Signed-off-by: Naveen Saini 9 | --- 10 | devicemodel/Makefile | 2 ++ 11 | 1 file changed, 2 insertions(+) 12 | 13 | diff --git a/devicemodel/Makefile b/devicemodel/Makefile 14 | index 372bab663..dbc77d3ff 100644 15 | --- a/devicemodel/Makefile 16 | +++ b/devicemodel/Makefile 17 | @@ -45,6 +45,7 @@ CFLAGS += -I$(SYSROOT)/usr/include/glib-2.0 18 | CFLAGS += -I$(SYSROOT)/usr/include/SDL2 19 | CFLAGS += -I$(SYSROOT)/usr/include/EGL 20 | CFLAGS += -I$(SYSROOT)/usr/include/GLES2 21 | +CFLAGS += -I$(COPTS) 22 | 23 | CFLAGS += -DIASL_MIN_VER=\"$(IASL_MIN_VER)\" 24 | 25 | @@ -77,6 +78,7 @@ LDFLAGS += -Wl,-z,noexecstack 26 | LDFLAGS += -Wl,-z,relro,-z,now 27 | LDFLAGS += -pie 28 | LDFLAGS += -L$(TOOLS_OUT)/services 29 | +LDFLAGS += -L$(COPTS) 30 | 31 | LIBS = -lrt 32 | LIBS += -lpthread 33 | -- 34 | 2.37.3 35 | 36 | -------------------------------------------------------------------------------- /recipes-core/acrn/acrn-devicemodel/0003-devicemodel-Makefile-skip-Werror-address-error-check.patch: -------------------------------------------------------------------------------- 1 | From 5a8c60fcf4a47b3d22ced8fdcf1926a20c731d55 Mon Sep 17 00:00:00 2001 2 | From: Naveen Saini 3 | Date: Mon, 5 May 2025 10:50:15 +0800 4 | Subject: [PATCH 3/3] devicemodel/Makefile: skip Werror=address error check for 5 | now 6 | 7 | | hw/acpi/core.c: In function 'acpi_dev_finddev': 8 | | hw/acpi/core.c:283:30: error: the comparison will always evaluate as 'true' for the address of 'hid' will never be NULL [-Werror=address] 9 | | 283 | if (adp->hid != NULL && !strcmp(adp->hid, hid)) 10 | | | ^~ 11 | | In file included from hw/acpi/core.c:24: 12 | | 3.3/git/devicemodel/include/acpi_dev.h:24:14: note: 'hid' declared here 13 | | 24 | char hid[9]; 14 | | | ^~~ 15 | 16 | Upstream-Status: Inappropriate [OE-Specific] 17 | 18 | Signed-off-by: Naveen Saini 19 | --- 20 | devicemodel/Makefile | 1 + 21 | 1 file changed, 1 insertion(+) 22 | 23 | diff --git a/devicemodel/Makefile b/devicemodel/Makefile 24 | index dbc77d3ff..7f189dcf3 100644 25 | --- a/devicemodel/Makefile 26 | +++ b/devicemodel/Makefile 27 | @@ -35,6 +35,7 @@ CFLAGS += -fno-delete-null-pointer-checks -fwrapv 28 | CFLAGS += -fpie 29 | CFLAGS += -Wno-stringop-truncation -Wno-address-of-packed-member 30 | CFLAGS += -std=gnu11 31 | +CFLAGS += -Wno-error=address -Wno-header-guard 32 | 33 | CFLAGS += -I$(BASEDIR)/include 34 | CFLAGS += -I$(BASEDIR)/include/public 35 | -- 36 | 2.37.3 37 | 38 | -------------------------------------------------------------------------------- /recipes-core/acrn/acrn-hypervisor.bb: -------------------------------------------------------------------------------- 1 | require acrn-common.inc 2 | 3 | ACRN_BOARD ?= "nuc11tnbi5" 4 | ACRN_SCENARIO ?= "shared" 5 | ACRN_CONFIG_PATCH ?= "" 6 | 7 | EXTRA_OEMAKE += "HV_OBJDIR=${B}/hypervisor " 8 | EXTRA_OEMAKE += "BOARD=${ACRN_BOARD} SCENARIO=${ACRN_SCENARIO}" 9 | EXTRA_OEMAKE += "EFI_OBJDIR=${B}/misc/efi-stub" 10 | 11 | SRC_URI:append:class-target = " file://hypervisor-dont-build-pre_build.patch" 12 | 13 | inherit python3native deploy 14 | 15 | PACKAGE_ARCH = "${MACHINE_ARCH}" 16 | 17 | DEPENDS += "acrn-hypervisor-native acpica-native python3-lxml-native gnu-efi python3-defusedxml-native python3-elementpath-native python3-xmlschema-native" 18 | 19 | # parallel build could face build failure in case of config-tool method: 20 | # | .config does not exist and no defconfig available for BOARD... 21 | PARALLEL_MAKE = "" 22 | 23 | do_configure:class-target() { 24 | # generate configuration and patch it when the configuration patch file is valid 25 | # clang-format are not supported at this point, hence the patch file to use should not generate with clang-format 26 | if [ -n "${ACRN_CONFIG_PATCH}" ]; then 27 | if [ -f "${ACRN_CONFIG_PATCH}" ]; then 28 | oe_runmake hvdefconfig 29 | oe_runmake hvapplydiffconfig PATCH=${ACRN_CONFIG_PATCH} 30 | else 31 | bberror "ACRN_CONFIG_PATCH are set to ${ACRN_CONFIG_PATCH} but the file not found" 32 | fi 33 | fi 34 | } 35 | 36 | do_compile:class-target() { 37 | # Execute natively build sanity check for ACRN configurations 38 | hv_prebuild_check.out 39 | oe_runmake -C hypervisor 40 | 41 | if [ "${ACRN_FIRMWARE}" = "uefi" ]; then 42 | oe_runmake -C misc/efi-stub 43 | fi 44 | } 45 | 46 | do_install:class-target() { 47 | oe_runmake -C hypervisor install install-debug 48 | 49 | if [ -x ${B}/misc/efi-stub/boot.efi ]; then 50 | install -m 0755 ${B}/misc/efi-stub/boot.efi ${D}${libdir}/acrn/ 51 | fi 52 | 53 | # Remove sample files 54 | rm -rf ${D}${datadir}/acrn 55 | } 56 | 57 | FILES:${PN} += "${libdir}/acrn/" 58 | 59 | addtask deploy after do_install before do_build 60 | do_deploy() { 61 | install -m 0755 ${D}${libdir}/acrn/acrn.${ACRN_BOARD}.${ACRN_SCENARIO}.32.out ${DEPLOYDIR} 62 | rm -f ${DEPLOYDIR}/acrn.32.out 63 | ln -rs ${DEPLOYDIR}/acrn.${ACRN_BOARD}.${ACRN_SCENARIO}.32.out ${DEPLOYDIR}/acrn.32.out 64 | 65 | install -m 0755 ${D}${libdir}/acrn/acrn.${ACRN_BOARD}.${ACRN_SCENARIO}.bin ${DEPLOYDIR} 66 | rm -f ${DEPLOYDIR}/acrn.bin 67 | ln -rs ${DEPLOYDIR}/acrn.${ACRN_BOARD}.${ACRN_SCENARIO}.bin ${DEPLOYDIR}/acrn.bin 68 | 69 | rm -f ${DEPLOYDIR}/ACPI_*.bin 70 | if [ -x ${D}${libdir}/acrn/acpi ]; then 71 | install -m 0755 ${D}${libdir}/acrn/acpi/ACPI_*.bin ${DEPLOYDIR} 72 | fi 73 | 74 | if [ -x ${D}${libdir}/acrn/boot.efi ]; then 75 | install -m 0755 ${D}${libdir}/acrn/boot.efi ${DEPLOYDIR} 76 | fi 77 | } 78 | 79 | INSANE_SKIP:${PN} += "arch already-stripped" 80 | 81 | do_compile:class-native() { 82 | oe_runmake -C hypervisor ${B}/hypervisor/hv_prebuild_check.out 83 | } 84 | 85 | do_install:class-native(){ 86 | install -d ${D}/${bindir} 87 | install -m 755 ${B}/hypervisor/hv_prebuild_check.out ${D}/${bindir}/hv_prebuild_check.out 88 | } 89 | 90 | # no action required for native to deploy 91 | do_deploy:class-native(){ 92 | : 93 | } 94 | 95 | BBCLASSEXTEND = "native " 96 | -------------------------------------------------------------------------------- /recipes-core/acrn/acrn-hypervisor/hypervisor-dont-build-pre_build.patch: -------------------------------------------------------------------------------- 1 | From a34e5fcaac3ba796f34cdeb78436daea3b0a55ab Mon Sep 17 00:00:00 2001 2 | From: Naveen Saini 3 | Date: Wed, 14 Jun 2023 10:49:58 +0800 4 | Subject: [PATCH] Execute pre_build_check during hypervisor build is causing 5 | error 6 | 7 | | make: build//hypervisor/hv_prebuild_check.out: Command not found 8 | 9 | Build and execute as native. 10 | 11 | Upstream-Status: Inappropriate 12 | 13 | Signed-off-by: Naveen Saini 14 | --- 15 | hypervisor/Makefile | 3 --- 16 | 1 file changed, 3 deletions(-) 17 | 18 | diff --git a/hypervisor/Makefile b/hypervisor/Makefile 19 | index 029b4cfb4..c1038ec08 100644 20 | --- a/hypervisor/Makefile 21 | +++ b/hypervisor/Makefile 22 | @@ -424,9 +424,6 @@ $(error Please either install "iasl" or provide the path to "iasl" by using the 23 | endif 24 | 25 | $(PRE_BUILD_CHECKER): $(HV_CONFIG_H) $(HV_CONFIG_TIMESTAMP) 26 | - @echo "Start pre-build static check ..." 27 | - $(MAKE) -C $(PRE_BUILD_DIR) BOARD=$(BOARD) SCENARIO=$(SCENARIO) CHECKER_OUT=$(PRE_BUILD_CHECKER) 28 | - @$(PRE_BUILD_CHECKER) 29 | 30 | $(HV_ACPI_TABLE_TIMESTAMP): $(HV_CONFIG_TIMESTAMP) 31 | @echo "generate the binary of ACPI tables for pre-launched VMs ..." 32 | -- 33 | 2.34.1 34 | 35 | -------------------------------------------------------------------------------- /recipes-core/acrn/acrn-life-mngr.bb: -------------------------------------------------------------------------------- 1 | require acrn-common.inc 2 | 3 | inherit features_check systemd 4 | 5 | REQUIRED_DISTRO_FEATURES = "systemd" 6 | 7 | EXTRA_OEMAKE += " OUT_DIR=${B} " 8 | 9 | do_compile() { 10 | oe_runmake -C misc/services/life_mngr 11 | } 12 | 13 | do_install() { 14 | install -d ${D}${bindir} 15 | install -m 0755 ${B}/life_mngr ${D}${bindir} 16 | install -d ${D}${sysconfdir}/life_mngr 17 | install -m 0644 ${B}/life_mngr.conf ${D}${sysconfdir}/life_mngr/ 18 | install -d ${D}${systemd_unitdir}/system/ 19 | install -m 0644 ${B}/life_mngr.service ${D}${systemd_unitdir}/system/ 20 | } 21 | 22 | SYSTEMD_SERVICE:${PN} = "life_mngr.service" 23 | -------------------------------------------------------------------------------- /recipes-core/acrn/acrn-tools.bb: -------------------------------------------------------------------------------- 1 | require acrn-common.inc 2 | 3 | inherit pkgconfig systemd 4 | 5 | DEPENDS += "numactl systemd e2fsprogs libevent libxml2 openssl-native" 6 | RDEPENDS:${PN} += "bash" 7 | 8 | do_compile() { 9 | oe_runmake tools 10 | } 11 | 12 | do_install() { 13 | oe_runmake tools-install 14 | 15 | # tmpfiles.d is useless without systemd 16 | if ! ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then 17 | rm -rf ${D}${libdir}/tmpfiles.d 18 | fi 19 | } 20 | 21 | SYSTEMD_SERVICE:${PN} = "acrnd.service" 22 | SYSTEMD_SERVICE:${PN} += "${@'acrnlog.service' if d.getVar('ACRN_RELEASE') == 'n' else ''}" 23 | SYSTEMD_SERVICE:${PN} += "${@'acrnprobe.service' if d.getVar('ACRN_RELEASE') == 'n' else ''}" 24 | SYSTEMD_SERVICE:${PN} += "${@'usercrash.service' if d.getVar('ACRN_RELEASE') == 'n' else ''}" 25 | 26 | FILES:${PN} += "${systemd_unitdir} ${libdir}/tmpfiles.d ${datadir}/acrn ${datadir}/defaults" 27 | -------------------------------------------------------------------------------- /recipes-core/acrn/files/0001-acrn-Use-std-gnu11-to-fix-build-with-GCC-15.patch: -------------------------------------------------------------------------------- 1 | From 9a8bc2004b80d0ed8861faadbcf12f968d15f507 Mon Sep 17 00:00:00 2001 2 | From: Naveen Saini 3 | Date: Mon, 5 May 2025 10:46:08 +0800 4 | Subject: [PATCH] acrn: Use '-std=gnu11' to fix build with GCC 15 5 | 6 | | In file included from lib/string.c:5: 7 | | acrn-hypervisor/3.3/git/hypervisor/include/lib/types.h:31:15: error: 'bool' cannot be defined via 'typedef' 8 | | 31 | typedef _Bool bool; 9 | | | ^~~~ 10 | | acrn-hypervisor/3.3/git/hypervisor/include/lib/types.h:31:15: note: 'bool' is a keyword with '-std=c23' onwards 11 | | acrn-hypervisor/3.3/git/hypervisor/include/lib/types.h:31:1: error: useless type name in empty declaration [-Werror] 12 | | 31 | typedef _Bool bool; 13 | | | ^~~~~~~ 14 | 15 | | lib/sprintf.c:102:42: error: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (6 chars into 5 available) [-Werror=unterminated-string-initialization] 16 | | 102 | static const char flagchars[5] = "#0- +"; 17 | | | ^~~~~~~ 18 | 19 | Upstream-Status: Inappropriate [OE-Specific] 20 | 21 | Signed-off-by: Naveen Saini 22 | --- 23 | devicemodel/Makefile | 1 + 24 | hypervisor/Makefile | 1 + 25 | 2 files changed, 2 insertions(+) 26 | 27 | diff --git a/devicemodel/Makefile b/devicemodel/Makefile 28 | index 72dc62e6b..372bab663 100644 29 | --- a/devicemodel/Makefile 30 | +++ b/devicemodel/Makefile 31 | @@ -34,6 +34,7 @@ CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing 32 | CFLAGS += -fno-delete-null-pointer-checks -fwrapv 33 | CFLAGS += -fpie 34 | CFLAGS += -Wno-stringop-truncation -Wno-address-of-packed-member 35 | +CFLAGS += -std=gnu11 36 | 37 | CFLAGS += -I$(BASEDIR)/include 38 | CFLAGS += -I$(BASEDIR)/include/public 39 | diff --git a/hypervisor/Makefile b/hypervisor/Makefile 40 | index c59594fa3..a22c824c2 100644 41 | --- a/hypervisor/Makefile 42 | +++ b/hypervisor/Makefile 43 | @@ -61,6 +61,7 @@ CFLAGS += -m64 -mno-mmx -mno-sse -mno-sse2 -mno-80387 -mno-fp-ret-in-387 44 | CFLAGS += -mno-red-zone -mpopcnt 45 | CFLAGS += -nostdinc -nostdlib -fno-common 46 | CFLAGS += -Werror 47 | +CFLAGS += -std=gnu11 -Wno-unterminated-string-initialization 48 | 49 | # ACRN depends on zero length array. Silence the gcc if Warrary-bounds is default option 50 | CFLAGS += -Wno-array-bounds 51 | -- 52 | 2.37.3 53 | 54 | -------------------------------------------------------------------------------- /recipes-core/images/acrn-image-base.bb: -------------------------------------------------------------------------------- 1 | require recipes-core/images/core-image-base.bb 2 | 3 | CORE_IMAGE_EXTRA_INSTALL:append = " \ 4 | packagegroup-acrn \ 5 | linux-firmware \ 6 | kernel-modules \ 7 | " 8 | 9 | inherit image-acrn 10 | -------------------------------------------------------------------------------- /recipes-core/images/acrn-image-minimal.bb: -------------------------------------------------------------------------------- 1 | require recipes-core/images/core-image-minimal.bb 2 | 3 | CORE_IMAGE_EXTRA_INSTALL:append = " packagegroup-acrn" 4 | 5 | inherit image-acrn 6 | -------------------------------------------------------------------------------- /recipes-core/images/acrn-image-sato.bb: -------------------------------------------------------------------------------- 1 | require recipes-sato/images/core-image-sato.bb 2 | 3 | CORE_IMAGE_EXTRA_INSTALL:append = " \ 4 | packagegroup-acrn \ 5 | linux-firmware \ 6 | kernel-modules \ 7 | " 8 | 9 | inherit image-acrn 10 | -------------------------------------------------------------------------------- /recipes-core/images/acrn-image-weston.bb: -------------------------------------------------------------------------------- 1 | require recipes-graphics/images/core-image-weston.bb 2 | 3 | CORE_IMAGE_EXTRA_INSTALL:append = " \ 4 | packagegroup-acrn \ 5 | linux-firmware \ 6 | kernel-modules \ 7 | " 8 | 9 | inherit image-acrn 10 | -------------------------------------------------------------------------------- /recipes-core/networkd-config/networkd-config.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Configuration file for networkd" 2 | LICENSE = "MIT" 3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" 4 | 5 | SRC_URI = "file://80-dhcp.network" 6 | 7 | S = "${WORKDIR}/sources" 8 | UNPACKDIR = "${S}" 9 | 10 | do_install() { 11 | install -d ${D}${nonarch_base_libdir}/systemd/network 12 | install -m644 ${UNPACKDIR}/*.network ${D}${nonarch_base_libdir}/systemd/network 13 | } 14 | 15 | FILES:${PN} = "${nonarch_base_libdir}/systemd/network" 16 | -------------------------------------------------------------------------------- /recipes-core/networkd-config/networkd-config/80-dhcp.network: -------------------------------------------------------------------------------- 1 | [Match] 2 | Name=en* 3 | 4 | [Network] 5 | DHCP=yes 6 | -------------------------------------------------------------------------------- /recipes-core/packagegroups/packagegroup-acrn.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "ACRN hypervisor" 2 | 3 | inherit packagegroup features_check 4 | 5 | # Currently requires systemd as the networking glue is systemd-specific 6 | REQUIRED_DISTRO_FEATURES = "systemd" 7 | 8 | RDEPENDS:${PN} = "\ 9 | acrn-hypervisor \ 10 | acrn-tools \ 11 | acrn-devicemodel \ 12 | " 13 | -------------------------------------------------------------------------------- /recipes-devtools/python/python3-elementpath_3.0.2.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Provide XPath 1.0 and 2.0 selectors for Python's ElementTree XML data structures, both for the standard ElementTree library and for the lxml.etree library." 2 | HOMEPAGE = "https://github.com/sissaschool/elementpath" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=5dbb7fb7d72da3921202dd7b995d3ecf" 5 | 6 | SRC_URI[sha256sum] = "cca18742dc0f354f79874c41a906e6ce4cc15230b7858d22a861e1ec5946940f" 7 | 8 | PYPI_PACKAGE = "elementpath" 9 | inherit pypi setuptools3 10 | 11 | RDEPENDS:${PN} += " \ 12 | ${PYTHON_PN}-xml \ 13 | ${PYTHON_PN}-core \ 14 | ${PYTHON_PN}-numbers \ 15 | ${PYTHON_PN}-datetime \ 16 | ${PYTHON_PN}-stringold \ 17 | " 18 | 19 | BBCLASSEXTEND = "native nativesdk" 20 | -------------------------------------------------------------------------------- /recipes-devtools/python/python3-xmlschema_3.0.1.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "The xmlschema library is an implementation of XML Schema for Python (supports Python 3.6+)." 2 | HOMEPAGE = "https://github.com/sissaschool/xmlschema" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=26aa26eda991a3a2b61c11b62d3fda65" 5 | 6 | SRC_URI[sha256sum] = "bb24a5f4738e49d85d9eb03a2b5af26bbbbfdb055517ad953d98925094b8c026" 7 | 8 | inherit pypi python_setuptools_build_meta 9 | 10 | RDEPENDS:${PN} += "\ 11 | python3-elementpath \ 12 | python3-modules \ 13 | " 14 | 15 | BBCLASSEXTEND = "native nativesdk" 16 | -------------------------------------------------------------------------------- /recipes-guests/yocto/core-image-base-package.bb: -------------------------------------------------------------------------------- 1 | inherit container-package 2 | 3 | SRC_URI = "file://launch-base.sh" 4 | 5 | S = "${WORKDIR}/sources" 6 | UNPACKDIR = "${S}" 7 | 8 | do_install:append() { 9 | install -m 755 ${UNPACKDIR}/launch-base.sh ${D}/var/lib/machines/ 10 | } 11 | 12 | RDEPENDS:${PN} += "bash procps" 13 | -------------------------------------------------------------------------------- /recipes-guests/yocto/core-image-base-package/launch-base.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2022 Intel Corporation. 4 | # 5 | # SPDX-License-Identifier: BSD-3-Clause 6 | # 7 | 8 | # Launch script for VM name: POST_STD_VM2 9 | 10 | # Helper functions 11 | 12 | function probe_modules() { 13 | modprobe pci_stub 14 | } 15 | 16 | function offline_cpus() { 17 | # Each parameter of this function is considered the APIC ID (as is reported in /proc/cpuinfo, in decimal) of a CPU 18 | # assigned to a post-launched RTVM. 19 | for i in $*; do 20 | processor_id=$(grep -B 15 "apicid.*: ${i}$" /proc/cpuinfo | grep "^processor" | head -n 1 | cut -d ' ' -f 2) 21 | if [ -z ${processor_id} ]; then 22 | continue 23 | fi 24 | cpu_path="/sys/devices/system/cpu/cpu${processor_id}" 25 | if [ -f ${cpu_path}/online ]; then 26 | online=`cat ${cpu_path}/online` 27 | echo cpu${processor_id} online=${online} >> /dev/stderr 28 | if [ "${online}" = "1" ] && [ "${processor_id}" != "0" ]; then 29 | echo 0 > ${cpu_path}/online 30 | online=`cat ${cpu_path}/online` 31 | # during boot time, cpu hotplug may be disabled by pci_device_probe during a pci module insmod 32 | while [ "${online}" = "1" ]; do 33 | sleep 1 34 | echo 0 > ${cpu_path}/online 35 | online=`cat ${cpu_path}/online` 36 | done 37 | echo ${processor_id} > /sys/devices/virtual/misc/acrn_hsm/remove_cpu 38 | fi 39 | fi 40 | done 41 | } 42 | 43 | function unbind_device() { 44 | physical_bdf=$1 45 | 46 | vendor_id=$(cat /sys/bus/pci/devices/${physical_bdf}/vendor) 47 | device_id=$(cat /sys/bus/pci/devices/${physical_bdf}/device) 48 | 49 | echo $(printf "%04x %04x" ${vendor_id} ${device_id}) > /sys/bus/pci/drivers/pci-stub/new_id 50 | echo ${physical_bdf} > /sys/bus/pci/devices/${physical_bdf}/driver/unbind 51 | echo ${physical_bdf} > /sys/bus/pci/drivers/pci-stub/bind 52 | } 53 | 54 | function create_tap() { 55 | # create a unique tap device for each VM 56 | tap=$1 57 | tap_exist=$(ip a show dev $tap) 58 | if [ "$tap_exist"x != "x" ]; then 59 | echo "$tap TAP device already available, reusing it." 60 | else 61 | ip tuntap add dev $tap mode tap 62 | fi 63 | 64 | # if acrn-br0 exists, add VM's unique tap device under it 65 | br_exist=$(ip a | grep acrn-br0 | awk '{print $1}') 66 | if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then 67 | echo "acrn-br0 bridge already exists, adding new $tap TAP device to it..." 68 | ip link set "$tap" master acrn-br0 69 | ip link set dev "$tap" down 70 | ip link set dev "$tap" up 71 | fi 72 | } 73 | 74 | function mount_partition() { 75 | partition=$1 76 | 77 | tmpdir=`mktemp -d` 78 | mount ${partition} ${tmpdir} 79 | echo ${tmpdir} 80 | } 81 | 82 | function unmount_partition() { 83 | tmpdir=$1 84 | 85 | umount ${tmpdir} 86 | rmdir ${tmpdir} 87 | } 88 | 89 | # Generators of device model parameters 90 | 91 | function add_cpus() { 92 | # Each parameter of this function is considered the processor ID (as is reported in /proc/cpuinfo) of a CPU assigned 93 | # to a post-launched RTVM. 94 | 95 | if [ "${vm_type}" = "RTVM" ] || [ "${scheduler}" = "SCHED_NOOP" ]; then 96 | offline_cpus $* 97 | fi 98 | 99 | cpu_list=$(local IFS=, ; echo "$*") 100 | echo -n "--cpu_affinity ${cpu_list}" 101 | } 102 | 103 | function add_interrupt_storm_monitor() { 104 | threshold_per_sec=$1 105 | probe_period_in_sec=$2 106 | inject_delay_in_ms=$3 107 | delay_duration_in_ms=$4 108 | 109 | echo -n "--intr_monitor ${threshold_per_sec},${probe_period_in_sec},${inject_delay_in_ms},${delay_duration_in_ms}" 110 | } 111 | 112 | function add_logger_settings() { 113 | loggers=() 114 | 115 | for conf in $*; do 116 | logger=${conf%=*} 117 | level=${conf#*=} 118 | loggers+=("${logger},level=${level}") 119 | done 120 | 121 | cmd_param=$(local IFS=';' ; echo "${loggers[*]}") 122 | echo -n "--logger_setting ${cmd_param}" 123 | } 124 | 125 | function add_virtual_device() { 126 | slot=$1 127 | kind=$2 128 | options=$3 129 | 130 | if [ "${kind}" = "virtio-net" ]; then 131 | # Create the tap device 132 | if [[ ${options} =~ tap=([^,]+) ]]; then 133 | tap_conf="${BASH_REMATCH[1]}" 134 | create_tap "${tap_conf}" >> /dev/stderr 135 | fi 136 | fi 137 | 138 | if [ "${kind}" = "virtio-input" ]; then 139 | options=$* 140 | if [[ "${options}" =~ id:([a-zA-Z0-9_\-]*) ]]; then 141 | unique_identifier="${BASH_REMATCH[1]}" 142 | options=${options/",id:${unique_identifier}"/''} 143 | fi 144 | 145 | if [[ "${options}" =~ (Device name: )(.*),( Device physical path: )(.*) ]]; then 146 | device_name="${BASH_REMATCH[2]}" 147 | phys_name="${BASH_REMATCH[4]}" 148 | local IFS=$'\n' 149 | device_name_paths=$(grep -r "${device_name}" /sys/class/input/event*/device/name) 150 | phys_paths=$(grep -r "${phys_name}" /sys/class/input/event*/device/phys) 151 | fi 152 | 153 | if [ -n "${device_name_paths}" ] && [ -n "${phys_paths}" ]; then 154 | for device_path in ${device_name_paths}; do 155 | for phys_path in ${phys_paths}; do 156 | if [ "${device_path%/device*}" = "${phys_path%/device*}" ]; then 157 | event_path=${device_path} 158 | if [[ ${event_path} =~ event([0-9]+) ]]; then 159 | event_num="${BASH_REMATCH[1]}" 160 | options="/dev/input/event${event_num}" 161 | break 162 | fi 163 | fi 164 | done 165 | done 166 | fi 167 | 168 | if [[ ${options} =~ event([0-9]+) ]]; then 169 | echo "${options} input device path is available in the service vm." >> /dev/stderr 170 | else 171 | echo "${options} input device path is not found in the service vm." >> /dev/stderr 172 | return 173 | fi 174 | 175 | if [ -n "${options}" ] && [ -n "${unique_identifier}" ]; then 176 | options="${options},${unique_identifier}" 177 | fi 178 | 179 | fi 180 | 181 | echo -n "-s ${slot},${kind}" 182 | if [ -n "${options}" ]; then 183 | echo -n ",${options}" 184 | fi 185 | } 186 | 187 | function add_passthrough_device() { 188 | slot=$1 189 | physical_bdf=$2 190 | options=$3 191 | 192 | unbind_device ${physical_bdf%,*} 193 | 194 | # bus, device and function as decimal integers 195 | bus_temp=${physical_bdf#*:}; bus=$((16#${bus_temp%:*})) 196 | dev_temp=${physical_bdf##*:}; dev=$((16#${dev_temp%.*})) 197 | fun=$((16#${physical_bdf#*.})) 198 | 199 | echo -n "-s " 200 | printf '%s,passthru,%x/%x/%x' ${slot} ${bus} ${dev} ${fun} 201 | if [ -n "${options}" ]; then 202 | echo -n ",${options}" 203 | fi 204 | } 205 | 206 | ### 207 | # The followings are generated by launch_cfg_gen.py 208 | ### 209 | 210 | # Defining variables that describe VM types 211 | vm_type='STANDARD_VM' 212 | scheduler='SCHED_BVT' 213 | 214 | # Initializing 215 | probe_modules 216 | mac=$(cat /sys/class/net/e*/address) 217 | 218 | # Invoking ACRN device model 219 | dm_params=( 220 | `add_cpus 0 2` 221 | -m 512M 222 | --ovmf /usr/share/acrn/bios/OVMF.fd 223 | `add_virtual_device 1:0 lpc` 224 | `add_virtual_device 0:0 hostbridge` 225 | `add_virtual_device 3 virtio-console @stdio:stdio_port` 226 | `add_virtual_device 4 virtio-net tap=YaaG3,mac_seed=${mac:0:17}-POST_STD_VM2` 227 | `add_virtual_device 5 virtio-blk /var/lib/machines/core-image-base.wic` 228 | `add_logger_settings console=4 kmsg=3 disk=5` 229 | POST_STD_VM2 230 | ) 231 | 232 | echo "Launch device model with parameters: ${dm_params[@]}" 233 | acrn-dm "${dm_params[@]}" 234 | 235 | # Deinitializing 236 | -------------------------------------------------------------------------------- /recipes-guests/yocto/core-image-sato-package.bb: -------------------------------------------------------------------------------- 1 | inherit container-package 2 | 3 | SRC_URI = "file://launch-sato.sh" 4 | 5 | S = "${WORKDIR}/sources" 6 | UNPACKDIR = "${S}" 7 | 8 | do_install:append() { 9 | install -m 755 ${UNPACKDIR}/launch-sato.sh ${D}/var/lib/machines/ 10 | } 11 | 12 | RDEPENDS:${PN} += "bash procps" 13 | -------------------------------------------------------------------------------- /recipes-guests/yocto/core-image-sato-package/launch-sato.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2022 Intel Corporation. 4 | # 5 | # SPDX-License-Identifier: BSD-3-Clause 6 | # 7 | 8 | # Launch script for VM name: POST_STD_VM2 9 | 10 | # Helper functions 11 | 12 | function probe_modules() { 13 | modprobe pci_stub 14 | } 15 | 16 | function offline_cpus() { 17 | # Each parameter of this function is considered the APIC ID (as is reported in /proc/cpuinfo, in decimal) of a CPU 18 | # assigned to a post-launched RTVM. 19 | for i in $*; do 20 | processor_id=$(grep -B 15 "apicid.*: ${i}$" /proc/cpuinfo | grep "^processor" | head -n 1 | cut -d ' ' -f 2) 21 | if [ -z ${processor_id} ]; then 22 | continue 23 | fi 24 | cpu_path="/sys/devices/system/cpu/cpu${processor_id}" 25 | if [ -f ${cpu_path}/online ]; then 26 | online=`cat ${cpu_path}/online` 27 | echo cpu${processor_id} online=${online} >> /dev/stderr 28 | if [ "${online}" = "1" ] && [ "${processor_id}" != "0" ]; then 29 | echo 0 > ${cpu_path}/online 30 | online=`cat ${cpu_path}/online` 31 | # during boot time, cpu hotplug may be disabled by pci_device_probe during a pci module insmod 32 | while [ "${online}" = "1" ]; do 33 | sleep 1 34 | echo 0 > ${cpu_path}/online 35 | online=`cat ${cpu_path}/online` 36 | done 37 | echo ${processor_id} > /sys/devices/virtual/misc/acrn_hsm/remove_cpu 38 | fi 39 | fi 40 | done 41 | } 42 | 43 | function unbind_device() { 44 | physical_bdf=$1 45 | 46 | vendor_id=$(cat /sys/bus/pci/devices/${physical_bdf}/vendor) 47 | device_id=$(cat /sys/bus/pci/devices/${physical_bdf}/device) 48 | 49 | echo $(printf "%04x %04x" ${vendor_id} ${device_id}) > /sys/bus/pci/drivers/pci-stub/new_id 50 | echo ${physical_bdf} > /sys/bus/pci/devices/${physical_bdf}/driver/unbind 51 | echo ${physical_bdf} > /sys/bus/pci/drivers/pci-stub/bind 52 | } 53 | 54 | function create_tap() { 55 | # create a unique tap device for each VM 56 | tap=$1 57 | tap_exist=$(ip a show dev $tap) 58 | if [ "$tap_exist"x != "x" ]; then 59 | echo "$tap TAP device already available, reusing it." 60 | else 61 | ip tuntap add dev $tap mode tap 62 | fi 63 | 64 | # if acrn-br0 exists, add VM's unique tap device under it 65 | br_exist=$(ip a | grep acrn-br0 | awk '{print $1}') 66 | if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then 67 | echo "acrn-br0 bridge already exists, adding new $tap TAP device to it..." 68 | ip link set "$tap" master acrn-br0 69 | ip link set dev "$tap" down 70 | ip link set dev "$tap" up 71 | fi 72 | } 73 | 74 | function mount_partition() { 75 | partition=$1 76 | 77 | tmpdir=`mktemp -d` 78 | mount ${partition} ${tmpdir} 79 | echo ${tmpdir} 80 | } 81 | 82 | function unmount_partition() { 83 | tmpdir=$1 84 | 85 | umount ${tmpdir} 86 | rmdir ${tmpdir} 87 | } 88 | 89 | # Generators of device model parameters 90 | 91 | function add_cpus() { 92 | # Each parameter of this function is considered the processor ID (as is reported in /proc/cpuinfo) of a CPU assigned 93 | # to a post-launched RTVM. 94 | 95 | if [ "${vm_type}" = "RTVM" ] || [ "${scheduler}" = "SCHED_NOOP" ]; then 96 | offline_cpus $* 97 | fi 98 | 99 | cpu_list=$(local IFS=, ; echo "$*") 100 | echo -n "--cpu_affinity ${cpu_list}" 101 | } 102 | 103 | function add_interrupt_storm_monitor() { 104 | threshold_per_sec=$1 105 | probe_period_in_sec=$2 106 | inject_delay_in_ms=$3 107 | delay_duration_in_ms=$4 108 | 109 | echo -n "--intr_monitor ${threshold_per_sec},${probe_period_in_sec},${inject_delay_in_ms},${delay_duration_in_ms}" 110 | } 111 | 112 | function add_logger_settings() { 113 | loggers=() 114 | 115 | for conf in $*; do 116 | logger=${conf%=*} 117 | level=${conf#*=} 118 | loggers+=("${logger},level=${level}") 119 | done 120 | 121 | cmd_param=$(local IFS=';' ; echo "${loggers[*]}") 122 | echo -n "--logger_setting ${cmd_param}" 123 | } 124 | 125 | function add_virtual_device() { 126 | slot=$1 127 | kind=$2 128 | options=$3 129 | 130 | if [ "${kind}" = "virtio-net" ]; then 131 | # Create the tap device 132 | if [[ ${options} =~ tap=([^,]+) ]]; then 133 | tap_conf="${BASH_REMATCH[1]}" 134 | create_tap "${tap_conf}" >> /dev/stderr 135 | fi 136 | fi 137 | 138 | if [ "${kind}" = "virtio-input" ]; then 139 | options=$* 140 | if [[ "${options}" =~ id:([a-zA-Z0-9_\-]*) ]]; then 141 | unique_identifier="${BASH_REMATCH[1]}" 142 | options=${options/",id:${unique_identifier}"/''} 143 | fi 144 | 145 | if [[ "${options}" =~ (Device name: )(.*),( Device physical path: )(.*) ]]; then 146 | device_name="${BASH_REMATCH[2]}" 147 | phys_name="${BASH_REMATCH[4]}" 148 | local IFS=$'\n' 149 | device_name_paths=$(grep -r "${device_name}" /sys/class/input/event*/device/name) 150 | phys_paths=$(grep -r "${phys_name}" /sys/class/input/event*/device/phys) 151 | fi 152 | 153 | if [ -n "${device_name_paths}" ] && [ -n "${phys_paths}" ]; then 154 | for device_path in ${device_name_paths}; do 155 | for phys_path in ${phys_paths}; do 156 | if [ "${device_path%/device*}" = "${phys_path%/device*}" ]; then 157 | event_path=${device_path} 158 | if [[ ${event_path} =~ event([0-9]+) ]]; then 159 | event_num="${BASH_REMATCH[1]}" 160 | options="/dev/input/event${event_num}" 161 | break 162 | fi 163 | fi 164 | done 165 | done 166 | fi 167 | 168 | if [[ ${options} =~ event([0-9]+) ]]; then 169 | echo "${options} input device path is available in the service vm." >> /dev/stderr 170 | else 171 | echo "${options} input device path is not found in the service vm." >> /dev/stderr 172 | return 173 | fi 174 | 175 | if [ -n "${options}" ] && [ -n "${unique_identifier}" ]; then 176 | options="${options},${unique_identifier}" 177 | fi 178 | 179 | fi 180 | 181 | echo -n "-s ${slot},${kind}" 182 | if [ -n "${options}" ]; then 183 | echo -n ",${options}" 184 | fi 185 | } 186 | 187 | function add_passthrough_device() { 188 | slot=$1 189 | physical_bdf=$2 190 | options=$3 191 | 192 | unbind_device ${physical_bdf%,*} 193 | 194 | # bus, device and function as decimal integers 195 | bus_temp=${physical_bdf#*:}; bus=$((16#${bus_temp%:*})) 196 | dev_temp=${physical_bdf##*:}; dev=$((16#${dev_temp%.*})) 197 | fun=$((16#${physical_bdf#*.})) 198 | 199 | echo -n "-s " 200 | printf '%s,passthru,%x/%x/%x' ${slot} ${bus} ${dev} ${fun} 201 | if [ -n "${options}" ]; then 202 | echo -n ",${options}" 203 | fi 204 | } 205 | 206 | ### 207 | # The followings are generated by launch_cfg_gen.py 208 | ### 209 | 210 | # Defining variables that describe VM types 211 | vm_type='STANDARD_VM' 212 | scheduler='SCHED_BVT' 213 | 214 | # Initializing 215 | probe_modules 216 | mac=$(cat /sys/class/net/e*/address) 217 | 218 | # Invoking ACRN device model 219 | dm_params=( 220 | `add_cpus 0 2` 221 | -m 512M 222 | --ovmf /usr/share/acrn/bios/OVMF.fd 223 | `add_virtual_device 1:0 lpc` 224 | `add_virtual_device 0:0 hostbridge` 225 | `add_virtual_device 3 virtio-console @stdio:stdio_port` 226 | `add_virtual_device 4 virtio-net tap=YaaG3,mac_seed=${mac:0:17}-POST_STD_VM2` 227 | `add_virtual_device 5 virtio-blk /var/lib/machines/core-image-sato.wic` 228 | `add_logger_settings console=4 kmsg=3 disk=5` 229 | POST_STD_VM2 230 | ) 231 | 232 | echo "Launch device model with parameters: ${dm_params[@]}" 233 | acrn-dm "${dm_params[@]}" 234 | 235 | # Deinitializing 236 | -------------------------------------------------------------------------------- /recipes-guests/yocto/core-image-weston-package.bb: -------------------------------------------------------------------------------- 1 | inherit container-package 2 | 3 | SRC_URI = "file://launch-weston.sh" 4 | 5 | S = "${WORKDIR}/sources" 6 | UNPACKDIR = "${S}" 7 | 8 | do_install:append() { 9 | install -m 755 ${UNPACKDIR}/launch-weston.sh ${D}/var/lib/machines/ 10 | } 11 | 12 | RDEPENDS:${PN} += "bash procps" 13 | -------------------------------------------------------------------------------- /recipes-guests/yocto/core-image-weston-package/launch-weston.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2022 Intel Corporation. 4 | # 5 | # SPDX-License-Identifier: BSD-3-Clause 6 | # 7 | 8 | # Launch script for VM name: POST_STD_VM2 9 | 10 | # Helper functions 11 | 12 | function probe_modules() { 13 | modprobe pci_stub 14 | } 15 | 16 | function offline_cpus() { 17 | # Each parameter of this function is considered the APIC ID (as is reported in /proc/cpuinfo, in decimal) of a CPU 18 | # assigned to a post-launched RTVM. 19 | for i in $*; do 20 | processor_id=$(grep -B 15 "apicid.*: ${i}$" /proc/cpuinfo | grep "^processor" | head -n 1 | cut -d ' ' -f 2) 21 | if [ -z ${processor_id} ]; then 22 | continue 23 | fi 24 | cpu_path="/sys/devices/system/cpu/cpu${processor_id}" 25 | if [ -f ${cpu_path}/online ]; then 26 | online=`cat ${cpu_path}/online` 27 | echo cpu${processor_id} online=${online} >> /dev/stderr 28 | if [ "${online}" = "1" ] && [ "${processor_id}" != "0" ]; then 29 | echo 0 > ${cpu_path}/online 30 | online=`cat ${cpu_path}/online` 31 | # during boot time, cpu hotplug may be disabled by pci_device_probe during a pci module insmod 32 | while [ "${online}" = "1" ]; do 33 | sleep 1 34 | echo 0 > ${cpu_path}/online 35 | online=`cat ${cpu_path}/online` 36 | done 37 | echo ${processor_id} > /sys/devices/virtual/misc/acrn_hsm/remove_cpu 38 | fi 39 | fi 40 | done 41 | } 42 | 43 | function unbind_device() { 44 | physical_bdf=$1 45 | 46 | vendor_id=$(cat /sys/bus/pci/devices/${physical_bdf}/vendor) 47 | device_id=$(cat /sys/bus/pci/devices/${physical_bdf}/device) 48 | 49 | echo $(printf "%04x %04x" ${vendor_id} ${device_id}) > /sys/bus/pci/drivers/pci-stub/new_id 50 | echo ${physical_bdf} > /sys/bus/pci/devices/${physical_bdf}/driver/unbind 51 | echo ${physical_bdf} > /sys/bus/pci/drivers/pci-stub/bind 52 | } 53 | 54 | function create_tap() { 55 | # create a unique tap device for each VM 56 | tap=$1 57 | tap_exist=$(ip a show dev $tap) 58 | if [ "$tap_exist"x != "x" ]; then 59 | echo "$tap TAP device already available, reusing it." 60 | else 61 | ip tuntap add dev $tap mode tap 62 | fi 63 | 64 | # if acrn-br0 exists, add VM's unique tap device under it 65 | br_exist=$(ip a | grep acrn-br0 | awk '{print $1}') 66 | if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then 67 | echo "acrn-br0 bridge already exists, adding new $tap TAP device to it..." 68 | ip link set "$tap" master acrn-br0 69 | ip link set dev "$tap" down 70 | ip link set dev "$tap" up 71 | fi 72 | } 73 | 74 | function mount_partition() { 75 | partition=$1 76 | 77 | tmpdir=`mktemp -d` 78 | mount ${partition} ${tmpdir} 79 | echo ${tmpdir} 80 | } 81 | 82 | function unmount_partition() { 83 | tmpdir=$1 84 | 85 | umount ${tmpdir} 86 | rmdir ${tmpdir} 87 | } 88 | 89 | # Generators of device model parameters 90 | 91 | function add_cpus() { 92 | # Each parameter of this function is considered the processor ID (as is reported in /proc/cpuinfo) of a CPU assigned 93 | # to a post-launched RTVM. 94 | 95 | if [ "${vm_type}" = "RTVM" ] || [ "${scheduler}" = "SCHED_NOOP" ]; then 96 | offline_cpus $* 97 | fi 98 | 99 | cpu_list=$(local IFS=, ; echo "$*") 100 | echo -n "--cpu_affinity ${cpu_list}" 101 | } 102 | 103 | function add_interrupt_storm_monitor() { 104 | threshold_per_sec=$1 105 | probe_period_in_sec=$2 106 | inject_delay_in_ms=$3 107 | delay_duration_in_ms=$4 108 | 109 | echo -n "--intr_monitor ${threshold_per_sec},${probe_period_in_sec},${inject_delay_in_ms},${delay_duration_in_ms}" 110 | } 111 | 112 | function add_logger_settings() { 113 | loggers=() 114 | 115 | for conf in $*; do 116 | logger=${conf%=*} 117 | level=${conf#*=} 118 | loggers+=("${logger},level=${level}") 119 | done 120 | 121 | cmd_param=$(local IFS=';' ; echo "${loggers[*]}") 122 | echo -n "--logger_setting ${cmd_param}" 123 | } 124 | 125 | function add_virtual_device() { 126 | slot=$1 127 | kind=$2 128 | options=$3 129 | 130 | if [ "${kind}" = "virtio-net" ]; then 131 | # Create the tap device 132 | if [[ ${options} =~ tap=([^,]+) ]]; then 133 | tap_conf="${BASH_REMATCH[1]}" 134 | create_tap "${tap_conf}" >> /dev/stderr 135 | fi 136 | fi 137 | 138 | if [ "${kind}" = "virtio-input" ]; then 139 | options=$* 140 | if [[ "${options}" =~ id:([a-zA-Z0-9_\-]*) ]]; then 141 | unique_identifier="${BASH_REMATCH[1]}" 142 | options=${options/",id:${unique_identifier}"/''} 143 | fi 144 | 145 | if [[ "${options}" =~ (Device name: )(.*),( Device physical path: )(.*) ]]; then 146 | device_name="${BASH_REMATCH[2]}" 147 | phys_name="${BASH_REMATCH[4]}" 148 | local IFS=$'\n' 149 | device_name_paths=$(grep -r "${device_name}" /sys/class/input/event*/device/name) 150 | phys_paths=$(grep -r "${phys_name}" /sys/class/input/event*/device/phys) 151 | fi 152 | 153 | if [ -n "${device_name_paths}" ] && [ -n "${phys_paths}" ]; then 154 | for device_path in ${device_name_paths}; do 155 | for phys_path in ${phys_paths}; do 156 | if [ "${device_path%/device*}" = "${phys_path%/device*}" ]; then 157 | event_path=${device_path} 158 | if [[ ${event_path} =~ event([0-9]+) ]]; then 159 | event_num="${BASH_REMATCH[1]}" 160 | options="/dev/input/event${event_num}" 161 | break 162 | fi 163 | fi 164 | done 165 | done 166 | fi 167 | 168 | if [[ ${options} =~ event([0-9]+) ]]; then 169 | echo "${options} input device path is available in the service vm." >> /dev/stderr 170 | else 171 | echo "${options} input device path is not found in the service vm." >> /dev/stderr 172 | return 173 | fi 174 | 175 | if [ -n "${options}" ] && [ -n "${unique_identifier}" ]; then 176 | options="${options},${unique_identifier}" 177 | fi 178 | 179 | fi 180 | 181 | echo -n "-s ${slot},${kind}" 182 | if [ -n "${options}" ]; then 183 | echo -n ",${options}" 184 | fi 185 | } 186 | 187 | function add_passthrough_device() { 188 | slot=$1 189 | physical_bdf=$2 190 | options=$3 191 | 192 | unbind_device ${physical_bdf%,*} 193 | 194 | # bus, device and function as decimal integers 195 | bus_temp=${physical_bdf#*:}; bus=$((16#${bus_temp%:*})) 196 | dev_temp=${physical_bdf##*:}; dev=$((16#${dev_temp%.*})) 197 | fun=$((16#${physical_bdf#*.})) 198 | 199 | echo -n "-s " 200 | printf '%s,passthru,%x/%x/%x' ${slot} ${bus} ${dev} ${fun} 201 | if [ -n "${options}" ]; then 202 | echo -n ",${options}" 203 | fi 204 | } 205 | 206 | ### 207 | # The followings are generated by launch_cfg_gen.py 208 | ### 209 | 210 | # Defining variables that describe VM types 211 | vm_type='STANDARD_VM' 212 | scheduler='SCHED_BVT' 213 | 214 | # Initializing 215 | probe_modules 216 | mac=$(cat /sys/class/net/e*/address) 217 | 218 | # Invoking ACRN device model 219 | dm_params=( 220 | `add_cpus 0 2` 221 | -m 512M 222 | --ovmf /usr/share/acrn/bios/OVMF.fd 223 | `add_virtual_device 1:0 lpc` 224 | `add_virtual_device 0:0 hostbridge` 225 | `add_virtual_device 3 virtio-console @stdio:stdio_port` 226 | `add_virtual_device 4 virtio-net tap=YaaG3,mac_seed=${mac:0:17}-POST_STD_VM2` 227 | `add_virtual_device 5 virtio-blk /var/lib/machines/core-image-weston.wic` 228 | `add_logger_settings console=4 kmsg=3 disk=5` 229 | POST_STD_VM2 230 | ) 231 | 232 | echo "Launch device model with parameters: ${dm_params[@]}" 233 | acrn-dm "${dm_params[@]}" 234 | 235 | # Deinitializing 236 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/0001-efi-libstub-Use-std-gnu11-to-fix-build-with-GCC-15.patch: -------------------------------------------------------------------------------- 1 | From e82ea8619920213f6fb3bf19e1f05ec3684001de Mon Sep 17 00:00:00 2001 2 | From: Nathan Chancellor 3 | Date: Tue, 21 Jan 2025 18:11:34 -0700 4 | Subject: [PATCH 1/3] efi: libstub: Use '-std=gnu11' to fix build with GCC 15 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | commit 8ba14d9f490aef9fd535c04e9e62e1169eb7a055 upstream. 10 | 11 | GCC 15 changed the default C standard version to C23, which should not 12 | have impacted the kernel because it requests the gnu11 standard via 13 | '-std=' in the main Makefile. However, the EFI libstub Makefile uses its 14 | own set of KBUILD_CFLAGS for x86 without a '-std=' value (i.e., using 15 | the default), resulting in errors from the kernel's definitions of bool, 16 | true, and false in stddef.h, which are reserved keywords under C23. 17 | 18 | ./include/linux/stddef.h:11:9: error: expected identifier before ‘false’ 19 | 11 | false = 0, 20 | ./include/linux/types.h:35:33: error: two or more data types in declaration specifiers 21 | 35 | typedef _Bool bool; 22 | 23 | Set '-std=gnu11' in the x86 cflags to resolve the error and consistently 24 | use the same C standard version for the entire kernel. All other 25 | architectures reuse KBUILD_CFLAGS from the rest of the kernel, so this 26 | issue is not visible for them. 27 | 28 | Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.1.y&id=92ca4f40f6c5d61e0175a5f0417471ddc146d28a] 29 | 30 | Cc: stable@vger.kernel.org 31 | Reported-by: Kostadin Shishmanov 32 | Closes: https://lore.kernel.org/4OAhbllK7x4QJGpZjkYjtBYNLd_2whHx9oFiuZcGwtVR4hIzvduultkgfAIRZI3vQpZylu7Gl929HaYFRGeMEalWCpeMzCIIhLxxRhq4U-Y=@protonmail.com/ 33 | Reported-by: Jakub Jelinek 34 | Closes: https://lore.kernel.org/Z4467umXR2PZ0M1H@tucnak/ 35 | Signed-off-by: Nathan Chancellor 36 | Signed-off-by: Ard Biesheuvel 37 | Signed-off-by: Greg Kroah-Hartman 38 | Signed-off-by: Naveen Saini 39 | --- 40 | drivers/firmware/efi/libstub/Makefile | 2 +- 41 | 1 file changed, 1 insertion(+), 1 deletion(-) 42 | 43 | diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile 44 | index 748781c25787..0c3893f00d55 100644 45 | --- a/drivers/firmware/efi/libstub/Makefile 46 | +++ b/drivers/firmware/efi/libstub/Makefile 47 | @@ -7,7 +7,7 @@ 48 | # 49 | cflags-$(CONFIG_X86_32) := -march=i386 50 | cflags-$(CONFIG_X86_64) := -mcmodel=small 51 | -cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ \ 52 | +cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -std=gnu11 \ 53 | -fPIC -fno-strict-aliasing -mno-red-zone \ 54 | -mno-mmx -mno-sse -fshort-wchar \ 55 | -Wno-pointer-sign \ 56 | -- 57 | 2.37.3 58 | 59 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/0001-lib-build_OID_registry-fix-reproducibility-issues.patch: -------------------------------------------------------------------------------- 1 | From 2fca0fd719812ea2ff67630b01355aa80481623e Mon Sep 17 00:00:00 2001 2 | From: Bruce Ashfield 3 | Date: Sun, 10 Jul 2022 22:56:53 -0400 4 | Subject: [PATCH] lib/build_OID_registry: fix reproducibility issues 5 | 6 | The script build_OID_registry captures the full path of itself 7 | in the generated data. This causes reproduciblity issues as the 8 | path is captured and packaged. 9 | 10 | We use the basename of the script instead, and that allows us 11 | to be reprodicible, with slightly less information captured in 12 | the output data (but the generating script can still easily 13 | be found). 14 | 15 | Signed-off-by: Bruce Ashfield 16 | Upstream-Status: Inappropriate 17 | 18 | Taken from linux-yocto, v5.15/standard/base. 19 | 20 | Signed-off-by: Anuj Mittal 21 | --- 22 | lib/build_OID_registry | 3 ++- 23 | 1 file changed, 2 insertions(+), 1 deletion(-) 24 | 25 | diff --git a/lib/build_OID_registry b/lib/build_OID_registry 26 | index d7fc32ea8ac2..f6de0a7f7457 100755 27 | --- a/lib/build_OID_registry 28 | +++ b/lib/build_OID_registry 29 | @@ -8,6 +8,7 @@ 30 | # 31 | 32 | use strict; 33 | +use File::Basename; 34 | 35 | my @names = (); 36 | my @oids = (); 37 | @@ -35,7 +36,7 @@ close IN_FILE || die; 38 | # 39 | open C_FILE, ">$ARGV[1]" or die; 40 | print C_FILE "/*\n"; 41 | -print C_FILE " * Automatically generated by ", $0, ". Do not edit\n"; 42 | +print C_FILE " * Automatically generated by ", basename $0, ". Do not edit\n"; 43 | print C_FILE " */\n"; 44 | 45 | # 46 | -- 47 | 2.36.1 48 | 49 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch: -------------------------------------------------------------------------------- 1 | From 1403f21678da77f6662f26e16b6bd377e167d660 Mon Sep 17 00:00:00 2001 2 | From: Bruce Ashfield 3 | Date: Tue, 13 Jun 2023 13:58:32 +0800 4 | Subject: [PATCH] menuconfig,mconf-cfg: Allow specification of ncurses location 5 | 6 | In some cross build environments such as the Yocto Project build 7 | environment it provides an ncurses library that is compiled 8 | differently than the host's version. This causes display corruption 9 | problems when the host's curses includes are used instead of the 10 | includes from the provided compiler are overridden. There is a second 11 | case where there is no curses libraries at all on the host system and 12 | menuconfig will just fail entirely. 13 | 14 | The solution is simply to allow an override variable in 15 | check-lxdialog.sh for environments such as the Yocto Project. Adding 16 | a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue and allowing 17 | compiling and linking against the right headers and libraries. 18 | 19 | Upstream-Status: Submitted 20 | 21 | Signed-off-by: Jason Wessel 22 | cc: Michal Marek 23 | cc: linux-kbuild@vger.kernel.org 24 | Signed-off-by: Bruce Ashfield 25 | --- 26 | scripts/kconfig/mconf-cfg.sh | 9 +++++++++ 27 | 1 file changed, 9 insertions(+) 28 | 29 | diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh 30 | index 025b565e0b7c..89a2c6b057ad 100755 31 | --- a/scripts/kconfig/mconf-cfg.sh 32 | +++ b/scripts/kconfig/mconf-cfg.sh 33 | @@ -4,6 +4,15 @@ 34 | PKG="ncursesw" 35 | PKG2="ncurses" 36 | 37 | +if [ "$CROSS_CURSES_LIB" != "" ]; then 38 | + echo libs=\'$CROSS_CURSES_LIB\' 39 | + if [ x"$CROSS_CURSES_INC" != x ]; then 40 | + echo cflags=\'$CROSS_CURSES_INC\' 41 | + fi 42 | + exit 0 43 | +fi 44 | + 45 | + 46 | if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then 47 | if ${HOSTPKG_CONFIG} --exists $PKG; then 48 | echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG)\" 49 | -- 50 | 2.34.1 51 | 52 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/0001-vt-conmakehash-improve-reproducibility.patch: -------------------------------------------------------------------------------- 1 | From 0f586f4ee8adacac79b64d1f3d47799a5eb7fbea Mon Sep 17 00:00:00 2001 2 | From: Bruce Ashfield 3 | Date: Sun, 10 Jul 2022 21:37:07 -0400 4 | Subject: [PATCH] vt/conmakehash: improve reproducibility 5 | 6 | The file generated by conmakehash capture the application 7 | path used to generate the file. While that can be informative, 8 | it varies based on where the kernel was built, as the full 9 | path is captured. 10 | 11 | We tweak the application to use a second input as the "capture 12 | name", and then modify the Makefile to pass the basename of 13 | the source, making it reproducible. 14 | 15 | This could be improved by using some sort of path mapping, 16 | or the application manipualing argv[1] itself, but for now 17 | this solves the reprodicibility issue. 18 | 19 | Signed-off-by: Bruce Ashfield 20 | 21 | Upstream-Status: Inappropriate 22 | 23 | Taken from linux-yocto, v5.15/standard/base 24 | Signed-off-by: Anuj Mittal 25 | --- 26 | drivers/tty/vt/Makefile | 2 +- 27 | drivers/tty/vt/conmakehash.c | 2 +- 28 | 2 files changed, 2 insertions(+), 2 deletions(-) 29 | 30 | diff --git a/drivers/tty/vt/Makefile b/drivers/tty/vt/Makefile 31 | index fe30ce512819..cb51c21b58f9 100644 32 | --- a/drivers/tty/vt/Makefile 33 | +++ b/drivers/tty/vt/Makefile 34 | @@ -15,7 +15,7 @@ clean-files := consolemap_deftbl.c defkeymap.c 35 | hostprogs += conmakehash 36 | 37 | quiet_cmd_conmk = CONMK $@ 38 | - cmd_conmk = $(obj)/conmakehash $< > $@ 39 | + cmd_conmk = $(obj)/conmakehash $< $(shell basename $<) > $@ 40 | 41 | $(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) $(obj)/conmakehash 42 | $(call cmd,conmk) 43 | diff --git a/drivers/tty/vt/conmakehash.c b/drivers/tty/vt/conmakehash.c 44 | index cddd789fe46e..d62510b280e9 100644 45 | --- a/drivers/tty/vt/conmakehash.c 46 | +++ b/drivers/tty/vt/conmakehash.c 47 | @@ -253,7 +253,7 @@ int main(int argc, char *argv[]) 48 | #include \n\ 49 | \n\ 50 | u8 dfont_unicount[%d] = \n\ 51 | -{\n\t", argv[1], fontlen); 52 | +{\n\t", argv[2], fontlen); 53 | 54 | for ( i = 0 ; i < fontlen ; i++ ) 55 | { 56 | -- 57 | 2.36.1 58 | 59 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/0002-x86-boot-Use-std-gnu11-to-fix-build-with-GCC-15.patch: -------------------------------------------------------------------------------- 1 | From 12ae46a52cc7d91dddd60d3e43ae1491066c08ac Mon Sep 17 00:00:00 2001 2 | From: Nathan Chancellor 3 | Date: Tue, 21 Jan 2025 18:11:33 -0700 4 | Subject: [PATCH 2/3] x86/boot: Use '-std=gnu11' to fix build with GCC 15 5 | MIME-Version: 1.0 6 | Content-Type: text/plain; charset=UTF-8 7 | Content-Transfer-Encoding: 8bit 8 | 9 | commit ee2ab467bddfb2d7f68d996dbab94d7b88f8eaf7 upstream. 10 | 11 | GCC 15 changed the default C standard version to C23, which should not 12 | have impacted the kernel because it requests the gnu11 standard via 13 | '-std=' in the main Makefile. However, the x86 compressed boot Makefile 14 | uses its own set of KBUILD_CFLAGS without a '-std=' value (i.e., using 15 | the default), resulting in errors from the kernel's definitions of bool, 16 | true, and false in stddef.h, which are reserved keywords under C23. 17 | 18 | ./include/linux/stddef.h:11:9: error: expected identifier before ‘false’ 19 | 11 | false = 0, 20 | ./include/linux/types.h:35:33: error: two or more data types in declaration specifiers 21 | 35 | typedef _Bool bool; 22 | 23 | Set '-std=gnu11' in the x86 compressed boot Makefile to resolve the 24 | error and consistently use the same C standard version for the entire 25 | kernel. 26 | 27 | Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.1.y&id=0f82f6f1556389d6489795f03ac3f68cde99d5ad] 28 | 29 | Closes: https://lore.kernel.org/4OAhbllK7x4QJGpZjkYjtBYNLd_2whHx9oFiuZcGwtVR4hIzvduultkgfAIRZI3vQpZylu7Gl929HaYFRGeMEalWCpeMzCIIhLxxRhq4U-Y=@protonmail.com/ 30 | Closes: https://lore.kernel.org/Z4467umXR2PZ0M1H@tucnak/ 31 | Reported-by: Kostadin Shishmanov 32 | Reported-by: Jakub Jelinek 33 | Signed-off-by: Nathan Chancellor 34 | Signed-off-by: Dave Hansen 35 | Reviewed-by: Ard Biesheuvel 36 | Cc:stable@vger.kernel.org 37 | Link: https://lore.kernel.org/all/20250121-x86-use-std-consistently-gcc-15-v1-1-8ab0acf645cb%40kernel.org 38 | Signed-off-by: Greg Kroah-Hartman 39 | Signed-off-by: Naveen Saini 40 | --- 41 | arch/x86/boot/compressed/Makefile | 1 + 42 | 1 file changed, 1 insertion(+) 43 | 44 | diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile 45 | index 897f56533e6c..21e1a3b6639d 100644 46 | --- a/arch/x86/boot/compressed/Makefile 47 | +++ b/arch/x86/boot/compressed/Makefile 48 | @@ -34,6 +34,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \ 49 | # avoid errors with '-march=i386', and future flags may depend on the target to 50 | # be valid. 51 | KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS) 52 | +KBUILD_CFLAGS += -std=gnu11 53 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIE 54 | KBUILD_CFLAGS += -Wundef 55 | KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING 56 | -- 57 | 2.37.3 58 | 59 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/0003-x86-boot-Compile-boot-code-with-std-gnu11-too.patch: -------------------------------------------------------------------------------- 1 | From 86058cbb4f9f6e85ea563f38c41438c96b4d9eec Mon Sep 17 00:00:00 2001 2 | From: Alexey Dobriyan 3 | Date: Wed, 27 Sep 2023 18:42:11 +0300 4 | Subject: [PATCH 3/3] x86/boot: Compile boot code with -std=gnu11 too 5 | 6 | Use -std=gnu11 for consistency with main kernel code. 7 | 8 | It doesn't seem to change anything in vmlinux. 9 | 10 | Upstream-Status: Backport [https://github.com/intel/linux-intel-lts/commit/b3bee1e7c3f2b1b77182302c7b2131c804175870] 11 | 12 | Signed-off-by: Alexey Dobriyan 13 | Signed-off-by: Ingo Molnar 14 | Acked-by: H. Peter Anvin (Intel) 15 | Link: https://lore.kernel.org/r/2058761e-12a4-4b2f-9690-3c3c1c9902a5@p183 16 | Signed-off-by: Naveen Saini 17 | --- 18 | arch/x86/Makefile | 2 +- 19 | 1 file changed, 1 insertion(+), 1 deletion(-) 20 | 21 | diff --git a/arch/x86/Makefile b/arch/x86/Makefile 22 | index 3419ffa2a350..a4764ec92373 100644 23 | --- a/arch/x86/Makefile 24 | +++ b/arch/x86/Makefile 25 | @@ -43,7 +43,7 @@ endif 26 | 27 | # How to compile the 16-bit code. Note we always compile for -march=i386; 28 | # that way we can complain to the user if the CPU is insufficient. 29 | -REALMODE_CFLAGS := -m16 -g -Os -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \ 30 | +REALMODE_CFLAGS := -std=gnu11 -m16 -g -Os -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS \ 31 | -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \ 32 | -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ 33 | -mno-mmx -mno-sse $(call cc-option,-fcf-protection=none) 34 | -- 35 | 2.37.3 36 | 37 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/acrn-common.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_UIO_PCI_GENERIC=m 2 | CONFIG_SERIAL_8250_EXTENDED=y 3 | CONFIG_SERIAL_8250_DETECT_IRQ=y 4 | 5 | CONFIG_ACRN_GUEST=y 6 | CONFIG_MARVELL_PHY=m 7 | CONFIG_MARVELL_10G_PHY=m 8 | 9 | CONFIG_IGC=y 10 | CONFIG_PCIE_PTM=y 11 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/fix-perf-reproducibility.patch: -------------------------------------------------------------------------------- 1 | From b8cd0e429bf75b673c438a8277d4bc74327df992 Mon Sep 17 00:00:00 2001 2 | From: Tom Zanussi 3 | Date: Tue, 3 Jul 2012 13:07:23 -0500 4 | Subject: perf: change --root to --prefix for python install 5 | 6 | Otherwise we get the sysroot path appended to the build path, not what 7 | we want. 8 | 9 | Signed-off-by: Tom Zanussi 10 | 11 | Upstream-Status: Inappropriate 12 | 13 | Taken from linux-yocto, v5.15/standard/base 14 | https://git.yoctoproject.org/linux-yocto/commit?id=b8cd0e429bf75b673c438a8277d4bc74327df992&h=v5.15%2Fstandard%2Fbase 15 | 16 | Signed-off-by: Anuj Mittal 17 | --- 18 | tools/perf/Makefile.perf | 2 +- 19 | 1 file changed, 1 insertion(+), 1 deletion(-) 20 | 21 | (limited to 'tools/perf/Makefile.perf') 22 | 23 | diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf 24 | index 8f738e11356d..ee945d8e3996 100644 25 | --- a/tools/perf/Makefile.perf 26 | +++ b/tools/perf/Makefile.perf 27 | @@ -1022,7 +1022,7 @@ install-bin: install-tools install-tests install-traceevent-plugins 28 | install: install-bin try-install-man 29 | 30 | install-python_ext: 31 | - $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)' 32 | + $(PYTHON_WORD) util/setup.py --quiet install --prefix='$(DESTDIR_SQ)/usr' 33 | 34 | # 'make install-doc' should call 'make -C Documentation install' 35 | $(INSTALL_DOC_TARGETS): 36 | -- 37 | cgit 38 | 39 | 40 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/service-vm.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_INTEL_TH=y 2 | 3 | CONFIG_BRIDGE=y 4 | CONFIG_TUN=y 5 | CONFIG_JUMP_LABEL=y 6 | 7 | CONFIG_CMA=y 8 | CONFIG_DMA_CMA=y 9 | 10 | CONFIG_DRM_I915=y 11 | CONFIG_DRM_I915_GVT=y 12 | 13 | CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y 14 | CONFIG_VIRT_DRIVERS=y 15 | 16 | # CONFIG_VIRTIO_BALLOON is not set 17 | 18 | CONFIG_PCI_STUB=y 19 | 20 | CONFIG_VHOST_NET=m 21 | CONFIG_VHOST=m 22 | 23 | CONFIG_OPENVSWITCH=m 24 | 25 | 26 | # Let Service VM kernel start from higher address to avoid its memory conflict with grub modules 27 | CONFIG_IOMMU_SUPPORT=n 28 | CONFIG_INTEL_IOMMU=n 29 | 30 | # OpenStack-related settings 31 | CONFIG_IP6_NF_NAT=m 32 | CONFIG_BLK_DEV_BSGLIB=y 33 | CONFIG_SCSI_ISCSI_ATTRS=m 34 | 35 | # Temporarily disabled to avoid the kernel crash caused by the driver bug 36 | CONFIG_PWM_DWC=n 37 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/service-vm_6.1.cfg: -------------------------------------------------------------------------------- 1 | # ACRN HSM basic driver 2 | CONFIG_ACRN_HSM=y 3 | CONFIG_SERIAL_8250_NR_UARTS=16 4 | CONFIG_SERIAL_8250_RUNTIME_UARTS=16 5 | CONFIG_ICE=y 6 | CONFIG_KVM=y 7 | CONFIG_KVM_INTEL=y 8 | CONFIG_DM_THIN_PROVISIONING=y 9 | CONFIG_DRM_AST=y 10 | CONFIG_DRM_VRAM_HELPER=y 11 | CONFIG_DRM_TTM_HELPER=y 12 | CONFIG_VHOST_VSOCK=m 13 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/service-vm_6.1.scc: -------------------------------------------------------------------------------- 1 | define KFEATURE_DESCRIPTION "Add required kernel features for 6.1 Service VM kernel" 2 | define KFEATURE_COMPATIBILITY board 3 | 4 | kconf non-hardware acrn-common.cfg 5 | kconf non-hardware service-vm.cfg 6 | kconf non-hardware service-vm_6.1.cfg 7 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/user-rtvm.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_X86_X2APIC=y 2 | CONFIG_RCU_NOCB_CPU=y 3 | CONFIG_NO_HZ_FULL=y 4 | CONFIG_NO_HZ_IDLE=n 5 | CONFIG_VIRTIO_PMD=y 6 | CONFIG_CMDLINE_BOOL=n 7 | CONFIG_SERIAL_8250_NR_UARTS=16 8 | CONFIG_SERIAL_8250_RUNTIME_UARTS=16 9 | CONFIG_X86_TCC_PTCM=y 10 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/user-rtvm_6.1.scc: -------------------------------------------------------------------------------- 1 | define KFEATURE_DESCRIPTION "Add required kernel features for 6.1 User VM Preempt RT kernel" 2 | define KFEATURE_COMPATIBILITY board 3 | 4 | kconf non-hardware acrn-common.cfg 5 | kconf non-hardware user-vm.cfg 6 | kconf non-hardware user-vm_6.1.cfg 7 | kconf non-hardware user-rtvm.cfg 8 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/user-vm.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/meta-acrn/e670a17d231a9efca642c5d673ba63b401fc12bd/recipes-kernel/linux/files/user-vm.cfg -------------------------------------------------------------------------------- /recipes-kernel/linux/files/user-vm_6.1.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_UIO=y 2 | CONFIG_MODULE_SIG=n 3 | -------------------------------------------------------------------------------- /recipes-kernel/linux/files/user-vm_6.1.scc: -------------------------------------------------------------------------------- 1 | define KFEATURE_DESCRIPTION "Add required kernel features for 6.1 User VM kernel" 2 | define KFEATURE_COMPATIBILITY board 3 | 4 | kconf non-hardware acrn-common.cfg 5 | kconf non-hardware user-vm.cfg 6 | kconf non-hardware user-vm_6.1.cfg 7 | -------------------------------------------------------------------------------- /recipes-kernel/linux/linux-intel-acrn-rtvm_6.1.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Linux Preempt RT Kernel with ACRN enabled (User VM)" 2 | 3 | require linux-intel-acrn.inc 4 | 5 | SRC_URI:prepend = "git://github.com/intel/linux-intel-lts.git;protocol=https;name=machine;branch=${KBRANCH}; \ 6 | file://0001-efi-libstub-Use-std-gnu11-to-fix-build-with-GCC-15.patch \ 7 | file://0002-x86-boot-Use-std-gnu11-to-fix-build-with-GCC-15.patch \ 8 | file://0003-x86-boot-Compile-boot-code-with-std-gnu11-too.patch \ 9 | " 10 | 11 | # PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying 12 | # to build multiple virtual/kernel providers. 13 | python () { 14 | if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-intel-acrn-rtvm": 15 | raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-intel-acrn-rtvm to enable it") 16 | } 17 | 18 | SRC_URI:append = " file://user-rtvm_6.1.scc \ 19 | " 20 | 21 | KBRANCH = "6.1/preempt-rt" 22 | KMETA_BRANCH = "yocto-6.1" 23 | 24 | LINUX_VERSION ?= "6.1.120" 25 | SRCREV_machine ?= "4e71d19579a2d25d2aa2f0840c3434de41b84d29" 26 | SRCREV_meta ?= "6eaf8a4970cbb152ff4c6403a7cf8a14e540be1b" 27 | 28 | LINUX_VERSION_EXTENSION = "-linux-intel-acrn-preempt-rtvm" 29 | 30 | LINUX_KERNEL_TYPE = "preempt-rt" 31 | -------------------------------------------------------------------------------- /recipes-kernel/linux/linux-intel-acrn-service-vm_6.1.bb: -------------------------------------------------------------------------------- 1 | require linux-intel-acrn_6.1.inc 2 | 3 | SRC_URI:append = " file://service-vm_6.1.scc" 4 | 5 | LINUX_VERSION_EXTENSION = "-linux-intel-acrn-service-vm" 6 | 7 | SUMMARY = "Linux Kernel with ACRN enabled (Service VM)" 8 | 9 | KERNEL_FEATURES:append = " features/criu/criu-enable.scc \ 10 | cgl/cfg/iscsi.scc \ 11 | service-vm_6.1.scc \ 12 | " 13 | 14 | # config warning: 'CONFIG_IRQ_REMAP' last val (y) and .config val (n) do not matchs 15 | # It is because, CONFIG_IRQ_REMAP depends upon IOMMU_SUPPORT, which we are explicitly disabling by setting to 'n' 16 | # So, to suppress this warning, set 17 | KCONF_AUDIT_LEVEL = "0" 18 | -------------------------------------------------------------------------------- /recipes-kernel/linux/linux-intel-acrn-user-vm_6.1.bb: -------------------------------------------------------------------------------- 1 | require linux-intel-acrn_6.1.inc 2 | 3 | SRC_URI:append = " file://user-vm_6.1.scc" 4 | 5 | LINUX_VERSION_EXTENSION = "-linux-intel-acrn-user-vm" 6 | 7 | SUMMARY = "Linux Kernel with ACRN enabled (User VM)" 8 | -------------------------------------------------------------------------------- /recipes-kernel/linux/linux-intel-acrn.inc: -------------------------------------------------------------------------------- 1 | SUMMARY = "Linux Intel Kernel with ACRN enabled" 2 | 3 | require recipes-kernel/linux/linux-yocto.inc 4 | require recipes-kernel/linux/meta-intel-compat-kernel.inc 5 | 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" 7 | 8 | KERNEL_CONFIG_URI ?= "git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=${KMETA_BRANCH};destsuffix=${KMETA}" 9 | 10 | SRC_URI = " \ 11 | ${KERNEL_CONFIG_URI} \ 12 | file://0001-vt-conmakehash-improve-reproducibility.patch \ 13 | file://0001-lib-build_OID_registry-fix-reproducibility-issues.patch \ 14 | file://fix-perf-reproducibility.patch \ 15 | file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \ 16 | " 17 | KMETA = "kernel-meta" 18 | 19 | DEPENDS += "elfutils-native openssl-native util-linux-native" 20 | 21 | PV = "${LINUX_VERSION}+git${SRCPV}" 22 | 23 | COMPATIBLE_MACHINE ?= "(intel-corei7-64)" 24 | 25 | KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}" 26 | 27 | KERNEL_FEATURES:append = " features/netfilter/netfilter.scc \ 28 | features/security/security.scc \ 29 | cfg/hv-guest.scc \ 30 | cfg/paravirt_kvm.scc \ 31 | features/net/stmicro/stmmac.cfg \ 32 | " 33 | -------------------------------------------------------------------------------- /recipes-kernel/linux/linux-intel-acrn_6.1.inc: -------------------------------------------------------------------------------- 1 | SUMMARY = "Linux Kernel 6.1 with ACRN enabled" 2 | 3 | require linux-intel-acrn.inc 4 | 5 | SRC_URI:prepend = "git://github.com/intel/linux-intel-lts.git;protocol=https;name=machine;branch=${KBRANCH}; \ 6 | file://0001-efi-libstub-Use-std-gnu11-to-fix-build-with-GCC-15.patch \ 7 | file://0002-x86-boot-Use-std-gnu11-to-fix-build-with-GCC-15.patch \ 8 | file://0003-x86-boot-Compile-boot-code-with-std-gnu11-too.patch \ 9 | " 10 | KBRANCH = "6.1/linux" 11 | KMETA_BRANCH = "yocto-6.1" 12 | 13 | LINUX_VERSION ?= "6.1.120" 14 | SRCREV_machine ?= "5a2eed202a03376b0c9098bc7b9f06eba1be317f" 15 | SRCREV_meta ?= "6eaf8a4970cbb152ff4c6403a7cf8a14e540be1b" 16 | -------------------------------------------------------------------------------- /scripts/lib/wic/plugins/source/acrn-bootimg-efi.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020, Intel Corporation. 3 | # 4 | # SPDX-License-Identifier: GPL-2.0-only 5 | # 6 | # DESCRIPTION 7 | # This implements the 'acrn-bootimg-efi' source plugin class for 'wic'. 8 | # This source plugin should default with grub-efi 9 | # AUTHORS 10 | # Lee Chee Yang 11 | # 12 | 13 | import logging 14 | import os 15 | import shutil 16 | import re 17 | 18 | from glob import glob 19 | 20 | from wic import WicError 21 | from wic.engine import get_custom_config 22 | from wic.pluginbase import SourcePlugin 23 | from wic.misc import (exec_cmd, exec_native_cmd, 24 | get_bitbake_var, BOOTDD_EXTRA_SPACE) 25 | 26 | logger = logging.getLogger('wic') 27 | 28 | class BootimgEFIPlugin(SourcePlugin): 29 | """ 30 | Create EFI boot partition for acrn image. 31 | """ 32 | 33 | name = 'acrn-bootimg-efi' 34 | 35 | @classmethod 36 | def do_configure_grubefi(cls, hdddir, creator, cr_workdir, source_params): 37 | """ 38 | Create grub.cfg 39 | """ 40 | configfile = creator.ks.bootloader.configfile 41 | custom_cfg = None 42 | if configfile: 43 | custom_cfg = get_custom_config(configfile) 44 | if custom_cfg: 45 | # Use a custom configuration 46 | grubefi_conf = custom_cfg 47 | logger.debug("Using custom configuration file " 48 | "%s for grub.cfg", configfile) 49 | else: 50 | raise WicError("configfile is specified but failed to " 51 | "get it from %s." % configfile) 52 | 53 | initrd = source_params.get('initrd') 54 | 55 | if initrd: 56 | bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") 57 | if not bootimg_dir: 58 | raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") 59 | 60 | initrds = initrd.split(';') 61 | for rd in initrds: 62 | cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir) 63 | exec_cmd(cp_cmd, True) 64 | else: 65 | logger.debug("Ignoring missing initrd") 66 | 67 | if not custom_cfg: 68 | # Create grub configuration using parameters from wks file 69 | bootloader = creator.ks.bootloader 70 | title = source_params.get('title') 71 | 72 | grubefi_conf = "" 73 | grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n" 74 | grubefi_conf += "default='ACRN (Yocto)'\n" 75 | grubefi_conf += "timeout=%s\n" % bootloader.timeout 76 | grubefi_conf += "menuentry '%s'{\n" % (title if title else "boot") 77 | 78 | kernel = get_bitbake_var("KERNEL_IMAGETYPE") 79 | if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1": 80 | if get_bitbake_var("INITRAMFS_IMAGE"): 81 | kernel = "%s-%s.bin" % \ 82 | (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME")) 83 | 84 | label = source_params.get('label') 85 | label_conf = "root=%s" % creator.rootdev 86 | if label: 87 | label_conf = "LABEL=%s" % label 88 | 89 | grubefi_conf += "linux /%s %s rootwait %s\n" \ 90 | % (kernel, label_conf, bootloader.append) 91 | 92 | if initrd: 93 | initrds = initrd.split(';') 94 | grubefi_conf += "initrd" 95 | for rd in initrds: 96 | grubefi_conf += " /%s" % rd 97 | grubefi_conf += "\n" 98 | 99 | grubefi_conf += "}\n" 100 | grubefi_conf += "menuentry 'ACRN (Yocto)'{\n" 101 | 102 | aux_modules = get_bitbake_var("ACRN_EFI_GRUB2_MOD_CFG") 103 | if aux_modules: 104 | aux_modules = aux_modules.split(";") 105 | for aux_module in aux_modules: 106 | if not aux_module: 107 | continue 108 | grubefi_conf += "%s\n" % aux_module 109 | 110 | acrn_bootparams = get_bitbake_var("ACRN_HV_EFI_CFG") 111 | if acrn_bootparams: 112 | grubefi_conf += "\nmultiboot2 /acrn.bin %s %s \n" % \ 113 | (label_conf, acrn_bootparams) 114 | else: 115 | grubefi_conf += "\nmultiboot2 /acrn.bin %s \n" % \ 116 | (label_conf) 117 | 118 | boot_confs = get_bitbake_var("ACRN_EFI_BOOT_CONF").split(";") 119 | for boot_conf in boot_confs: 120 | if not boot_conf: 121 | continue 122 | conf = boot_conf.split(":") 123 | if not len(conf) in [2,3,4]: 124 | raise WicError("unable to parse ACRN_EFI_BOOT_CONF, in \"%s\" (unexpected parameter count: %i) exiting" \ 125 | % boot_conf, len(conf) ) 126 | 127 | search_param = "--file %s" %(conf[0]) 128 | kernel_param = "%s" %(conf[0]) 129 | module_param = "%s" %(conf[1]) 130 | 131 | if len(conf) > 2 and conf[2] != "": 132 | module_param = "%s %s\n" %(conf[1] ,conf[2]) 133 | if len(conf) > 3 and conf[3] != "": 134 | search_param = "--label %s" %(conf[3]) 135 | 136 | grubefi_conf += "search --set=mpath %s \n" %(search_param) 137 | grubefi_conf += "set modbin=($mpath)%s \n" %(kernel_param) 138 | grubefi_conf += "module2 $modbin %s\n" %(module_param) 139 | 140 | grubefi_conf += "}\n" 141 | 142 | logger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg", 143 | cr_workdir) 144 | with open("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, "w") as cfg: 145 | cfg.write(grubefi_conf) 146 | 147 | @classmethod 148 | def do_configure_partition(cls, part, source_params, creator, cr_workdir, 149 | oe_builddir, bootimg_dir, kernel_dir, 150 | native_sysroot): 151 | """ 152 | Called before do_prepare_partition(), creates loader-specific config 153 | """ 154 | hdddir = "%s/hdd/boot" % cr_workdir 155 | 156 | install_cmd = "install -d %s/EFI/BOOT" % hdddir 157 | exec_cmd(install_cmd) 158 | 159 | cls.do_configure_grubefi(hdddir, creator, cr_workdir, source_params) 160 | 161 | if get_bitbake_var("IMAGE_EFI_BOOT_FILES") is None: 162 | logger.debug('No boot files defined in IMAGE_EFI_BOOT_FILES') 163 | else: 164 | boot_files = None 165 | for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), (None, None)): 166 | if fmt: 167 | var = fmt % id 168 | else: 169 | var = "" 170 | 171 | boot_files = get_bitbake_var("IMAGE_EFI_BOOT_FILES" + var) 172 | if boot_files: 173 | break 174 | 175 | logger.debug('Boot files: %s', boot_files) 176 | 177 | # list of tuples (src_name, dst_name) 178 | deploy_files = [] 179 | for src_entry in re.findall(r'[\w;\-\./\*]+', boot_files): 180 | if ';' in src_entry: 181 | dst_entry = tuple(src_entry.split(';')) 182 | if not dst_entry[0] or not dst_entry[1]: 183 | raise WicError('Malformed boot file entry: %s' % src_entry) 184 | else: 185 | dst_entry = (src_entry, src_entry) 186 | 187 | logger.debug('Destination entry: %r', dst_entry) 188 | deploy_files.append(dst_entry) 189 | 190 | cls.install_task = []; 191 | for deploy_entry in deploy_files: 192 | src, dst = deploy_entry 193 | if '*' in src: 194 | # by default install files under their basename 195 | entry_name_fn = os.path.basename 196 | if dst != src: 197 | # unless a target name was given, then treat name 198 | # as a directory and append a basename 199 | entry_name_fn = lambda name: \ 200 | os.path.join(dst, 201 | os.path.basename(name)) 202 | 203 | srcs = glob(os.path.join(kernel_dir, src)) 204 | 205 | logger.debug('Globbed sources: %s', ', '.join(srcs)) 206 | for entry in srcs: 207 | src = os.path.relpath(entry, kernel_dir) 208 | entry_dst_name = entry_name_fn(entry) 209 | cls.install_task.append((src, entry_dst_name)) 210 | else: 211 | cls.install_task.append((src, dst)) 212 | 213 | @classmethod 214 | def do_prepare_partition(cls, part, source_params, creator, cr_workdir, 215 | oe_builddir, bootimg_dir, kernel_dir, 216 | rootfs_dir, native_sysroot): 217 | """ 218 | Called to do the actual content population for a partition i.e. it 219 | 'prepares' the partition to be incorporated into the image. 220 | In this case, prepare content for an EFI (grub) boot partition. 221 | """ 222 | if not kernel_dir: 223 | kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") 224 | if not kernel_dir: 225 | raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") 226 | 227 | staging_kernel_dir = kernel_dir 228 | 229 | hdddir = "%s/hdd/boot" % cr_workdir 230 | 231 | kernel = get_bitbake_var("KERNEL_IMAGETYPE") 232 | if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1": 233 | if get_bitbake_var("INITRAMFS_IMAGE"): 234 | kernel = "%s-%s.bin" % \ 235 | (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME")) 236 | 237 | install_cmd = "install -m 0644 %s/%s %s/%s" % \ 238 | (staging_kernel_dir, kernel, hdddir, kernel) 239 | exec_cmd(install_cmd) 240 | 241 | install_cmd = "install -m 0644 %s/acrn.bin %s/acrn.bin" % \ 242 | (staging_kernel_dir, hdddir) 243 | exec_cmd(install_cmd) 244 | 245 | if get_bitbake_var("IMAGE_EFI_BOOT_FILES"): 246 | for src_path, dst_path in cls.install_task: 247 | install_cmd = "install -m 0644 -D %s %s" \ 248 | % (os.path.join(kernel_dir, src_path), 249 | os.path.join(hdddir, dst_path)) 250 | exec_cmd(install_cmd) 251 | 252 | for mod in [x for x in os.listdir(kernel_dir) if x.startswith("grub-efi-")]: 253 | cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[9:]) 254 | exec_cmd(cp_cmd, True) 255 | 256 | startup = os.path.join(kernel_dir, "startup.nsh") 257 | if os.path.exists(startup): 258 | cp_cmd = "cp %s %s/" % (startup, hdddir) 259 | exec_cmd(cp_cmd, True) 260 | 261 | du_cmd = "du -bks %s" % hdddir 262 | out = exec_cmd(du_cmd) 263 | blocks = int(out.split()[0]) 264 | 265 | extra_blocks = part.get_extra_block_count(blocks) 266 | 267 | if extra_blocks < BOOTDD_EXTRA_SPACE: 268 | extra_blocks = BOOTDD_EXTRA_SPACE 269 | 270 | blocks += extra_blocks 271 | 272 | logger.debug("Added %d extra blocks to %s to get to %d total blocks", 273 | extra_blocks, part.mountpoint, blocks) 274 | 275 | # dosfs image, created by mkdosfs 276 | bootimg = "%s/boot.img" % cr_workdir 277 | 278 | label = part.label if part.label else "ESP" 279 | 280 | dosfs_cmd = "mkdosfs -n %s -i %s -C %s %d" % \ 281 | (label, part.fsuuid, bootimg, blocks) 282 | exec_native_cmd(dosfs_cmd, native_sysroot) 283 | 284 | mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir) 285 | exec_native_cmd(mcopy_cmd, native_sysroot) 286 | 287 | chmod_cmd = "chmod 644 %s" % bootimg 288 | exec_cmd(chmod_cmd) 289 | 290 | du_cmd = "du -Lbks %s" % bootimg 291 | out = exec_cmd(du_cmd) 292 | bootimg_size = out.split()[0] 293 | 294 | part.size = int(bootimg_size) 295 | part.source_file = bootimg 296 | -------------------------------------------------------------------------------- /wic/acrn-bootdisk-dmverity.wks.in: -------------------------------------------------------------------------------- 1 | # short-description: Create an dm-verity EFI disk image with acrn and grub-efi 2 | # long-description: Creates a partitioned dm-verity EFI disk image with acrn-hypervisor. 3 | 4 | part /boot --source acrn-bootimg-efi --sourceparams="initrd=microcode.cpio" --ondisk sda --active --align 1024 --use-uuid 5 | 6 | part / --source rawcopy --ondisk sda --sourceparams="file=${IMGDEPLOYDIR}/${DM_VERITY_IMAGE}-${MACHINE}.${DM_VERITY_IMAGE_TYPE}.verity" --use-uuid 7 | 8 | part swap --ondisk sda --size 44 --label swap1 --fstype=swap --use-uuid 9 | 10 | bootloader --ptable gpt --timeout=5 --append=" " 11 | -------------------------------------------------------------------------------- /wic/acrn-bootdisk-microcode.wks.in: -------------------------------------------------------------------------------- 1 | # short-description: Create an EFI disk image with acrn and grub-efi 2 | # long-description: Creates a partitioned EFI disk image with acrn-hypervisor. 3 | 4 | part /boot --source acrn-bootimg-efi --sourceparams="initrd=microcode.cpio" --ondisk sda --active --align 1024 --use-uuid 5 | 6 | part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid 7 | 8 | part swap --ondisk sda --size 44 --label swap1 --fstype=swap --use-uuid 9 | 10 | bootloader --ptable gpt --timeout=5 --append=" rootfstype=ext4 " 11 | --------------------------------------------------------------------------------