1

I have a isolinux.cfg and grub.cfg file in which I invoke a vmlinuz kernel. I already append some kernel parameters but I would like to mount my device /dev/sda1 on boot before the vmlinuz parameter invokes my installation.

In my case the kernel parameter: coreos.inst=yes will trigger the installation process to automatically start, but in beforehand the device should get mounted.

grub.cfg

menuentry 'Fedora CoreOS (Fast install)' --class fedora --class gnu-linux --class gnu --class os {
    linux /images/vmlinuz mitigations=auto,nosmt systemd.unified_cgroup_hierarchy=0 coreos.liveiso=fedora-coreos-31.20200113.3.1 rd.neednet=1 ip=dhcp ignition.firstboot ignition.platform.id=metal coreos.inst.ignition_url=/mnt/ignition.ign coreos.inst.install_dev=/dev/nvme0n1 coreos.inst.image_url=/mnt/fedora_coreos.raw.xz coreos.inst=yes coreos.inst.insecure
  initrd /images/initramfs.img
}

isolinux.cfg

label linux
  menu label ^Fedora CoreOS (Fast install)
  menu default
  kernel /images/vmlinuz
  append initrd=/images/initramfs.img mitigations=auto,nosmt systemd.unified_cgroup_hierarchy=0 coreos.liveiso=fedora-coreos-31.20200113.3.1 rd.neednet=1 ip=dhcp ignition.firstboot ignition.platform.id=metal coreos.inst.ignition_url=/mnt/ignition.ign coreos.inst.install_dev=/dev/nvme0n1 coreos.inst.image_url=/mnt/fedora_coreos.raw.xz coreos.inst=yes coreos.inst.insecure

So in the end I would like that /mnt/ is the mounted device: /dev/sda1

This most likely would mean to execute something like this: mount -t auto -v /dev/sdb1 /mnt/

Is this somehow possible to do as an appended option on the initrd or kernel? (Within those configuration files.)

If not, what would be the approach to do something similar without changing initramfs.img or vmlinuz file?

PS: It's not necessary that this approach works for both, legacy and efi boot. One would be enough, of course it would be nice if it's something that works in both cases.


Edit: It might be possible with the kernel parameter: systemd.* for example systemd.run=mount something like this.

4

1 回答 1

0

当您启动设备并进入 grub 菜单时,请按c。这将启动 grub 提示符,您可以在其中输入命令。

您可以通过点击找到命令列表TAB

在 grub 提示符下,您可以使用ls列出文件。在 grub 中,您的设备(例如 /dev/sda、/dev/mmcblk1、/dev/nvme0n1 等)的地址是hdxx 是从 0 开始的数字。
您可能有多个分区。它们的地址是gptxx 是从 1 开始的数字。

您需要在 grub 提示符中找出您/dev/sda1的名称。然后ls通过文件夹结构。例如,这可能是:ls (hd0,gpt1)

所以coreos.inst.ignition_url=/mnt/ignition.ign你会写而不是coreos.inst.ignition_url=(hd0,gpt1)/mnt/ignition.ign

于 2020-02-25T15:09:42.393 回答