See man dracut
It has examples:
dracut foobar.img 2.6.40-1.rc5.f20
dracut --kver 2.6.40-1.rc5.f20
There is also the note:
If
<image>
is omitted or empty, depending on bootloader specification, the default location can be/efi/<machine-id>/<kernel-version>/initrd
,/boot/<machine-id>/<kernel-version>/initrd
,/boot/efi/<machine-id>/<kernel-version>/initrd
,/lib/modules/<kernel-version>/initrd
or/boot/initramfs-<kernel-version>.img
.
The /usr/bin/dracut
is a Bash script and seems to have something like:
if [[ -d "$dracutsysrootdir"/efi/loader/entries || -L "$dracutsysrootdir"/efi/loader/entries ]] \
&& [[ $MACHINE_ID ]] \
&& [[ -d "$dracutsysrootdir"/efi/${MACHINE_ID} || -L "$dracutsysrootdir"/efi/${MACHINE_ID} ]]; then
# 1
outfile="$dracutsysrootdir/efi/${MACHINE_ID}/${kernel}/initrd"
elif [[ -d "$dracutsysrootdir"/boot/loader/entries || -L "$dracutsysrootdir"/boot/loader/entries ]] \
&& [[ $MACHINE_ID ]] \
&& [[ -d "$dracutsysrootdir"/boot/${MACHINE_ID} || -L "$dracutsysrootdir"/boot/${MACHINE_ID} ]]; then
# 2
outfile="$dracutsysrootdir/boot/${MACHINE_ID}/${kernel}/initrd"
elif [[ -d "$dracutsysrootdir"/boot/efi/loader/entries || -L "$dracutsysrootdir"/boot/efi/loader/entries ]] \
&& [[ $MACHINE_ID ]] \
&& [[ -d "$dracutsysrootdir"/boot/efi/${MACHINE_ID} || -L "$dracutsysrootdir"/boot/efi/${MACHINE_ID} ]]; then
# 3
outfile="$dracutsysrootdir/boot/efi/${MACHINE_ID}/${kernel}/initrd"
elif [[ -f "$dracutsysrootdir"/lib/modules/${kernel}/initrd ]]; then
# 4
outfile="$dracutsysrootdir/lib/modules/${kernel}/initrd"
elif [[ -e $dracutsysrootdir/boot/vmlinuz-${kernel} ]]; then
# 5
outfile="$dracutsysrootdir/boot/initramfs-${kernel}.img"
elif [[ -z $dracutsysrootdir ]] \
&& [[ $MACHINE_ID ]] \
&& mountpoint -q /efi; then
# 6
outfile="/efi/${MACHINE_ID}/${kernel}/initrd"
elif [[ -z $dracutsysrootdir ]] \
&& [[ $MACHINE_ID ]] \
&& mountpoint -q /boot/efi; then
# 7
outfile="/boot/efi/${MACHINE_ID}/${kernel}/initrd"
else
# 8
outfile="$dracutsysrootdir/boot/initramfs-${kernel}.img"
fi
The Rocky default is apparently #5. The #2 would be ok too.