-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: merge the yocto scripts into yocto manifest #17
Open
MoeMahhouk
wants to merge
4
commits into
main
Choose a base branch
from
merge-scripts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.PHONY: build gen-measurements | ||
|
||
build: | ||
cd srcs/poky/ && bitbake cvm-image-azure | ||
|
||
gen-measurements: | ||
mkdir -p measurements | ||
CURRENT_DIR=$(shell pwd) && \ | ||
IMAGE_DIR=$$CURRENT_DIR/srcs/poky/build/tmp/deploy/images/tdx && \ | ||
cd srcs/poky/meta-confidential-compute/scripts/measured-boot && \ | ||
for script in precalculate_pcr*; do \ | ||
output_file="$$CURRENT_DIR/measurements/$$(basename $$script .sh | sed 's/precalculate_//')_output.json"; \ | ||
./$$script $$IMAGE_DIR/cvm-image-azure-tdx.rootfs.wic.vhd $$output_file >/dev/null; \ | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# TDX Base Profile | ||
|
||
This is the minimal TEE-enabled profile that serves as a foundation for other specialized images. It provides basic AMD SEV-SNP/TDX support with essential security features. | ||
|
||
## Features | ||
- Basic AMD SEV-SNP/TDX support | ||
- TPM2 integration | ||
- Minimal system footprint | ||
|
||
## Included Layers | ||
- meta-confidential-compute: Core confidential computing support | ||
- meta-openembedded: Basic system utilities and libraries | ||
- poky: Base Yocto distribution | ||
|
||
## Build Configuration | ||
- Image Type: `cvm-image-azure` | ||
- Package Format: IPK | ||
- Supported Machine: tdx | ||
- Distribution: cvm | ||
|
||
## Environment Variables | ||
The following environment variables can be set to customize the build: | ||
- `DEBUG_TWEAKS_ENABLED`: Enable debug features (default: 1) | ||
- `DISK_ENCRYPTION_KEY_STORAGE`: Configure disk encryption key storage location (optional) | ||
|
||
## Usage | ||
```bash | ||
make image-base | ||
``` | ||
|
||
For measurement generation: | ||
```bash | ||
make measurements-base | ||
``` | ||
|
||
Build artifacts will be available in `reproducible-build/artifacts-base/`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- conf/local.conf 2024-06-03 15:49:59.294281280 +0000 | ||
+++ /home/ubuntu/poky/build/conf/local.conf 2024-06-03 10:16:24.809382127 +0000 | ||
@@ -36,7 +36,7 @@ | ||
#MACHINE ?= "genericx86-64" | ||
# | ||
# This sets the default machine to be qemux86-64 if no other machine is selected: | ||
-MACHINE ??= "qemux86-64" | ||
+#MACHINE ??= "qemux86-64" | ||
|
||
# These are some of the more commonly used values. Looking at the files in the | ||
# meta/conf/machine directory, or the conf/machine directory of any additional layers | ||
@@ -91,7 +91,7 @@ | ||
# Ultimately when creating custom policy, people will likely end up subclassing | ||
# these defaults. | ||
# | ||
-DISTRO ?= "poky" | ||
+#DISTRO ?= "poky" | ||
# As an example of a subclass there is a "bleeding" edge policy configuration | ||
# where many versions are set to the absolute latest code from the upstream | ||
# source control systems. This is just mentioned here as an example, its not | ||
@@ -110,7 +110,7 @@ | ||
# - 'package_rpm' for rpm style packages | ||
# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" | ||
# OE-Core defaults to ipkg, whilst Poky defaults to rpm: | ||
-# PACKAGE_CLASSES ?= "package_rpm" | ||
+PACKAGE_CLASSES ?= "package_ipk" | ||
|
||
# | ||
# SDK target architecture | ||
@@ -238,8 +238,8 @@ | ||
# (CDN) kindly provided by JSDelivr, uncomment one of the SSTATE_MIRRORS lines, not both. | ||
# Using the CDN rather than the yoctoproject.org address is suggested/preferred. | ||
# | ||
-#BB_HASHSERVE_UPSTREAM = 'wss://hashserv.yoctoproject.org/ws' | ||
-#SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH" | ||
+BB_HASHSERVE_UPSTREAM = 'wss://hashserv.yoctoproject.org/ws' | ||
+SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH" | ||
# | ||
###SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH" | ||
|
||
@@ -249,7 +249,7 @@ | ||
# | ||
# By default native qemu will build with a builtin VNC server where graphical output can be | ||
# seen. The line below enables the SDL UI frontend too. | ||
-PACKAGECONFIG:append:pn-qemu-system-native = " sdl" | ||
+# PACKAGECONFIG:append:pn-qemu-system-native = " sdl" | ||
# By default libsdl2-native will be built, if you want to use your host's libSDL instead of | ||
# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. | ||
#ASSUME_PROVIDED += "libsdl2-native" | ||
@@ -269,8 +269,8 @@ | ||
# | ||
# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format | ||
# | ||
-#BB_HASHSERVE = "auto" | ||
-#BB_SIGNATURE_HANDLER = "OEEquivHash" | ||
+BB_HASHSERVE = "auto" | ||
+BB_SIGNATURE_HANDLER = "OEEquivHash" | ||
|
||
# | ||
# Memory Resident Bitbake | ||
@@ -286,3 +286,9 @@ | ||
# track the version of this file when it was generated. This can safely be ignored if | ||
# this doesn't mean anything to you. | ||
CONF_VERSION = "2" | ||
+MACHINE_FEATURES_NATIVE:append = " efi" | ||
+MACHINE_FEATURES:append = " efi" | ||
+EXTRA_IMAGEDEPENDS += "ovmf" | ||
+ | ||
+MACHINE ?= "tdx" | ||
+DISTRO ?= "cvm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
# Check if the first argument is -v or --verbose | ||
verbose=0 | ||
if [[ $1 == "-v" ]] || [[ $1 == "--verbose" ]]; then | ||
verbose=1 | ||
# Shift the positional parameters to the left, effectively removing the first argument | ||
shift | ||
fi | ||
|
||
# Define a function for verbose output | ||
function verbose_output { | ||
if [[ $verbose -eq 1 ]]; then | ||
echo "$1" | ||
fi | ||
} | ||
|
||
# Set CURRENT_PATH to the current working directory | ||
CURRENT_PATH=$(pwd) | ||
verbose_output "Set CURRENT_PATH to $CURRENT_PATH" | ||
|
||
# Switch to the oe-init-build-env directory | ||
pushd $CURRENT_PATH/srcs/poky/ | ||
verbose_output "Switched to $(pwd)" | ||
|
||
# Source the oe-init-build-env script | ||
source oe-init-build-env | ||
verbose_output "Sourced the oe-init-build-env script" | ||
|
||
# Add the meta-evm, meta-confidential-compute, meta-secure-core/meta-tpm2, meta-openembedded/meta-python, meta-openembedded/meta-oe layers meta-rust-bin meta-clang to bblayers.conf | ||
bitbake-layers add-layer ../meta-confidential-compute | ||
|
||
verbose_output "Added the meta-evm and meta-confidential-compute layers to bblayers.conf" | ||
|
||
# Return to the original directory | ||
popd | ||
verbose_output "Returned to $(pwd)" | ||
|
||
# Apply patches | ||
for patch in $CURRENT_PATH/srcs/yocto-manifests/config_files/tdx-base/patches/patch-*; do | ||
# Extract the filename from the patch file and remove the "patch-" prefix | ||
filename=$(basename $patch | sed 's/^patch-//') | ||
verbose_output "Processing patch file $patch" | ||
|
||
# Apply the patch to the corresponding file in srcs/poky/build/conf/ | ||
patch -N $CURRENT_PATH/srcs/poky/build/conf/$filename -i $patch | ||
verbose_output "Applied patch to $CURRENT_PATH/srcs/poky/build/conf/$filename" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# TDX BOB (Builder/Searcher) Profile | ||
|
||
This profile creates a specialized image for running searcher nodes in confidential compute environments. It includes podman support and searcher-specific configurations. | ||
|
||
## Features | ||
- AMD SEV-SNP/TDX support | ||
- Secure container runtime isolation via podman | ||
- SSH key-based authentication | ||
- TPM2 measurements and attestation | ||
|
||
## Included Layers | ||
- meta-confidential-compute: Core confidential computing support | ||
- meta-openembedded: System utilities and libraries | ||
- meta-secure-core: Security features | ||
- meta-virtualization: Container support | ||
- meta-custom-podman: Customized podman configuration | ||
- meta-searcher: Searcher-specific features | ||
- poky: Base Yocto distribution | ||
|
||
## Build Configuration | ||
- Image Type: `cvm-image-azure` | ||
- Package Format: IPK | ||
- Supported Machine: tdx | ||
- Distribution: cvm | ||
|
||
## Required Configuration | ||
Before building, you must set the following in env_files/bob_yocto_build_config.env: | ||
- `SEARCHER_SSH_KEY`: SSH public key for searcher access (required) | ||
|
||
## Usage | ||
```bash | ||
# First set SEARCHER_SSH_KEY in env_files/bob_yocto_build_config.env | ||
make image-bob | ||
``` | ||
|
||
For measurement generation: | ||
```bash | ||
make measurements-bob | ||
``` | ||
|
||
Build artifacts will be available in `reproducible-build/artifacts-bob/`. | ||
|
||
## Notes | ||
- Ensure SSH key is properly configured before building | ||
- The image is optimized for searcher workloads | ||
- Includes container management capabilities |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- conf/local.conf 2024-06-03 15:49:59.294281280 +0000 | ||
+++ /home/ubuntu/poky/build/conf/local.conf 2024-06-03 10:16:24.809382127 +0000 | ||
@@ -36,7 +36,7 @@ | ||
#MACHINE ?= "genericx86-64" | ||
# | ||
# This sets the default machine to be qemux86-64 if no other machine is selected: | ||
-MACHINE ??= "qemux86-64" | ||
+#MACHINE ??= "qemux86-64" | ||
|
||
# These are some of the more commonly used values. Looking at the files in the | ||
# meta/conf/machine directory, or the conf/machine directory of any additional layers | ||
@@ -91,7 +91,7 @@ | ||
# Ultimately when creating custom policy, people will likely end up subclassing | ||
# these defaults. | ||
# | ||
-DISTRO ?= "poky" | ||
+#DISTRO ?= "poky" | ||
# As an example of a subclass there is a "bleeding" edge policy configuration | ||
# where many versions are set to the absolute latest code from the upstream | ||
# source control systems. This is just mentioned here as an example, its not | ||
@@ -110,7 +110,7 @@ | ||
# - 'package_rpm' for rpm style packages | ||
# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" | ||
# OE-Core defaults to ipkg, whilst Poky defaults to rpm: | ||
-# PACKAGE_CLASSES ?= "package_rpm" | ||
+PACKAGE_CLASSES ?= "package_ipk" | ||
|
||
# | ||
# SDK target architecture | ||
@@ -238,8 +238,8 @@ | ||
# (CDN) kindly provided by JSDelivr, uncomment one of the SSTATE_MIRRORS lines, not both. | ||
# Using the CDN rather than the yoctoproject.org address is suggested/preferred. | ||
# | ||
-#BB_HASHSERVE_UPSTREAM = 'wss://hashserv.yoctoproject.org/ws' | ||
-#SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH" | ||
+BB_HASHSERVE_UPSTREAM = 'wss://hashserv.yoctoproject.org/ws' | ||
+SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH" | ||
# | ||
###SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH" | ||
|
||
@@ -249,7 +249,7 @@ | ||
# | ||
# By default native qemu will build with a builtin VNC server where graphical output can be | ||
# seen. The line below enables the SDL UI frontend too. | ||
-PACKAGECONFIG:append:pn-qemu-system-native = " sdl" | ||
+# PACKAGECONFIG:append:pn-qemu-system-native = " sdl" | ||
# By default libsdl2-native will be built, if you want to use your host's libSDL instead of | ||
# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. | ||
#ASSUME_PROVIDED += "libsdl2-native" | ||
@@ -269,8 +269,8 @@ | ||
# | ||
# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format | ||
# | ||
-#BB_HASHSERVE = "auto" | ||
-#BB_SIGNATURE_HANDLER = "OEEquivHash" | ||
+BB_HASHSERVE = "auto" | ||
+BB_SIGNATURE_HANDLER = "OEEquivHash" | ||
|
||
# | ||
# Memory Resident Bitbake | ||
@@ -286,3 +286,9 @@ | ||
# track the version of this file when it was generated. This can safely be ignored if | ||
# this doesn't mean anything to you. | ||
CONF_VERSION = "2" | ||
+MACHINE_FEATURES_NATIVE:append = " efi" | ||
+MACHINE_FEATURES:append = " efi" | ||
+EXTRA_IMAGEDEPENDS += "ovmf" | ||
+ | ||
+MACHINE ?= "tdx" | ||
+DISTRO ?= "cvm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
|
||
# Check if the first argument is -v or --verbose | ||
verbose=0 | ||
if [[ $1 == "-v" ]] || [[ $1 == "--verbose" ]]; then | ||
verbose=1 | ||
# Shift the positional parameters to the left, effectively removing the first argument | ||
shift | ||
fi | ||
|
||
# Define a function for verbose output | ||
function verbose_output { | ||
if [[ $verbose -eq 1 ]]; then | ||
echo "$1" | ||
fi | ||
} | ||
|
||
# Set CURRENT_PATH to the current working directory | ||
CURRENT_PATH=$(pwd) | ||
verbose_output "Set CURRENT_PATH to $CURRENT_PATH" | ||
|
||
# Switch to the oe-init-build-env directory | ||
pushd $CURRENT_PATH/srcs/poky/ | ||
verbose_output "Switched to $(pwd)" | ||
|
||
# Source the oe-init-build-env script | ||
source oe-init-build-env | ||
verbose_output "Sourced the oe-init-build-env script" | ||
|
||
# Add the necessary layers to bblayers.conf | ||
bitbake-layers add-layer ../meta-confidential-compute | ||
bitbake-layers add-layer ../meta-openembedded/meta-oe | ||
bitbake-layers add-layer ../meta-openembedded/meta-python | ||
bitbake-layers add-layer ../meta-secure-core/meta-tpm2 | ||
bitbake-layers add-layer ../meta-openembedded/meta-networking | ||
bitbake-layers add-layer ../meta-openembedded/meta-filesystems | ||
bitbake-layers add-layer ../meta-virtualization | ||
bitbake-layers add-layer ../meta-custom-podman | ||
bitbake-layers add-layer ../meta-searcher | ||
|
||
verbose_output "Added the meta-evm and meta-confidential-compute layers to bblayers.conf" | ||
|
||
# Return to the original directory | ||
popd | ||
verbose_output "Returned to $(pwd)" | ||
|
||
# Apply patches | ||
for patch in $CURRENT_PATH/srcs/yocto-manifests/config_files/tdx-bob/patches/patch-*; do | ||
# Extract the filename from the patch file and remove the "patch-" prefix | ||
filename=$(basename $patch | sed 's/^patch-//') | ||
verbose_output "Processing patch file $patch" | ||
|
||
# Apply the patch to the corresponding file in srcs/poky/build/conf/ | ||
patch -N $CURRENT_PATH/srcs/poky/build/conf/$filename -i $patch | ||
verbose_output "Applied patch to $CURRENT_PATH/srcs/poky/build/conf/$filename" | ||
done |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to have this in
config_files
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had it first for each of the products separately. But I noticed that they all have the same Makefile as a common and use it. So I put it outside instead.
I can create a directory called common and put it in there instead. 🤔