Skip to content

Commit

Permalink
kernel: fix script #3
Browse files Browse the repository at this point in the history
  • Loading branch information
eldios committed Feb 3, 2025
1 parent ec73caa commit c2a91d7
Showing 1 changed file with 46 additions and 32 deletions.
78 changes: 46 additions & 32 deletions .scripts/linux/kernel_build.sh
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."

0 comments on commit c2a91d7

Please sign in to comment.