-
Notifications
You must be signed in to change notification settings - Fork 6
build: add images Makefile, update gitignore #243
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
Open
amd-aliem
wants to merge
2
commits into
AMDEPYC:main
Choose a base branch
from
amd-aliem:dev-image-build
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.
+88
−0
Open
Changes from all commits
Commits
Show all changes
2 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 hidden or 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
This file contains hidden or 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,25 @@ | ||
| IMAGES := $(sort $(notdir $(wildcard host-* guest-*))) | ||
| CLEAN_IMAGES := $(addprefix clean-,$(IMAGES)) | ||
|
|
||
| .PHONY: all clean list status $(IMAGES) $(CLEAN_IMAGES) | ||
|
|
||
| all: $(IMAGES) | ||
|
|
||
| clean: $(CLEAN_IMAGES) | ||
|
|
||
| list: | ||
| @echo $(IMAGES) | ||
|
|
||
| status: | ||
| @for img in $(IMAGES); do \ | ||
| if [ -e $$img/$$img ]; then \ | ||
| echo "$$img:"; \ | ||
| ls $$img/$$img $$img/$$img.* 2>/dev/null | sed 's/^/\t/'; \ | ||
| fi; \ | ||
| done | ||
|
|
||
| $(IMAGES): | ||
| mkosi --image-id=$@ -C $@ build | ||
|
|
||
| $(CLEAN_IMAGES): | ||
| mkosi --image-id=$(patsubst clean-%,%,$@) -C $(patsubst clean-%,%,$@) clean | ||
This file contains hidden or 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,55 @@ | ||
| # Images | ||
|
|
||
| mkosi image definitions for SEV-SNP host and guest environments. Each subdirectory contains a `mkosi.conf` for one image. | ||
|
|
||
| ## Build | ||
|
|
||
| ```bash | ||
| make list # show available images | ||
| make host-fedora-41 # build a specific image | ||
| make all # build every image | ||
| make clean-host-fedora-41 # clean a specific image | ||
| make clean # clean every image | ||
| make status # show built images and their artifacts | ||
|
amd-aliem marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| ## Naming | ||
|
|
||
| ``` | ||
| {role}-{distro}-{release} | ||
| ``` | ||
|
|
||
| - **role**: `host` (bare-metal SEV hypervisor) or `guest` (SEV guest UKI/EFI) | ||
| - **distro**: `fedora`, `ubuntu`, `centos`, `debian`, `rocky` | ||
| - **release**: distro version number or codename | ||
|
|
||
| ## Ubuntu: AppArmor + mkosi | ||
|
|
||
| Ubuntu restricts unprivileged user namespaces via AppArmor, which breaks mkosi. See [systemd/mkosi#3265](https://github.com/systemd/mkosi/issues/3265). | ||
|
|
||
| **Quick fix** -- disable the restriction system-wide: | ||
|
|
||
| > **Warning:** This disables AppArmor's unprivileged user namespace restrictions for *all* processes, not just mkosi. On multi-user or production systems, prefer the per-binary fix below. | ||
|
|
||
| ```bash | ||
| sudo sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=0 | ||
| sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 | ||
| ``` | ||
|
amd-aliem marked this conversation as resolved.
|
||
|
|
||
| **Per-binary fix:** Create `/etc/apparmor.d/mkosi` (adjust path if needed): | ||
|
|
||
| ``` | ||
| abi <abi/4.0>, | ||
| include <tunables/global> | ||
|
|
||
| profile mkosi /usr/bin/mkosi flags=(unconfined) { | ||
| userns, | ||
| include if exists <local/mkosi> | ||
| } | ||
| ``` | ||
|
|
||
| Then reload: | ||
|
|
||
| ```bash | ||
| sudo systemctl reload apparmor | ||
| ``` | ||
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.
Uh oh!
There was an error while loading. Please reload this page.