I dig deeper into ISO and found hooks and possible parameters for kernel under live system. In KaOS ISO in file: kdeos/boot/x86_64/kdeosiso.img it is possible for midnight commander to view (F3) part of source code of hooks, mount handlers and others. Here are parameters, that can be set by grub to run live system (with default values):
kdeosisolabel=""
kdeosisobasedir="kdeos"
isomounts="/bootmnt/${kdeosisobasedir}/isomounts"
kdeosisodevice="/dev/disk/by-label/${kdeosisolabel}"
These parameters are used by default mount handler. So, basically, kdeosisolabel will provide a way to start live system from inserted CD, DVD or flash (or hdd partition). It is only necessary to know label of it and to have kdeos directory and its content there. This is handy for multiboot flash. Following grub entry or similar one will run KaOS from flash labeled "Multiboot"
menuentry "KaOS live" {
linux /kdeos/boot/x86_64/kdeosiso kdeosisolabel=Multiboot
initrd /kdeos/boot/x86_64/kdeosiso.img
}
But others mount handlers are present. For example PXE boot. Or ISO loop. The second should be the one needed to run ISO from HDD (without need to create separate partition for it). There is a hook that check parameter img_dev and img_loop. If both are set, then loop mount handler is executed. This handler do following steps: 1) mount {$img_dev} under /img_dev directory, 2) it mount (by losetup) file from /img_dev/{$img_loop}. These steps can also by done manually under emergency terminal, which will be available if standard handler did not find /dev/disk/by-label/${kdeosisolabel} (it waits 30 seconds and then it run emergency terminal). Then it is possible to do something like this:
mkdir /mnt
mkdir /iso
mount /dev/sda1 /mnt
mount -o loop /mnt/iso/KaOS.iso /iso
exit
Then, if kdeosisolabel are correctly set, booting of live system will contine.
So, ISO loop handler does almost exact steps. But it do not create directory /img_dev - and I think, this is the problem. If img_dev and img_loop are set, booting will show message about mounting them, but then it fails to emergency terminal and no /img_dev directory are present. I did not find a way how to tell grub or kernel to create this directory. Maybe someone will know how to do it, or it will be necessary to modify code of this hook, or modify virtual filesystem of live ISO to add /img_dev.
I think that correct grub entry should looks like this:
menuentry "KaOS ISO from HDD" {
set isofile="/iso/KaOS-2016.01-x86_64.iso"
loopback loop (hd0,1)$isofile
linux (loop)/kdeos/boot/x86_64/kdeosiso kdeosisolabel=KAOS_20160112 img_dev=/dev/sda1 img_loop=$isofile
initrd (loop)/kdeos/boot/x86_64/kdeosiso.img
}