init: factorize grub1 and grub2 code. Allow cloud-init to work in kexec mode