Bug #7223
closedgrub "setup" built-in broken by 6593
100%
Description
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:
device (hd0) /dev/rlofi/4 root (hd0,0) setup (hd0) quit
This currently fails with an unhelpful error message:
# /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
After digging for a while, it became apparent that one of the arguments to the install
built-in is 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:
... 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
Note, in particular, the block list now includes sectors 1 through 18.
Related issues
Updated by Joshua M. Clulow about 6 years ago
- Related to Bug #6593: want LBA48 support in grub added
Updated by Electric Monk about 6 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
git commit 2e1aefd1b4539a3d6cf03dbfa515eabf4de09f59
commit 2e1aefd1b4539a3d6cf03dbfa515eabf4de09f59 Author: Joshua M. Clulow <josh@sysmgr.org> Date: 2016-07-27T14:44:02.000Z 7223 grub "setup" built-in broken by 6593 Reviewed by: Richard Lowe <richlowe@richlowe.net> Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Richard Lowe <richlowe@richlowe.net>