We need to modify our chroot a little bit; right now, it's just a husk of an OS, and isn't bootable.

Any path listed in this section is relative to the root of the chroot.

First of all, we gotta install some things on the chroot, the first of which is the linux kernel itself:

[root@chroot ~] # pacman -Sy linux

Next, we need to modify our mkinitcpio configuration to build an appropriate ramdisk. Depending on your configuration, this will differ wildly from my own, but below is what I ended up with after many trials:

# /etc/mkinitcpio.conf


# Pay very close attention to this; these determine what modules and scripts are loaded into ramdisk and the order
# in which they are run. If you use LUKS over LVM, this will work for you. Otherwise, you *need* to change this to fit
# your configurations.
HOOKS=(base udev autodetect systemd keyboard sd-vconsole modconf block sd-encrypt sd-lvm2 filesystems fsck)

We also need to change the presets files to represent our created image. You should modify this for your target OS, but I suggest prefixing the name of the OS with 0 so that the host OS doesn't default to it when we make our GRUB entry later.

# /etc/mkinitcpio.conf.d/linux.preset


PRESETS=('default' 'fallback')


fallback_options="-S autodetect"
# /etc/mkinitcpio.conf.d/linux-lts.preset


PRESETS=('default' 'fallback')


fallback_options="-S autodetect"

If you need to use sd-vconsole, you will need to create an /etc/vconsole.conf with a KEYMAP entry.

If you need to use sd-encrypt, you should copy /etc/crypttab from the host OS's root to /etc/crypttab in the chroot.

You absolutely should copy /etc/fstab from the host OS's root to /etc/fstab in the chroot. I suggest replacing all the relevant paths in there with UUIDs using the output of blkid.

Generating initramfs

If you left the chroot to perform any of the previous steps, go ahead and re-enter it. Then execute:

[root@chroot ~] # mkinitcpio -p linux -k <kernel>

Where you replace with the latest kernel version listed in /lib/modules. At the time of writing, my version was 4.20.7-arch1-1-ARCH. Note that you must do this or the mkinitcpio command will attempt to use the kernel version of the host OS.

Next steps

Now we need to write the GRUB configuration and the init script. Not too much left.