Skip to contentSkip to conversation

grub-setup: --no-boot option?

DISCUSSION Paul Bolle 2 participants 7 messages Oct 21, 2005 – Oct 28, 2005

lore
Share & tools
lore

Paul Bolle

author
#0 lore raw

0) I've been playing with GRUB 1.91. Not wanting to risk my MBR I put GRUB 1.91 into the boot sector of a partition (hd0,2 actually).

1) Both these commands (entered at the GRUB 0.95 command line) will get me the GRUB 1.91 prompt :
- kernel (hd0,2)/boot/grub/core.img
boot
- chainload (hd0,2)+1
boot

Am I correct in thinking these commands are essentially the same now? GRUB2 seems to launch identically with both commands. Or are there side effects I have overlooked?

2) If there are no (serious) side effects, would it be an idea to add an "--no-boot" option to grub-setup? This option should then ensure that no boot sectors will be changed so the only the effect of grub-setup would be some (small but important) changes to a (specified or default) core.img. This should make it somewhat safer to try GRUB2 (as MBR and boot sectors will be left unchanged) without risking your current setup, shouldn't it?

Regards,

Paul Bolle

#1 lore raw
Quoted 10 lines · Paul Bolle

1) Both these commands (entered at the GRUB 0.95 command line) will get me the GRUB 1.91 prompt :
- kernel (hd0,2)/boot/grub/core.img
boot
- chainload (hd0,2)+1
boot

Am I correct in thinking these commands are essentially the same now? GRUB2 seems to launch identically with both commands. Or are there side effects I have overlooked?

When you install GRUB into (hd0,2), they are the same.

Quoted 7 lines

2) If there are no (serious) side effects, would it be an idea to add an "--no-boot" option to grub-setup? This option should then ensure that no boot sectors will be changed so the only the effect of grub-setup would be some (small but important) changes to a (specified or default) core.img. This should make it somewhat safer to try GRUB2 (as MBR and boot sectors will be left unchanged) without risking your current setup, shouldn't it?

In this case, you can invoke grub-mkimage directly.

Okuji

author
#2 lore raw
Quoted 5 lines · Yoshinori K. Okuji
Quoted 2 lines · Paul Bolle

2) If there are no (serious) side effects, would it be an idea to add an "--no-boot" option to grub-setup? [...]

In this case, you can invoke grub-mkimage directly.

I already tried. But launching the GRUB image grub-mkimage generated (b.t.w. using the exact command grub-install uses) dropped me to rescue mode. The image grub-mkimage generated isn't exactly equal to the image generated by grub-install. A check with cmp suggested the only differences are a few bytes that grub-setup seems to have touched.

Regards,

Paul

#3 lore raw
Quoted 5 lines · Paul Bolle

I already tried. But launching the GRUB image grub-mkimage generated (b.t.w. using the exact command grub-install uses) dropped me to rescue mode. The image grub-mkimage generated isn't exactly equal to the image generated by grub-install. A check with cmp suggested the only differences are a few bytes that grub-setup seems to have touched.

Because you didn't set the variable root. You need to do this:

root=(hd0,2)
kernel /boot/grub/core.img
boot

Okuji

author
#4 lore raw
Quoted 10 lines · Yoshinori K. Okuji
Quoted 3 lines · Paul Bolle

I already tried. But launching the GRUB image grub-mkimage generated (b.t.w. using the exact command grub-install uses) dropped me to rescue mode. [...].

Because you didn't set the variable root. You need to do this:

root=(hd0,2)
kernel /boot/grub/core.img
boot

No. The problem was that I had installed the GRUB files not in the default directory (but in /boot/grub2) while grub-mkimage will not change the grub_prefix variable found in the kernel.img.

This might suggest to add an option to grub-mkimage (say:
"--runtime-dir") to overrule the grub_prefix variable set in the image. (This option would then sort of correspond with the "--directory" option of grub-setup.) Not that important, though ...

Regards,

Paul

#5 lore raw
Quoted 8 lines · Paul Bolle

No. The problem was that I had installed the GRUB files not in the default directory (but in /boot/grub2) while grub-mkimage will not change the grub_prefix variable found in the kernel.img.

This might suggest to add an option to grub-mkimage (say:
"--runtime-dir") to overrule the grub_prefix variable set in the image. (This option would then sort of correspond with the "--directory" option of grub-setup.) Not that important, though ...

I'd say, this is against the philosophy of GRUB: everything should be dynamic at run time. So the best way is to make it possible to pass an optional argument which specifies a prefix to GRUB. For example:

kernel /boot/grub2/core.img prefix=(hd0,2)/boot/grub2

Okuji

author
#6 lore raw
Quoted 9 lines · Yoshinori K. Okuji
Quoted 3 lines · Paul Bolle

This might suggest to add an option to grub-mkimage (say:
"--runtime-dir") to overrule the grub_prefix variable set in the image.

I'd say, this is against the philosophy of GRUB: everything should be dynamic at run time. So the best way is to make it possible to pass an optional argument which specifies a prefix to GRUB. For example:

kernel /boot/grub2/core.img prefix=(hd0,2)/boot/grub2

I've been thinking about that too.

Half of the solution seems to be to have GRUB2 (check for) and use the multiboot information structure that might be passed to it at when launched (as that structure contains (a pointer to) the command line). A few (rather badly failed) tests showed me that this requires a non-trivial (for me at least) amount of assembly hacking.

The other half of the solution would probably be the scripting support people seem to be working on (and making the command line available to scripts). But that's just a guess ...

Paul Bolle