Create a Slackware kernel (initrd) for Hyper-V

Posted by in Lagom

If you are installing Slackware, after setup is done and before reboot, first chroot into the root partition:
# mount -t ext4 /dev/sda1 /mnt
# mount -o bind /proc /mnt/proc
# mount -o bind /dev /mnt/dev
# mount -o bind /sys /mnt/sys
# chroot /mnt

# mkinitrd -c -f ext4 -r /dev/sda1 -m hv_vmbus:hv_storvsc:mbcache:jbd2:ext4 -u -o /boot/initrd.gz -k

-r = boot partition
-k = kernel version

edit /etc/lilo.conf (or grub, elilo.conf etc) to match new initrd and generic kernel:

# nano -w /etc/lilo.conf

image = /boot/
append = "elevator=noop"
initrd = /boot/initrd.gz
root = /dev/sda1
label = hyperv

# lilo