Project

General

Profile

Bug #7223

Updated by Joshua M. Clulow about 4 years ago

It would appear that the grub @setup@ built-in command has been broken since LBA48 support was added in 6593. Consider the following grub script:

<pre>
device (hd0) /dev/rlofi/4
root (hd0,0)
setup (hd0)
quit
</pre>

This currently fails with an unhelpful error message:

<pre>
# /ws/xplat/proto/boot/grub/bin/grub --batch
...
grub> device (hd0) /dev/rlofi/4
grub> root (hd0,0)
Filesystem type is fat, partition type 0xc
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/fat_stage1_5" exists... yes
Running "embed /boot/grub/fat_stage1_5 (hd0)"... 18 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+0 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... failed

Error 1: Filename must be either an absolute pathname or blocklist
grub> quit
</pre>

After digging for a while, it became apparent that one of the arguments to the @install@ built-in is os a block list; i.e., @(hd0)1+0@. This block list should list the start and end sector of the embedded @fat_stage_1_5@, but here it is clearly not correct.

The addition of LBA48 support did not completely account for all of the integer type changes, and there are a few more places that need different @printf@ format strings. Once fixed, the install process functions correctly:

<pre>
...
Running "embed /boot/grub/fat_stage1_5 (hd0)"... 18 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+18 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.
grub> quit
</pre>

Note, in particular, the block list now includes sectors 1 through 18.

Back