Triggering start scripts from (Grub) bootmenu or initramfs?

1

What is the best practice to run start scripts / configuration options for the same linux kernel but starting it for different purposes?

  • Menuoption 1 / Scenario 1: Starting my Lubuntu Install normally with GUI

  • Menuoption 2 / Scenario 2: blacklist primary gpu, start my Lubuntu Headless, VFIO passthrough of the primary GPU to KVM/Qemu, Autostarting VM guest...

I would need to add VFIO options and run a start script at the end, since I don't want to log on to my system via SSH to start the guest VM. Is this possible to achieve via GRUB options only, is this a task for Initramfs or is this done completely differntly?

Hans Meiser

Posted 2017-11-22T12:09:55.277

Reputation: 179

Answers

1

I see two options:

  1. Provide an alternate init... one which will do your special "scenario 2" configuration before calling exec to replace itself with the real init.
  2. Tack a keyword onto the kernel command line, and detect it later from userspace by inspecting /proc/cmdline and behaving appropriately.

Attie

Posted 2017-11-22T12:09:55.277

Reputation: 14 841