set -e
cores=$(nproc)
echo "${cores}"
/usr/bin/make clean
/usr/bin/make defconfig
sed -i 's/CONFIG_SYSTEM_TRUSTED_KEYS="\.\*"/CONFIG_SYSTEM_TRUSTED_KEYS=""/' ./.config
sed -i 's/CONFIG_SYSTEM_REVOCATION_KEYS="\.\*"/CONFIG_SYSTEM_REVOCATION_KEYS=""/' ./.config
sed -i 's/CONFIG_EFI_STUB="\.\*"/CONFIG_EFI_STUB="y"/' ./.config
echo "CONFIG_FB_EFI=y" >> ./.config
echo "CONFIG_EFI=y" >> ./.config
echo "CONFIG_SYSFB=y" >> ./.config
echo "CONFIG_FB=y" >> ./.config
echo "CONFIG_VIRTIO=y" >> ./.config
echo "CONFIG_FRAMEBUFFER_CONSOLE=y" >> ./.config
echo "CONFIG_DRM_VIRTIO_GPU=y" >> ./.config
echo "CONFIG_VIRTIO_PCI=y" >> ./.config
echo "CONFIG_VIRTIO_BLK=y" >> ./.config
echo "CONFIG_SCSI_VIRTIO=y" >> ./.config
echo "CONFIG_VIRTIO_NET=y" >> ./.config
echo "CONFIG_VIRTIO_CONSOLE=y" >> ./.config
echo "CONFIG_VIRTIO_PCI_LIB=y" >> ./.config
echo "CONFIG_VIRTIO_PCI_LIB_LEGACY=y" >> ./.config
echo "CONFIG_VIRTIO_MENU=y" >> ./.config
echo "CONFIG_VIRTIO_BALLOON=y" >> ./.config
echo "CONFIG_VIRTIO_MEM=y" >> ./.config
echo "CONFIG_VIRTIO_MMIO=y" >> ./.config
echo "CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y" >> ./.config
echo "CONFIG_VIRTIO_IOMMU=y" >> ./.config
echo "CONFIG_VIRTIO_FS=y" >> ./.config
echo "CONFIG_PCI=y" >> ./.config
echo "CONFIG_PCI_HOST_GENERIC=y" >> ./.config
echo "CONFIG_DRM=y" >> ./.config
/usr/bin/make olddefconfig
/usr/bin/make -j ${cores}
