0

My program, wich is bash scripts, runs in a custom ISO with Debian.

I want a GRUB menuentry that passes a parameter from GRUB to the OS, a debugging flag, so I can test the program, and at the same time have a non debugging option, without the need of change the code.

For example, in Clonezilla you have several parameters like:

ocsdaemon_on="ssh"

which starts a ssh server.

I would put in my GRUB the parameterdebug or other custom word, then in my program

DEBUG=<flag>

Is this possible? How to achieve it?

1 Answer 1

1

Make sure your parameter is not overlapping with any existing parameter, and just add it to the kernel command line. See the list in Linux kernel documentation here: https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html

(debug is not a good choice for your program: it is already in use to enable kernel debugging.)

Then have your program read /proc/cmdline and look for it. That's basically all there's to it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .