我正在 Buildroot-2017.05.2 <我的配置:is here上 Ubuntu 17.04 上工作,并希望用作bootloader 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)
答案 0 :(得分:0)
我没有解决这个问题,但我找到了另一个解决方案。如果您需要为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。
现在对我有用。
P.S。在IRC #buildroot中,我被建议再次重新编译所有内容 寻找错误。它根本没用。