-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
32 deletions.
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 |
---|---|---|
@@ -1,43 +1,57 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
set -eux | ||
TMPDIR="$(mktemp)" | ||
|
||
echo "cloning AMD SNP kernel in tmp directory ${TMPDIR}" | ||
cd "${TMPDIR}" && | ||
git clone \ | ||
https://github.com/confidential-containers/linux \ | ||
--single-branch \ | ||
-b amd-snp-host-202402240000 && | ||
cd linux | ||
( | ||
cd "${TMPDIR}" && | ||
git clone \ | ||
https://github.com/confidential-containers/linux \ | ||
--single-branch \ | ||
-b amd-snp-host-202402240000 && | ||
cd linux | ||
) >/dev/null 2>&1 | ||
|
||
VER="-snp-host" | ||
DATE="$(date +%Y-%m-%d-%H-%M)" | ||
|
||
echo "building and installing kernel... this will take while" && | ||
echo "Copying current config to new kernel" && | ||
cp /boot/config-$(uname -r) .config && | ||
echo "Patching new kernel" && | ||
echo "building and installing kernel... this will take while" | ||
echo "Copying current config to new kernel" | ||
( | ||
cp /boot/config-$(uname -r) .config | ||
) >/dev/null 2>&1 | ||
|
||
echo "Patching new kernel" | ||
( | ||
./scripts/config --set-str LOCALVERSION "$VER-$DATE" && | ||
./scripts/config --disable LOCALVERSION_AUTO && | ||
./scripts/config --enable DEBUG_INFO && | ||
./scripts/config --enable DEBUG_INFO_REDUCED && | ||
./scripts/config --enable EXPERT && | ||
./scripts/config --enable AMD_MEM_ENCRYPT && | ||
./scripts/config --disable AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT && | ||
./scripts/config --enable KVM_AMD_SEV && | ||
./scripts/config --module CRYPTO_DEV_CCP_DD && | ||
./scripts/config --disable SYSTEM_TRUSTED_KEYS && | ||
./scripts/config --disable SYSTEM_REVOCATION_KEYS && | ||
./scripts/config --module SEV_GUEST && | ||
./scripts/config --disable IOMMU_DEFAULT_PASSTHROUGH && | ||
echo "Building new kernel" && | ||
./scripts/config --disable LOCALVERSION_AUTO && | ||
./scripts/config --enable DEBUG_INFO && | ||
./scripts/config --enable DEBUG_INFO_REDUCED && | ||
./scripts/config --enable EXPERT && | ||
./scripts/config --enable AMD_MEM_ENCRYPT && | ||
./scripts/config --disable AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT && | ||
./scripts/config --enable KVM_AMD_SEV && | ||
./scripts/config --module CRYPTO_DEV_CCP_DD && | ||
./scripts/config --disable SYSTEM_TRUSTED_KEYS && | ||
./scripts/config --disable SYSTEM_REVOCATION_KEYS && | ||
./scripts/config --module SEV_GUEST && | ||
./scripts/config --disable IOMMU_DEFAULT_PASSTHROUGH | ||
) >/dev/null 2>&1 | ||
|
||
echo "Building new kernel" | ||
( | ||
yes "" | make olddefconfig && | ||
make -j$(nproc) LOCAL_VERSION="$VER-$DATE" && | ||
make -j$(nproc) modules_install && | ||
make -j$(nproc) install && | ||
echo "Kernel Built, configuring and updating GRUB" && | ||
make -j$(nproc) LOCAL_VERSION="$VER-$DATE" && | ||
make -j$(nproc) modules_install && | ||
make -j$(nproc) install | ||
) >/dev/null 2>&1 | ||
|
||
echo "Kernel Built, configuring and updating GRUB" | ||
( | ||
sed -i 's/iommu=pt/iommu=nopt/g' /etc/default/grub && | ||
update-grub && | ||
rm -rf "${TMPDIR}" && | ||
echo "cleaning kernel tmp directory ${TMPDIR}" && | ||
echo "Work completed. You should now reboot." | ||
update-grub && | ||
rm -rf "${TMPDIR}" | ||
) >/dev/null 2>&1 | ||
|
||
echo "cleaning kernel tmp directory ${TMPDIR}" | ||
echo "Work completed. You should now reboot." |