Notes on using Grub2 for BIOS-based platforms
=============================================
1. Create a disk image
dd if=/dev/zero of=disk.img bs=1M count=32
2. Partition it (either legacy or GPT style partitions work)
cfdisk disk.img
- Create one partition, type Linux, for the root
filesystem. The only constraint is to make sure there
is enough free space *before* the first partition to
store Grub2. Leaving 1 MB of free space is safe.
3. Setup loop device and loop partitions
sudo losetup -f disk.img
sudo partx -a /dev/loop0
4. Prepare the root partition
sudo mkfs.ext3 -L root /dev/loop0p1
sudo mount /dev/loop0p1 /mnt
sudo tar -C /mnt -xf output/images/rootfs.tar
sudo umount /mnt
5. Install Grub2
sudo ./output/host/sbin/grub-bios-setup \
-b ./output/host/lib/grub/i386-pc/boot.img \
-c ./output/images/grub.img -d . /dev/loop0
6. Cleanup loop device
sudo partx -d /dev/loop0
sudo losetup -d /dev/loop0
7. Your disk.img is ready!
Using genimage
--------------
If you use genimage to generate your complete image,
installing Grub can be tricky. Here is how to achieve Grub's
installation with genimage:
partition boot {
in-partition-table = "no"
image = "path_to_boot.img"
offset = 0
size = 512
}
partition grub {
in-partition-table = "no"
image = "path_to_grub.img"
offset = 512
}
The result is not byte to byte identical to what
grub-bios-setup does but it works anyway.
To test your BIOS image in Qemu
-------------------------------
qemu-system-{i386,x86-64} -hda disk.img
Notes on using Grub2 for x86/x86_64 EFI-based platforms
=======================================================
1. Create a disk image
dd if=/dev/zero of=disk.img bs=1M count=32
2. Partition it with GPT partitions
cgdisk disk.img
- Create a first partition, type EF00, for the
bootloader and kernel image
- Create a second partition, type 8300, for the root
filesystem.
3. Setup loop device and loop partitions
sudo losetup -f disk.img
sudo partx -a /dev/loop0
4. Prepare the boot partition
sudo mkfs.vfat -n boot /dev/loop0p1
sudo mount /dev/loop0p1 /mnt
sudo cp -a output/images/efi-part/* /mnt/
sudo cp output/images/bzImage /mnt/
sudo umount /mnt
5. Prepare the root partition
sudo mkfs.ext3 -L root /dev/loop0p2
sudo mount /dev/loop0p2 /mnt
sudo tar -C /mnt -xf output/images/rootfs.tar
sudo umount /mnt
6 Cleanup loop device
sudo partx -d /dev/loop0
sudo losetup -d /dev/loop0
7. Your disk.img is ready!
To test your i386/x86-64 EFI image in Qemu
------------------------------------------
1. Download the EFI BIOS for Qemu
Version IA32 or X64 depending on the chosen Grub2
platform (i386-efi vs. x86-64-efi)
https://www.kraxel.org/repos/jenkins/edk2/
(or use one provided by your distribution as OVMF)
2. Extract, and rename OVMF.fd to bios.bin and
CirrusLogic5446.rom to vgabios-cirrus.bin.
3. qemu-system-{i386,x86-64} -L ovmf-dir/ -hda disk.img
4. Make sure to pass pci=nocrs to the kernel command line,
to workaround a bug in the EFI BIOS regarding the
EFI framebuffer.
Notes on using Grub2 for ARM u-boot-based platforms
===================================================
The following steps show how to use the Grub2 arm-uboot platform
support in the simplest way possible and with a single
buildroot-generated filesystem.
1. Load qemu_arm_vexpress_defconfig
2. Enable u-boot with the vexpress_ca9x4 board name and with
u-boot.elf image format.
3. Enable grub2 for the arm-uboot platform.
4. Enable "Install kernel image to /boot in target" in the kernel
menu to populate a /boot directory with zImage in it.
5. The upstream u-boot vexpress_ca9x4 doesn't have CONFIG_API enabled
by default, which is required.
Before building, patch u-boot (for example, make u-boot-extract to
edit the source before building) file
include/configs/vexpress_common.h to define:
#define CONFIG_API
#define CONFIG_SYS_MMC_MAX_DEVICE 1
6. Create a custom grub2 config file with the following contents and
set its path in BR2_TARGET_GRUB2_CFG:
set default="0"
set timeout="5"
menuentry "Buildroot" {
set root='(hd0)'
linux /boot/zImage root=/dev/mmcblk0 console=ttyAMA0
devicetree /boot/vexpress-v2p-ca9.dtb
}
7. Create a custom builtin config file with the following contents
and set its path in BR2_TARGET_GRUB2_BUILTIN_CONFIG:
set root=(hd0)
set prefix=/boot/grub
8. Create a custom post-build script which copies files from
${BINARIES_DIR}/boot-part to $(TARGET_DIR)/boot (set its path in
BR2_ROOTFS_POST_BUILD_SCRIPT):
#!/bin/sh
cp -r ${BINARIES_DIR}/boot-part/* ${TARGET_DIR}/boot/
9. make
10. Run qemu with:
qemu-system-arm -M vexpress-a9 -kernel output/images/u-boot -m 1024 \
-nographic -sd output/images/rootfs.ext2
11. In u-boot, stop at the prompt and run grub2 with:
=> ext2load mmc 0:0 ${loadaddr} /boot/grub/grub.img
=> bootm
12. This should bring the grub2 menu, upon which selecting the "Buildroot"
entry should boot Linux.
Notes on using Grub2 for Aarch64 EFI-based platforms
====================================================
The following steps show how to use the Grub2 arm64-efi platform,
using qemu and EFI firmware built for qemu.
1. Load aarch64_efi_defconfig
2. make
3. Download the EFI firmware for qemu aarch64
https://www.kraxel.org/repos/jenkins/edk2/
(or use one provided by your distribution as OVMF-aarch64 or AAVMF)
4. Run qemu with:
qemu-system-aarch64 -M virt -cpu cortex-a57 -m 512 -nographic \
-bios <path/to/EDK2>/QEMU_EFI.fd -hda output/images/disk.img \
-netdev user,id=eth0 -device virtio-net-device,netdev=eth0
5. This should bring the grub2 menu, upon which selecting the
"Buildroot" entry should boot Linux.
没有合适的资源?快使用搜索试试~ 我知道了~
motioneyeos:单板计算机的视频监控操作系统
共11476个文件
mk:2838个
hash:2707个
in:2696个
5星 · 超过95%的资源 需积分: 18 2 下载量 27 浏览量
2021-02-20
07:17:46
上传
评论
收藏 60.08MB ZIP 举报
温馨提示
motionEyeOS是Linux发行版,可将您的单板计算机变成视频监视系统。 查看了解更多详细信息。 在Facebook上关注我们: : 。 您可以通过少量捐赠来支持motionEyeOS的开发。
资源详情
资源评论
资源推荐
收起资源包目录
motioneyeos:单板计算机的视频监控操作系统 (11476个子文件)
001e5780100962a5e30a25cbc4c9609cfc7bf3 184B
0e0d98a49c97da6a618ab36337e2058eb733a2 137B
0f4f85d7a1237e377a2d25b996518a877ea001 49B
130f6f4629514adaf2e03407f3ed9344eb6cd6 122B
2695cbf976fed1f543ad7486a531c0af473482 49B
30af1626bbadd64841b2cbcb6ac4ed0638ba1a 122B
32ebd8fc52cec991f18c94be980e85a8341585 22B
38b1dfcd825d47d834af3c5223417c8411d90d 152B
3f6f805bd016b90acafc8702c52d778eb57310 182B
476b879f65e956d7dedd5b08736369e9a24acc 20B
4b387624edc78d0292a127c43cad9ba97c6232 49B
4d62ff218ab7b4a04f5bfdf800ace087af3ceb 184B
52f458bdb0f9f5a4beb46fa82824421b8b988e 65B
545facf77bbc5f24f95b6d503c338d10b7b717 151B
59d83bfe937fc0412d96ed664663c9e8a99055 22B
6c9c5f64ec66534d4d069c2e408d9ae4dce023 182B
7406308d9259e2231bd0d6ddad3de3832bce08 182B
74231105841041d5f441e70399d37f0e600aa5 121B
846af45c3e455789435f49f80d70e86b65b9d7 22B
8a7e885a041da72b1ee9a47c5b9300b172a9e7 65B
8f666af75b7c0dfba6b8be7eac5f196e7a1221 49B
93ff46343f4f6a0522e2b28b871e905178c1f0 23B
9b0a5198c64cea9c00f820433411e3b4d50c1c 48B
9c5e8f964493290a409888d5413a737e8e5dd5 23B
9c5e8f964493290a409888d5413a737e8e5dd5 23B
9c5e8f964493290a409888d5413a737e8e5dd5 23B
a37f6885d7eb746df75eccaddbacf3ac82799d 180B
adjtime 17B
adminpasswd 1KB
Config.in.arc 3KB
arch.mk.arc 541B
Config.in.arm 28KB
artifact_info 33B
authorized_keys 29B
bae5b639e5a18e2cc4dc508f080d566baeff59 182B
0001-use-system-v4l2wrapper.patch.bak 3KB
0001-no-log4cpp.patch.bak 390B
bananapim1_defconfig 4KB
bananapim1_initramfs_defconfig 509B
bar 7B
base 1KB
barebox_ivt.bd 932B
u-boot-sunxi-with-spl.bin 1.99MB
u-boot-with-spl.bin 1.03MB
brcmfmac4350-pcie.bin 611KB
brcmfmac43455-sdio.bin 610KB
brcmfmac43456-sdio.bin 484KB
u-boot-with-spl.bin 435KB
brcmfmac43430-sdio.bin 391KB
brcmfmac43430a0-sdio.bin 373KB
fw_bcm43438a1.bin 366KB
fw_bcm43438a0.bin 328KB
fw_bcm43438a0_apsta.bin 302KB
u-boot.bin 273KB
rtl8192eu_nic.bin 31KB
brcmfmac43430a0-sdio.bin 38B
brcmfmac43430-sdio.bin 38B
fw_bcm43438a1_apsta.bin 17B
fw_bcm43438a1_p2p.bin 17B
fw_bcm43438a0_p2p.bin 17B
board 13B
board 13B
board 13B
board 13B
board 12B
board 12B
board 12B
board 11B
board 11B
board 10B
board 10B
board 9B
boardsn 97B
boardsn 97B
boardsn 97B
boardsn 97B
boardsn 97B
boardsn 97B
boardsn 97B
boardsn 97B
boardsn 91B
boardsn 91B
boardsn 91B
boardsn 90B
boardsn 30B
bootdone 117B
Makefile.br 2KB
br-kodi 929B
br2-external 8KB
brcm_patchram_plus 23KB
brmake 976B
README.buildroot 1019B
README.buildroot 621B
bzr 2KB
nconf.c 39KB
gconf.c 38KB
symbol.c 31KB
expr.c 30KB
mconf.c 28KB
confdata.c 26KB
共 11476 条
- 1
- 2
- 3
- 4
- 5
- 6
- 115
HMI前线
- 粉丝: 22
- 资源: 4590
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1