как запустить образ ISO livecd Calculate Linux с жесткого диска из загрузчика GRUB2

Есть ли готовая толковая статья?

Был такой топик:
http://www.calculate-linux.ru/boards/16/topics/12373
(в нём решения не приводится, а даётся ссылка на другой топик)

и другой топик:
http://www.tux.in.ua/articles/1399
(в нём монтирование производится средствами ядра linux, т.е. mount -o loop)

Пока не нашел заточенного на Calculate описания того,
как монтировать .iso средствами grub2

http://www.gnu.org/software/grub/manual/grub.html#Loopback-booting

GRUB is able to read from an image (be it one of CD or HDD) stored on any of its accessible storages (refer to see loopback command). However the OS itself should be able to find its root. This usually involves running a userspace program running before the real root is discovered. This is achieved by GRUB loading a specially made small image and passing it as ramdisk to the kernel. This is achieved by commands kfreebsd_module, knetbsd_module_elf, kopenbsd_ramdisk, initrd (see initrd), initrd16 (see initrd), multiboot_module, multiboot2_module or xnu_ramdisk depending on the loader. Note that for knetbsd the image must be put inside miniroot.kmod and the whole miniroot.kmod has to be loaded. In kopenbsd payload this is disabled by default. Aditionally behaviour of initial ramdisk depends on command line options. Several distributors provide the image for this purpose or it’s integrated in their standard ramdisk and activated by special option. Consult your kernel and distribution manual for more details. Other loaders like appleloader, chainloader (BIOS, EFI, coreboot), freedos, ntldr and plan9 provide no possibility of loading initial ramdisk and as far as author is aware the payloads in question don’t support either initial ramdisk or discovering loopback boot in other way and as such not bootable this way. Please consider alternative boot methods like copying all files from the image to actual partition. Consult your OS documentation for more details

(тут важно, что писать в конфиг - какие параметры и как называются файлы внутри iso)

(rasdark намекает, что здесь loopback используется самим grub2-ом только для того,
чтобы прочитать из iso файлы для kernel и initrd. А дальше .iso-шник ищется и монтируется ещё раз уже из inird)

Что обычно пишут в /boot/grub/grub.cfg (конфиг grub2)?

Примеры под разные операционки:
https://help.ubuntu.com/community/Grub2/ISOBoot/Examples

люди мучаются:
http://www.calculate-linux.org/issues/385

вариант с http://pastebin.calculate-linux.ru/ru/show/10562

menuentry "Calculate Linux Desktop KDE (${cl_arch})" {
    set gfxpayload=keep
    set root=(hd0,1)
    set iso=/boot/iso/cld-${cl_arch}.iso
    set iso_label=CLD-20150116
    loopback loop ${iso}
    echo "Загружается ядро (${cl_arch}) CLD KDE...(${iso_label})"
    linux (loop)/boot/vmlinuz isoboot=${iso} boot=isolinux iso-scan/filename=${iso} root=live:LABEL=${iso_label} rd.live.image init=/linuxrc rd.live.squashimg=livecd.squashfs nodevfs udev quiet noresume doscsi splash elevator=cfq ${cl_cache} calculate=${cl_lang},${cl_video}
    echo "Загружается initramfs..."
    initrd (loop)/boot/initrd
}

(rasdark: я тебе дал не пример, а то как оно реально у меня работает на флешке)

что здесь есть интересного (более-менее специфичного для gentoo и calculate:
isoboot=
boot=isolinux
iso-scan/filename=
root=live:LABEL=${iso_label}
rd.live.image
rd.live.squashimg=livecd.squashfs
init=/linuxrc
calculate=${cl_lang},${cl_video}

Где на web есть описание состава .iso?
Где описаны параметры ядра и initrd для calculate?

Параметры ядра

описаны тут:
https://www.kernel.org/doc/Documentation/kernel-parameters.txt
(наших параметров там нет)

Собрано дракутом

(rasdark: калько ядро собрано дракутом)
https://dracut.wiki.kernel.org/index.php/Main_Page

о чем нам это должно сказать?
https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html#_boot_parameters

An initramfs generated without the “hostonly” mode, does not contain any system configuration files (except for some special exceptions), so the configuration has to be done on the kernel command line. With this flexibility, you can easily boot from a changed root partition, without the need to recompile the initramfs image. So, you could completly change your root partition (move it inside a md raid with encryption and LVM on top), as long as you specify the correct filesystem LABEL or UUID on the kernel command line for your root device, dracut will find it and boot from it.

The kernel command line usually can be configured in /boot/grub/grub.conf or /boot/grub2/grub.cfg, if grub is your bootloader and it also can be edited in the real boot process in the grub menu.

The kernel command line can also be provided by the dhcp server with the root-path option. See the section called “Network Boot”.

For a full reference of all kernel command line parameters, see dracut.cmdline(5).

Есть файл
https://github.com/haraldh/dracut/blob/master/dracut.cmdline.7.asc
в нём написано:

boot=
specify the device, where /boot is located.

liveimg
rd.live.image
(фиговое объяснение - ничего не объясняет)

iso-scan/filename
Using iso-scan/filename with a Fedora/Red Hat/CentOS Live iso should just work by copying the original kernel cmdline parameters
(казалось бы, при чем тут Calculate, если пишут про RedHat?)

Есть ещё Casper hook:
http://manpages.ubuntu.com/manpages/hardy/man7/casper.7.html
но у нас же другая система, так что описание casper не подойдёт.

Документация Calculate

описания параметров
isoboot=
rd.live.squashimg=
calculate=
отсутствует.

если в апстриме нет документации, то надо им багу написать.
А на параметр calculate= багу надо написать вам (я надеюсь, этого поста достаточно?)

Документация Calculate - где она?

На данный момент официально поддержки загрузки iso Calculate Linux из grub2 нет, потому и недокументировано.
Данная фича была нужна буквально нескольким людям, которые ее успешно себе и настроили.

Вам дали практически готовый конфиг.

Только, что загрузил последний образ CLDX со следующим конфигом:

menuentry 'Calculate Linux' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_gpt
    insmod ext2
    insmod search_label
    insmod loopback
    set root='hd0,gpt1'
    set iso=/cldx-20150212-i686.iso
    loopback loop ${iso}
    linux (loop)/boot/vmlinuz isoboot=${iso} boot=isolinux iso-scan/filename=${iso} root=live:LABEL=CSS-20150212 rd.live.image init=/linuxrc rd.live.squashimg=livecd.squashfs nodevfs udev quiet noresume splash elevator=deadline calculate=resolution:auto,video:auto,composite:on
    initrd (loop)/boot/initrd
}

По параметрам calculate= вы можете посмотреть, что за что отвечает, если смонтируете образ и посмотрите файлы в /syslinux/ - там всё предельно ясно.

как получить метку:

# isoinfo -d -i cld-14.12.1-x86_64.iso | grep ‘Volume id:’
Setting input-charset to ‘UTF-8’ from locale.
Volume id: CLD-20141230

я пытаюсь проверить загрузку
qemu-system-x86_64 -enable-kvm -drive file=/dev/sda,if=virtio,readonly
а мне показывает старое содержимое grub.cfg

Как записать кеши на диск?
ну или не кеш надо записать, а содержимое /dev/sda обновить - уж не знаю
sync не помогает

http://forum.osdev.org/viewtopic.php?f=1&t=24468

You have to pass the below argument to qemu
to disable guest disk caching and actually make qemu
wait on the disk IO.

qemu -drive file=/dev/sda,index=0,cache=none

instead of -hda /dev/sda

http://www.calculate-linux.org/blogs/ru/353/show
2012-04-08, Загрузка чистой системы(livecd), без использования CD или флешек

файл /boot/grub/grub.cfg каждый раз при обновлении ядра пресоздается.

http://www.calculate-linux.org/boards/16/topics/13573
2012-02-05, Установка через GRUB
если памяти уж совсем впритык, то “двигание партиций” может зависнуть в процессе и возможно поломать данные. Чтоб этого избежать подключите swap(обычно он в начале диска и “двигание” его не затронет).