GRUB2 -> Buildroot:grub-bios-setup 中的分段错误
Posted
技术标签:
【中文标题】GRUB2 -> Buildroot:grub-bios-setup 中的分段错误【英文标题】:GRUB2 -> Buildroot: Segmentation fault in grub-bios-setup 【发布时间】:2018-02-09 02:57:53 【问题描述】:我正在 Buildroot-2017.05.2 上开发 Ubuntu 17.04(我的配置:is here)并希望用作引导加载程序 GRUB2强>。
我构建了 buildroot 并遵循内置指令:
dd if=/dev/zero of=170831_disk_1.img bs=1M count=300
cfdisk 170831_disk_1.img
dos -> primary & bootable & 0x83
sudo losetup -f 170831_disk_1.img
sudo partx -a /dev/loop0
sudo mkfs.ext4 -L root /dev/loop0p1
sudo mount /dev/loop0p1 /mnt
sudo tar -C /mnt -xf rootfs.tar
sudo umount /mnt
然后运行(当前目录以防万一:/home/user/buildroot/buildroot-2017.05.02/output/images/170831/):
sudo ../../host/usr/sbin/grub-bios-setup -b ../../host/usr/lib/grub/i386-pc/boot.img -c grub.img -d . /dev/loop0
我收到以下错误(详细模式):
./output/host/usr/sbin/grub-bios-setup: info: cannot open `/boot/grub/device.map': No such file or directory.
./output/host/usr/sbin/grub-bios-setup: info: Looking for /dev/loop0.
./output/host/usr/sbin/grub-bios-setup: info: /dev/loop0 is a parent of /dev/loop0.
./output/host/usr/sbin/grub-bios-setup: info: Looking for /dev/loop0.
./output/host/usr/sbin/grub-bios-setup: info: /dev/loop0 is a parent of /dev/loop0.
./output/host/usr/sbin/grub-bios-setup: info: transformed OS device `/dev/loop0' into GRUB device `hostdisk//dev/loop0'.
./output/host/usr/sbin/grub-bios-setup: info: getting the size of ././output/host/usr/lib/grub/i386-pc/boot.img.
./output/host/usr/sbin/grub-bios-setup: info: reading ././output/host/usr/lib/grub/i386-pc/boot.img.
./output/host/usr/sbin/grub-bios-setup: info: getting the size of ././output/host/usr/lib/grub/i386-pc/boot.img.
./output/host/usr/sbin/grub-bios-setup: info: getting the size of ././output/images/170831/grub.img.
./output/host/usr/sbin/grub-bios-setup: info: reading ././output/images/170831/grub.img.
./output/host/usr/sbin/grub-bios-setup: info: getting the size of ././output/images/170831/grub.img.
./output/host/usr/sbin/grub-bios-setup: info: root is `(null)', dest is `hostdisk//dev/loop0'.
./output/host/usr/sbin/grub-bios-setup: info: Opening dest.
./output/host/usr/sbin/grub-bios-setup: info: the size of hostdisk//dev/loop0 is 512000.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to /dev.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to dri.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to snd.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to by-path.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to vfio.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to hugepages.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to mqueue.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to shm.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to ubuntu-vg.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to disk.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to by-label.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to by-uuid.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to by-partuuid.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to by-path.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to by-id.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to block.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to char.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to pts.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to bsg.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to mapper.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to input.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to by-path.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to by-id.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to bus.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to usb.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to 002.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to 001.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to net.
./output/host/usr/sbin/grub-bios-setup: info: changing current directory to lightnvm.
Segmentation fault (core dumped)
【问题讨论】:
【参考方案1】:我没有解决这个问题,但我找到了另一个解决方案。如果您需要为 buildroot 安装 grub2,只需使用 genimage 并按照说明进行操作:
partition boot
in-partition-table = "no"
image = "boot.img"
offset = 0
size = 512
partition grub
in-partition-table = "no"
image = "grub.img"
offset = 512
此实用程序会将 GRUB2 写入您的存储。只需确保在您已经存在的分区之前有大约 1Mb。
它现在对我有用。
附:在 IRC #buildroot 中,我被建议重新编译所有内容并 寻找错误。一点用都没有。
【讨论】:
以上是关于GRUB2 -> Buildroot:grub-bios-setup 中的分段错误的主要内容,如果未能解决你的问题,请参考以下文章