Skip to content

Commit a78568c

Browse files
EduKav1813macpijan
authored andcommitted
add xen distro and image
Signed-off-by: Michał Iwanicki <[email protected]> Signed-off-by: Eduard Kaverinskyi <[email protected]> Signed-off-by: Maciej Pijanowski <[email protected]>
1 parent 0ee6305 commit a78568c

File tree

12 files changed

+180
-56
lines changed

12 files changed

+180
-56
lines changed
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
require conf/distro/poky.conf
2+
3+
DISTRO_NAME = "Zarhus distro for demonstration purposes of TrenchBoot project"
4+
DISTRO_VERSION = "0.2.0"
5+
SDK_VENDOR = "-tbsdk"
6+
7+
MAINTAINER = "3mdeb Sp. z o. o. <[email protected]>"
8+
9+
TARGET_VENDOR = "-tb"
10+
11+
DISTRO_FEATURES = " \
12+
ext2 \
13+
keyboard \
14+
largefile \
15+
ldconfig \
16+
nfs \
17+
pci \
18+
systemd \
19+
usbgadget \
20+
usbhost \
21+
tpm2 \
22+
usrmerge \
23+
"
24+
25+
# set content of boot partition
26+
IMAGE_EFI_BOOT_FILES = " \
27+
skl.bin \
28+
acm/*;acm/ \
29+
"
30+
31+
# adds initramfs image to handle label option from grub.cfg
32+
INITRAMFS_IMAGE = "core-image-initramfs-boot"
33+
INITRAMFS_IMAGE_BUNDLE = "1"
34+
35+
# wks related variables
36+
WKS_FILES = "trenchboot-image-efipluslegacy.wks"
37+
WKS_FILE_DEPENDS:append = " grub-native"
38+
39+
# explicitly use systemd and disable sysvinit completely
40+
VIRTUAL-RUNTIME_init_manager = "systemd"
41+
VIRTUAL-RUNTIME_initscripts = ""
42+
VIRTUAL-RUNTIME_syslog = ""
43+
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
44+
45+
# use TrenchBoot Linux and GRUB
46+
PREFERRED_PROVIDER_virtual/kernel = "linux-tb"
47+
PREFERRED_PROVIDER_bootloader/kernel = "grub"
48+
PREFERRED_VERSION_linux-tb ?= "6.6%"

conf/distro/tb-distro.conf

+1-48
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,3 @@
1-
require conf/distro/poky.conf
1+
require conf/distro/include/tb-distro-common.conf
22

33
DISTRO = "tb-distro"
4-
5-
DISTRO_NAME = "Zarhus distro for demonstration purposes of TrenchBoot project"
6-
DISTRO_VERSION = "0.2.0"
7-
SDK_VENDOR = "-tbsdk"
8-
9-
MAINTAINER = "3mdeb Sp. z o. o. <[email protected]>"
10-
11-
TARGET_VENDOR = "-tb"
12-
13-
DISTRO_FEATURES = " \
14-
ext2 \
15-
keyboard \
16-
largefile \
17-
ldconfig \
18-
nfs \
19-
pci \
20-
systemd \
21-
usbgadget \
22-
usbhost \
23-
tpm2 \
24-
usrmerge \
25-
"
26-
27-
# set content of boot partition
28-
IMAGE_EFI_BOOT_FILES = " \
29-
skl.bin \
30-
acm/*;acm/ \
31-
"
32-
33-
# adds initramfs image to handle label option from grub.cfg
34-
INITRAMFS_IMAGE = "core-image-initramfs-boot"
35-
INITRAMFS_IMAGE_BUNDLE = "1"
36-
37-
# wks related variables
38-
WKS_FILES = "trenchboot-image-efipluslegacy.wks"
39-
WKS_FILE_DEPENDS:append = " grub-native"
40-
41-
# explicitly use systemd and disable sysvinit completely
42-
VIRTUAL-RUNTIME_init_manager = "systemd"
43-
VIRTUAL-RUNTIME_initscripts = ""
44-
VIRTUAL-RUNTIME_syslog = ""
45-
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
46-
47-
# use TrenchBoot Linux and GRUB
48-
PREFERRED_PROVIDER_virtual/kernel = "linux-tb"
49-
PREFERRED_PROVIDER_bootloader/kernel = "grub"
50-
PREFERRED_VERSION_linux-tb ?= "6.6%"

conf/distro/tb-xen-distro.conf

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
require conf/distro/include/tb-distro-common.conf
2+
3+
DISTRO = "tb-xen-distro"
4+
DISTRO_FEATURES += "virtualization xen"
5+
6+
IMAGE_EFI_BOOT_FILES += " \
7+
xen-${MACHINE};xen \
8+
"
9+
10+
PREFERRED_VERSION_xen = "4.17+tb"
11+
# TODO: for some reason, building tools from TB fork does not build all of the
12+
# tools - many basic binaries are missing
13+
PREFERRED_VERSION_xen-tools = "4.17+stable"

kas-xen-tb.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
header:
3+
version: 8
4+
includes:
5+
- kas/common.yml
6+
7+
repos:
8+
meta-virtualization:
9+
url: https://git.yoctoproject.org/git/meta-virtualization
10+
refspec: 54b806b1985f3989722ee308e1073530fe3328c1
11+
12+
distro: tb-xen-distro
13+
machine: genericx86-64
14+
target:
15+
- tb-xen-image

kas/common.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99

1010
poky:
1111
url: https://github.com/zarhus/poky.git
12-
refspec: 8bd68e6bf77a2b90ac7332e545d6f9761e814878
12+
refspec: 0bb7dda99977a3366a0e2f55473dd516eec57346
1313
layers:
1414
meta:
1515
meta-poky:

recipes-bsp/grub/grub-tb-common.inc

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SRC_URI = " \
55
git://github.com/coreutils/gnulib;name=gnulib;branch=${BRANCH_gnulib};protocol=https;destsuffix=git/gnulib \
66
"
77

8-
BRANCH_grub = "intel-txt-aem-2.06-rebased"
8+
BRANCH_grub = "intel-txt-aem-2.06"
99
SRCREV_grub = "85ccfdc700a1640c148909cbbad777ba6d7d124b"
1010

1111
# We add gnulib to SRC_URI to avoid downloading it during the do_configure().
@@ -17,7 +17,7 @@ SRCREV_grub = "85ccfdc700a1640c148909cbbad777ba6d7d124b"
1717
# with the bootstrap.conf, otherwise it will be sync during do_configure()
1818
# again.
1919
BRANCH_gnulib = "master"
20-
SRCREV_gnulib = "9f48fb992a3d7e96610c4ce8be969cff2d61a01b"
20+
SRCREV_gnulib = "e87d09bee37eeb742b8a34c9054cd2ebde22b835"
2121

2222
SRCREV_FORMAT = "grub_gnulib"
2323

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
require tb-minimal-image.bb
2+
3+
# Based on xen-image-minimal from meta-virtualization
4+
5+
# Linux kernel option CONFIG_XEN_PCIDEV_BACKEND depends on X86
6+
XEN_PCIBACK_MODULE = ""
7+
XEN_PCIBACK_MODULE:x86 = "kernel-module-xen-pciback"
8+
XEN_PCIBACK_MODULE:x86-64 = "kernel-module-xen-pciback"
9+
XEN_ACPI_PROCESSOR_MODULE = ""
10+
XEN_ACPI_PROCESSOR_MODULE:x86 = "kernel-module-xen-acpi-processor"
11+
XEN_ACPI_PROCESSOR_MODULE:x86-64 = "kernel-module-xen-acpi-processor"
12+
13+
XEN_KERNEL_MODULES ?= " \
14+
kernel-module-xen-blkback kernel-module-xen-gntalloc kernel-module-tun \
15+
kernel-module-xen-gntdev kernel-module-xen-netback kernel-module-xen-wdt \
16+
${@bb.utils.contains('MACHINE_FEATURES', 'pci', "${XEN_PCIBACK_MODULE}", '', d)} \
17+
${@bb.utils.contains('MACHINE_FEATURES', 'acpi', '${XEN_ACPI_PROCESSOR_MODULE}', '', d)} \
18+
"
19+
20+
IMAGE_INSTALL:append = " \
21+
${XEN_KERNEL_MODULES} \
22+
xen-tools \
23+
qemu \
24+
kernel-image \
25+
kernel-vmlinux \
26+
"
27+
28+
do_check_xen_state() {
29+
if [ "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' yes', 'no', d)}" = "no" ]; then
30+
die "DISTRO_FEATURES does not contain 'xen'"
31+
fi
32+
}
33+
34+
addtask check_xen_state before do_rootfs

recipes-extended/xen/xen-tb.inc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
LIC_FILES_CHKSUM ?= "file://COPYING;md5=d1a1e216f80b6d8da95fec897d0dbec9"
2+
3+
PV = "${XEN_REL}+tb"
4+
5+
SRC_URI = "git://github.com/TrenchBoot/xen.git;branch=${XEN_BRANCH};protocol=https"
6+
7+
SRCREV = "0b53c6a5b796f3b1a146f612fd06fa37d1bf7714"
8+
9+
S = "${WORKDIR}/git"
10+
11+
XEN_REL = "4.17"
12+
XEN_BRANCH = "aem_intel_fixes_v0.4.1"

recipes-extended/xen/xen-tools_tb.bb

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# nooelint: oelint.var.mandatoryvar.HOMEPAGE,oelint.var.mandatoryvar.SUMMARY,oelint.var.mandatoryvar.LICENSE
2+
3+
require xen-tb.inc
4+
# nooelint: oelint.file.requirenotfound
5+
require recipes-extended/xen/xen.inc
6+
# nooelint: oelint.file.requirenotfound
7+
require recipes-extended/xen/xen-tools.inc

recipes-extended/xen/xen_tb.bb

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# nooelint: oelint.var.mandatoryvar.HOMEPAGE,oelint.var.mandatoryvar.SUMMARY,oelint.var.mandatoryvar.LICENSE
2+
3+
require xen-tb.inc
4+
# nooelint: oelint.file.requirenotfound
5+
require recipes-extended/xen/xen.inc
6+
# nooelint: oelint.file.requirenotfound
7+
require recipes-extended/xen/xen-hypervisor.inc

recipes-support/skl/skl_git.bb

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=4641e94ec96f98fabc56ff9cc48be14b"
77

88
DEPENDS = "util-linux-native"
99

10-
SRC_URI = "git://github.com/TrenchBoot/secure-kernel-loader.git;protocol=https;branch=${BRANCH};name=skl"
11-
BRANCH = "shrink_measured_size"
12-
SRCREV = "18f535843b22e784dbbc8e1ec11d8dc099b3d0fe"
10+
SRC_URI = "git://github.com/TrenchBoot/secure-kernel-loader.git;protocol=https;nobranch=1;tag=${TAG};name=skl"
11+
TAG = "v0.4.0"
1312

1413
TUNE_CCARGS:remove = "-msse3 -mfpmath=sse"
1514

wic/grub.cfg

+38-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
2+
set debug=linux,relocator,multiboot,multiboot_loader,slaunch
23
terminal_output console serial
34
terminal_input console serial
45
default=boot
56
timeout=5
67

7-
menuentry 'boot'{
8+
insmod multiboot2
9+
insmod slaunch
10+
11+
menuentry 'Boot Linux normally'{
12+
echo 'Loading Linux ...'
813
linux /bzImage-initramfs-genericx86-64.bin rootwait root=LABEL=root rootfstype=ext4 console=ttyS0,115200 earlyprintk=serial,ttyS0,115200
914
}
1015

11-
menuentry 'slaunch-boot'{
16+
menuentry 'Boot Linux with DRTM'{
17+
echo 'Enabling slaunch ...'
1218
slaunch
19+
echo 'Loading ACMs ...'
1320
slaunch_module /skl.bin
1421
slaunch_module /acm/ADL_SINIT_v1_18_16_20230427_REL_NT_O1.PW_signed.bin
1522
slaunch_module /acm/BDW_SINIT_20190708_1.3.2_PW.bin
@@ -21,5 +28,34 @@ menuentry 'slaunch-boot'{
2128
slaunch_module /acm/SKL_KBL_AML_SINIT_20211019_PRODUCTION_REL_NT_O1_1.10.0.bin
2229
slaunch_module /acm/SNB_IVB_SINIT_20190708_PW.bin
2330
slaunch_module /acm/TGL_SINIT_v1_14_46_20220819_REL_NT_O1.PW_signed.bin
31+
echo 'Loading Linux ...'
2432
linux /bzImage-initramfs-genericx86-64.bin rootwait root=LABEL=root rootfstype=ext4 console=ttyS0,115200 earlyprintk=serial,ttyS0,115200
2533
}
34+
35+
menuentry 'Boot Xen normally' {
36+
echo 'Loading Xen ...'
37+
multiboot2 /xen placeholder console=tty0 console=ttyS0,115200 dom0_mem=min:512M dom0_mem=max:4096M ucode=scan smt=off gnttab_max_frames=2048 gnttab_max_maptrack_frames=4096 loglvl=all guest_loglvl=all com1=115200,8n1 console=com1 no-real-mode edd=off
38+
echo 'Loading Linux ...'
39+
module2 /bzImage rootwait root=LABEL=root rootfstype=ext4 console=ttyS0,115200 earlyprintk=serial,ttyS0,115200
40+
}
41+
42+
menuentry 'Boot Xen with DRTM' {
43+
echo 'Enabling slaunch ...'
44+
slaunch
45+
echo 'Loading ACMs ...'
46+
slaunch_module /skl.bin
47+
slaunch_module /acm/ADL_SINIT_v1_18_16_20230427_REL_NT_O1.PW_signed.bin
48+
slaunch_module /acm/BDW_SINIT_20190708_1.3.2_PW.bin
49+
slaunch_module /acm/CFL_SINIT_20221220_PRODUCTION_REL_NT_O1_1.10.1_signed.bin
50+
slaunch_module /acm/CML_RKL_S_SINIT_v1.13.33_REL_NT_O1.PW_signed.bin
51+
slaunch_module /acm/CML_S_SINIT_1_13_33_REL_NT_O1.PW_signed.bin
52+
slaunch_module /acm/CMLSTGP_SINIT_v1_14_46_20220819_REL_NT_O1.PW_signed.bin
53+
slaunch_module /acm/RKLS_SINIT_v1_14_46_20220819_REL_NT_O1.PW_signed.bin
54+
slaunch_module /acm/SKL_KBL_AML_SINIT_20211019_PRODUCTION_REL_NT_O1_1.10.0.bin
55+
slaunch_module /acm/SNB_IVB_SINIT_20190708_PW.bin
56+
slaunch_module /acm/TGL_SINIT_v1_14_46_20220819_REL_NT_O1.PW_signed.bin
57+
echo 'Loading Xen ...'
58+
multiboot2 /xen placeholder console=tty0 console=ttyS0,115200 dom0_mem=min:512M dom0_mem=max:4096M ucode=scan smt=off gnttab_max_frames=2048 gnttab_max_maptrack_frames=4096 loglvl=all guest_loglvl=all com1=115200,8n1 console=com1 no-real-mode edd=off
59+
echo 'Loading Linux ...'
60+
module2 /bzImage rootwait root=LABEL=root rootfstype=ext4 console=ttyS0,115200 earlyprintk=serial,ttyS0,115200
61+
}

0 commit comments

Comments
 (0)