summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-11-19 23:24:07 +0300
committerAnatolij Gustschin <agust@denx.de>2021-12-27 01:33:28 +0300
commit92302ab1a279859824ec0f2e3864be44e883bff9 (patch)
treeb00665487ed5b7425a8fb36fe5190c6e56baff57 /scripts
parente567122b3253156009aeb6eda1a3d82962877367 (diff)
downloadu-boot-92302ab1a279859824ec0f2e3864be44e883bff9.tar.xz
x86: coreboot: Add a sample script to build a qemu image
It is useful to boot coreboot (with U-Boot as a payload) from qemu. Add a sample script to show how to do this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-cb.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/build-cb.sh b/scripts/build-cb.sh
new file mode 100755
index 0000000000..1da708fb6e
--- /dev/null
+++ b/scripts/build-cb.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Sample script to build a disk image suitable for use with coreboot. The image
+# includes a kernel and initrd.
+#
+# YOU WILL NEED to modify this for your needs, e.g. select a kernel.
+#
+# Run this with:
+# qemu-system-i386 -bios coreboot.rom -drive file=disk.img,if=virtio
+
+qemu-img create -f raw disk.img 120M
+mkfs.ext2 -F disk.img
+sudo mkdir -p /mnt/rootfs
+sudo mount -o loop disk.img /mnt/rootfs
+sudo mkdir -p /mnt/rootfs/boot
+sudo cp /boot/vmlinuz /mnt/rootfs/boot/.
+sudo cp /boot/initrd.img /mnt/rootfs/boot/.
+sudo umount /mnt/rootfs