我正在Buildroot-2017.05.2上的Ubuntu 17.04上工作(我的配置:在这里)并希望用作引导加载程序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)