diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2021-06-16 10:54:38 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-06-16 10:54:38 +0200 |
commit | f1bfe711a283f2d98618c5eec73f2ba173c061c8 (patch) | |
tree | 0509e2432688d1f3ef596cf0a770a657e7ed2e9c /Documentation/boards | |
parent | 30d6ac7c240e224287f495e9be203bc7d2c4bc74 (diff) | |
parent | e06a8f0bf3151eafce695954109defbcfc4033f4 (diff) | |
download | barebox-f1bfe711a283f2d98618c5eec73f2ba173c061c8.tar.gz barebox-f1bfe711a283f2d98618c5eec73f2ba173c061c8.tar.xz |
Merge branch 'for-next/testing'
Diffstat (limited to 'Documentation/boards')
-rw-r--r-- | Documentation/boards/emulated.rst | 75 | ||||
-rw-r--r-- | Documentation/boards/mips/qemu-malta.rst | 16 | ||||
-rw-r--r-- | Documentation/boards/riscv.rst | 20 | ||||
-rw-r--r-- | Documentation/boards/riscv/barebox-virt32.cfg | 7 | ||||
-rw-r--r-- | Documentation/boards/riscv/barebox-virt64.cfg | 7 |
5 files changed, 103 insertions, 22 deletions
diff --git a/Documentation/boards/emulated.rst b/Documentation/boards/emulated.rst new file mode 100644 index 0000000000..584883d6ef --- /dev/null +++ b/Documentation/boards/emulated.rst @@ -0,0 +1,75 @@ +Emulated targets +================ + +Some targets barebox runs on are virtualized by emulators like QEMU, which +allows basic testing of barebox functionality without the actual hardware. + +Generic DT image +---------------- + +Supported for ARM and RISC-V. It generates a barebox image that can +be booted with the Linux kernel booting convention, which makes +it suitable to be passed as argument to the QEMU ``-kernel`` option +(as well as booted just like Linux from barebox or other bootloaders). + +The device tree can be passed externally via QEMU's ``-dtb`` option, but +also the QEMU internal device tree can be used. + +The latter can be very useful with :ref:`virtio_sect`, because QEMU will +fix up the virtio mmio regions into the device tree and barebox will +discover the devices automatically, analogously to what it does with +VirtIO over PCI. + +test/emulate.pl +--------------- + +The ``emulate.pl`` script shipped with barebox can be used to easily +start VMs. It reads a number of YAML files in ``test/$ARCH``, which +describe some virtualized targets that barebox is known to run on. + +Controlled by command line options, these targets are built with +tuxmake if available and loaded into the emulator for either interactive +use or for automated testing with Labgrid ``QEMUDriver``. + +.. _tuxmake: https://pypi.org/project/tuxmake/ +.. _Labgrid: https://labgrid.org + +Install dependencies for interactive use:: + + cpan YAML::XS # or use e.g. libyaml-libyaml-perl on Debian + pip3 install tuxmake # optional + +Example usage:: + + # Switch to barebox source directory + cd barebox + + # emulate x86 VM runnig the EFI payload from efi_defconfig + ARCH=x86 ./test/emulate.pl efi_defconfig + + # build all MIPS targets known to emulate.pl and exit + ARCH=mips ./test/emulate.pl --no-emulate + +The script can also be used with a precompiled barebox tree:: + + # Switch to build directory + export KBUILD_OUTPUT=build + + # run a barebox image built outside tuxmake on an ARM virt machine + ARCH=arm ./test/emulate.pl virt@vexpress_defconfig --no-tuxmake + + # run tests instead of starting emulator interactively + ARCH=arm ./test/emulate.pl virt@vexpress_defconfig --no-tuxmake --test + +``emulate.pl`` also has some knowledge on paravirtualized devices:: + + # Run target and pass a block device (here /dev/virtioblk0) + ARCH=riscv ./test/emulate.pl --blk=rootfs.ext4 virt64_defconfig + +Needed command line options can be passed directly to the +emulator/``pytest`` as well by placing them behind ``--``:: + + # appends -device ? to the command line. Add -n to see the final result + ARCH=riscv ./test/emulate.pl virt64_defconfig -- -device ? + +For a complete listing of options run ``./test/emulate.pl -h``. diff --git a/Documentation/boards/mips/qemu-malta.rst b/Documentation/boards/mips/qemu-malta.rst index e188ae8c64..fd37d5edb2 100644 --- a/Documentation/boards/mips/qemu-malta.rst +++ b/Documentation/boards/mips/qemu-malta.rst @@ -10,31 +10,23 @@ QEMU run string: qemu-system-mips -nodefaults -M malta -m 256 \ -device VGA -serial stdio -monitor null \ - -bios barebox-flash-image + -bios ./images/barebox-qemu-malta.img Little-endian mode ------------------ -Running little-endian Malta is a bit tricky. In little-endian mode the 32bit words in the boot flash image are swapped, a neat trick which allows bi-endian firmware. -You have to swap words of ``zbarebox.bin`` image, e.g.: - -.. code-block:: sh - - echo arch/mips/pbl/zbarebox.bin \ - | cpio --create \ - | cpio --extract --swap --unconditional - -QEMU run string: +The barebox build generates a second ``./images/barebox-qemu-malta.img.swapped`` +image that can be used in this case, e.g.: .. code-block:: sh qemu-system-mipsel -nodefaults -M malta -m 256 \ -device VGA -serial stdio -monitor null \ - -bios barebox-flash-image + -bios ./images/barebox-qemu-malta.img.swapped Using GXemul diff --git a/Documentation/boards/riscv.rst b/Documentation/boards/riscv.rst index 387b86c588..53d13550f3 100644 --- a/Documentation/boards/riscv.rst +++ b/Documentation/boards/riscv.rst @@ -41,25 +41,25 @@ TinyEMU ------- TinyEMU can emulate a qemu-virt like machine with a RISC-V 32-, 64- -and 128-bit CPU. It can run barebox with this sample configuration:: +and 128-bit CPU. It can run 32-bit barebox with this sample configuration: - /* temu barebox-virt64.cfg */ - { - version: 1, - machine: "riscv64", - memory_size: 256, - bios: "bbl64.bin", - kernel: "./images/barebox-dt-2nd.img", - } +.. literalinclude:: riscv/barebox-virt32.cfg + +as well as 64-bit barebox with this configuration: + +.. literalinclude:: riscv/barebox-virt64.cfg ``barebox-dt-2nd.img`` can be generated like with Qemu. Graphical -output is also supported, but virtio input support is still missing. +output and input are also supported. To activate add:: display0: { device: "simplefb", width: 800, height: 600 }, + input_device: "virtio", into the config file. +See https://barebox.org/jsbarebox/?graphic=1 for a live example. + Erizo ----- diff --git a/Documentation/boards/riscv/barebox-virt32.cfg b/Documentation/boards/riscv/barebox-virt32.cfg new file mode 100644 index 0000000000..5f0eb34eee --- /dev/null +++ b/Documentation/boards/riscv/barebox-virt32.cfg @@ -0,0 +1,7 @@ +{ + version: 1, + machine: "riscv32", + memory_size: 256, + bios: "bbl32.bin", + kernel: "images/barebox-dt-2nd.img", +} diff --git a/Documentation/boards/riscv/barebox-virt64.cfg b/Documentation/boards/riscv/barebox-virt64.cfg new file mode 100644 index 0000000000..45e1cd8308 --- /dev/null +++ b/Documentation/boards/riscv/barebox-virt64.cfg @@ -0,0 +1,7 @@ +{ + version: 1, + machine: "riscv64", + memory_size: 256, + bios: "bbl64.bin", + kernel: "images/barebox-dt-2nd.img", +} |