Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| qemurecipes [2015/09/25 18:31] – JohnBaldwin | qemurecipes [2020/12/11 14:24] (current) – Add riscv qemu invocation MitchellHorne | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== QemuRecipes ====== | ||
| + | |||
| This page contains recipes for using qemu to run %%FreeBSD%% inside virtual machines (especially non-native virtual machines) on a %%FreeBSD%% host. The goal is to have a at least one " | This page contains recipes for using qemu to run %%FreeBSD%% inside virtual machines (especially non-native virtual machines) on a %%FreeBSD%% host. The goal is to have a at least one " | ||
| Line 9: | Line 11: | ||
| If you wish to boot without a graphical console, add '' | If you wish to boot without a graphical console, add '' | ||
| - | ====== | + | ====== |
| - | An EFI firmware file is required to boot %%FreeBSD%%/ | + | First, install the U-Boot port, sysutils/u-boot-qemu-arm. |
| - | ===== Booting | + | ===== Booting |
| + | |||
| + | The serial console will be available on stdin and stdout. | ||
| < | < | ||
| - | qemu-system-aarch64 -m 4096M -cpu cortex-a57 | + | qemu-system-arm -M virt -m 512m -nographic -bios / |
| - | -bios QEMU_EFI.fd -serial telnet:: | + | |
| - | -drive if=none, | + | |
| - | -device virtio-blk-device, | + | |
| - | -device virtio-net-device, | + | |
| </ | </ | ||
| - | Then '' | + | ====== aarch64 ====== |
| + | |||
| + | See also: [[arm64/ | ||
| + | |||
| + | %%FreeBSD%%/ | ||
| + | To boot using U-Boot, install sysutils/ | ||
| + | |||
| + | ===== Booting Disk Image ===== | ||
| + | |||
| + | < | ||
| + | qemu-system-aarch64 -M virt -m 512m -cpu cortex-a57 -nographic -bios / | ||
| + | </ | ||
| + | |||
| + | ====== mips ====== | ||
| + | |||
| + | %%FreeBSD%% does not provide release images for mips, so a disk image must be built from source. | ||
| + | |||
| + | | / | ||
| + | | / | ||
| + | | / | ||
| + | |||
| + | ===== Building Disk Image ===== | ||
| + | |||
| + | < | ||
| + | make TARGET_ARCH=mips buildworld | ||
| + | make TARGET_ARCH=mips buildkernel KERNCONF=MALTA | ||
| + | mkdir / | ||
| + | make TARGET_ARCH=mips installworld DESTDIR=/ | ||
| + | make TARGET_ARCH=mips installkernel KERNCONF=MALTA DESTDIR=/ | ||
| + | make TARGET_ARCH=mips distribution DESTDIR=/ | ||
| + | etcupdate extract -B -D / | ||
| + | </ | ||
| + | |||
| + | Create | ||
| + | changes to files in /etc such as enabling ssh. | ||
| + | |||
| + | < | ||
| + | makefs -M 4g -B be / | ||
| + | </ | ||
| + | |||
| + | ===== Booting Disk Image ===== | ||
| + | |||
| + | The serial console will be available on stdin and stdout. | ||
| + | |||
| + | < | ||
| + | qemu-system-mips -kernel / | ||
| + | </ | ||
| + | |||
| + | ===== Using External GCC from Ports ===== | ||
| + | |||
| + | To use external GCC from ports instead of the in-tree GCC 4.2.1 use these steps to build the image: | ||
| + | |||
| + | < | ||
| + | pkg install mips-xtoolchain-gcc | ||
| + | make TARGET_ARCH=mips CROSS_TOOLCHAIN=mips-gcc TARGET_CPUTYPE=mips3 buildworld | ||
| + | make TARGET_ARCH=mips CROSS_TOOLCHAIN=mips-gcc TARGET_CPUTYPE=mips3 buildkernel KERNCONF=MALTA | ||
| + | mkdir / | ||
| + | make TARGET_ARCH=mips CROSS_TOOLCHAIN=mips-gcc installworld DESTDIR=/ | ||
| + | make TARGET_ARCH=mips CROSS_TOOLCHAIN=mips-gcc installkernel KERNCONF=MALTA DESTDIR=/ | ||
| + | make TARGET_ARCH=mips distribution DESTDIR=/ | ||
| + | etcupdate extract -B -D / | ||
| + | </ | ||
| + | |||
| + | To cross-compile simple programs using the rootfs and external GCC, use the following variables. | ||
| + | |||
| + | < | ||
| + | ROOTFS=/ | ||
| + | CC=" | ||
| + | CXX=" | ||
| + | </ | ||
| + | |||
| + | ====== mips64 ====== | ||
| + | |||
| + | %%FreeBSD%% does not provide release images for mips64, so a disk image must be built from source. | ||
| + | |||
| + | | / | ||
| + | | / | ||
| + | | / | ||
| + | |||
| + | ===== Building Disk Image ===== | ||
| + | |||
| + | < | ||
| + | make TARGET_ARCH=mips64 buildworld | ||
| + | make TARGET_ARCH=mips64 buildkernel KERNCONF=MALTA64 | ||
| + | mkdir / | ||
| + | make TARGET_ARCH=mips64 installworld DESTDIR=/ | ||
| + | make TARGET_ARCH=mips64 installkernel KERNCONF=MALTA64 DESTDIR=/ | ||
| + | make TARGET_ARCH=mips64 distribution DESTDIR=/ | ||
| + | etcupdate extract -B -D / | ||
| + | </ | ||
| + | |||
| + | Create '' | ||
| + | changes to files in /etc such as enabling ssh. | ||
| + | |||
| + | < | ||
| + | makefs -M 4g -B be / | ||
| + | </ | ||
| + | |||
| + | ===== Booting Disk Image ===== | ||
| + | |||
| + | The serial console | ||
| + | |||
| + | < | ||
| + | qemu-system-mips64 -kernel / | ||
| + | </ | ||
| + | |||
| + | ===== Using External GCC from Ports ===== | ||
| + | |||
| + | To use external GCC from ports instead of the in-tree GCC 4.2.1 use these steps to build the image: | ||
| + | |||
| + | < | ||
| + | pkg install mips-xtoolchain-gcc | ||
| + | make TARGET_ARCH=mips64 CROSS_TOOLCHAIN=mips-gcc buildworld | ||
| + | make TARGET_ARCH=mips64 CROSS_TOOLCHAIN=mips-gcc buildkernel KERNCONF=MALTA64 | ||
| + | mkdir / | ||
| + | make TARGET_ARCH=mips64 CROSS_TOOLCHAIN=mips-gcc installworld DESTDIR=/ | ||
| + | make TARGET_ARCH=mips64 CROSS_TOOLCHAIN=mips-gcc installkernel KERNCONF=MALTA64 DESTDIR=/ | ||
| + | make TARGET_ARCH=mips64 distribution DESTDIR=/ | ||
| + | etcupdate extract -B -D / | ||
| + | </ | ||
| + | |||
| + | To cross-compile simple programs using the rootfs and external GCC, use the following variables. | ||
| + | |||
| + | < | ||
| + | ROOTFS=/ | ||
| + | CC=" | ||
| + | CXX=" | ||
| + | </ | ||
| ====== powerpc ====== | ====== powerpc ====== | ||
| Line 31: | Line 158: | ||
| ====== powerpc64 ====== | ====== powerpc64 ====== | ||
| - | The '' | + | See Also: [[powerpc/ |
| + | |||
| + | To disable the graphic console, use '' | ||
| ===== Install from ISO ===== | ===== Install from ISO ===== | ||
| Line 43: | Line 172: | ||
| < | < | ||
| qemu-system-ppc64 -drive file=/ | qemu-system-ppc64 -drive file=/ | ||
| + | </ | ||
| + | |||
| + | ====== riscv ====== | ||
| + | |||
| + | See also: [[riscv/ | ||
| + | |||
| + | Booting %%FreeBSD%%/ | ||
| + | |||
| + | ===== Booting Disk Image ===== | ||
| + | |||
| + | < | ||
| + | qemu-system-riscv64 -M virt -m 512m -nographic -bios / | ||
| </ | </ | ||
| ====== sparc64 ====== | ====== sparc64 ====== | ||
| - | **Note: | + | %%FreeBSD%%/ |
| ===== Install from ISO ===== | ===== Install from ISO ===== | ||
| Line 60: | Line 201: | ||
| qemu-system-sparc64 -drive file=/ | qemu-system-sparc64 -drive file=/ | ||
| </ | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | [[CategoryVirtualization]] | ||