开发者

Change GRUB's variable using a C language [closed]

开发者 https://www.devze.com 2023-03-15 19:37 出处:网络
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines guidelines. It is not currently开发者_运维百科 accepting ans
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines guidelines. It is not currently开发者_运维百科 accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 5 years ago.

Improve this question

I was wondering if there is any way for me to write a C program to change the value off GRUB's variables.

I need to write a program that can reboot my computer on another OS, for example :

  • I am on Suse disk1

program changes GRUB's variable and reboot automatically.

  • I am on Suse disk2

I would like to access variables like : title, root, kernel, initrd. But without editing the /boot/grub/menu.lst or grub.conf file.

Is there an API for GRUB?


Why re-invent the wheel? Have a look at grub-set-default. This little tool set the default entry in the grub.cfg on the command line. This is just a little shellscript, but it should be enough for your needs.

0

精彩评论

暂无评论...
验证码 换一张
取 消