From 153a34222b7ac0a14fd30443b8ebeb7e300028c0 Mon Sep 17 00:00:00 2001 From: Fabian Arrotin Date: Apr 16 2020 09:44:48 +0000 Subject: Added fix for xen drivers in dracut image to have ec2 image booting Signed-off-by: Fabian Arrotin --- diff --git a/CentOS-8-EC2.ks b/CentOS-8-EC2.ks index 04df900..361a032 100644 --- a/CentOS-8-EC2.ks +++ b/CentOS-8-EC2.ks @@ -3,7 +3,6 @@ auth --enableshadow --passalgo=sha512 shutdown firewall --enabled --service=ssh firstboot --disable -ignoredisk --only-use=vda keyboard us # System language lang en_US.UTF-8 @@ -20,7 +19,12 @@ bootloader --append="console=ttyS0,115200n8 no_timer_check crashkernel=auto net. zerombr clearpart --all --initlabel reqpart -part / --fstype="xfs" --ondisk=vda --size=8000 +part biosboot --fstype=biosboot --size=1 --ondisk vda +part / --fstype="xfs" --ondisk=vda --size=7999 + +%pre --erroronfail +/usr/sbin/parted -s /dev/vda mklabel gpt +%end %post --erroronfail passwd -d root @@ -135,6 +139,22 @@ touch /var/log/boot.log mkdir -p /var/cache/yum /usr/sbin/fixfiles -R -a restore +# remove these for ec2 debugging +sed -i -e 's/ rhgb quiet//' /boot/grub/grub.conf + +cat > /etc/modprobe.d/blacklist-nouveau.conf << EOL +blacklist nouveau +EOL + +# enable resizing on copied AMIs +echo 'install_items+=" sgdisk "' > /etc/dracut.conf.d/sgdisk.conf + +echo 'add_drivers+="xen-netfront xen-blkfront "' > /etc/dracut.conf.d/xen.conf +# Rerun dracut for the installed kernel (not the running kernel): +KERNEL_VERSION=$(rpm -q kernel --qf '%{V}-%{R}.%{arch}\n') +dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION + + # reorder console entries sed -i 's/console=tty0/console=tty0 console=ttyS0,115200n8/' /boot/grub2/grub.cfg diff --git a/CentOS-8-Stream-EC2.ks b/CentOS-8-Stream-EC2.ks index 8cd0d58..fdaa47e 100644 --- a/CentOS-8-Stream-EC2.ks +++ b/CentOS-8-Stream-EC2.ks @@ -3,7 +3,6 @@ auth --enableshadow --passalgo=sha512 shutdown firewall --enabled --service=ssh firstboot --disable -ignoredisk --only-use=vda keyboard us # System language lang en_US.UTF-8 @@ -20,7 +19,12 @@ bootloader --append="console=ttyS0,115200n8 no_timer_check crashkernel=auto net. zerombr clearpart --all --initlabel reqpart -part / --fstype="xfs" --ondisk=vda --size=8000 +part biosboot --fstype=biosboot --size=1 --ondisk vda +part / --fstype="xfs" --ondisk=vda --size=7999 + +%pre --erroronfail +/usr/sbin/parted -s /dev/vda mklabel gpt +%end %post --erroronfail passwd -d root @@ -135,6 +139,21 @@ touch /var/log/boot.log mkdir -p /var/cache/yum /usr/sbin/fixfiles -R -a restore +# remove these for ec2 debugging +sed -i -e 's/ rhgb quiet//' /boot/grub/grub.conf + +cat > /etc/modprobe.d/blacklist-nouveau.conf << EOL +blacklist nouveau +EOL + +# enable resizing on copied AMIs +echo 'install_items+=" sgdisk "' > /etc/dracut.conf.d/sgdisk.conf + +echo 'add_drivers+="xen-netfront xen-blkfront "' > /etc/dracut.conf.d/xen.conf +# Rerun dracut for the installed kernel (not the running kernel): +KERNEL_VERSION=$(rpm -q kernel --qf '%{V}-%{R}.%{arch}\n') +dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION + # reorder console entries sed -i 's/console=tty0/console=tty0 console=ttyS0,115200n8/' /boot/grub2/grub.cfg