From aae3d6cfc05a63531e213290d8b33987807ddfa4 Mon Sep 17 00:00:00 2001 From: Berkus Decker Date: Sun, 24 Feb 2019 18:30:37 +0200 Subject: [PATCH] Add tmux config for running qemu with both serial ports enabled * From Andre Richter tutorial --- emulation/instructions.txt | 14 +++++++++++ emulation/qemu_multi_uart.sh | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 emulation/instructions.txt create mode 100755 emulation/qemu_multi_uart.sh diff --git a/emulation/instructions.txt b/emulation/instructions.txt new file mode 100644 index 0000000..e6b1ed8 --- /dev/null +++ b/emulation/instructions.txt @@ -0,0 +1,14 @@ +######################################################### +# Welcome to the Raspi3 Emulation with # +# MiniUart and PL011UART # +# # +# # +# 1. Use the mouse to select different panes # +# and interact with the UARTS. # +# # +# 2. To quit the emulation: # +# 2.1 Select the pane in which QEMU runs (this one). # +# 2.2 CTRL-C to close qemu. # +######################################################### + +=== QEMU === diff --git a/emulation/qemu_multi_uart.sh b/emulation/qemu_multi_uart.sh new file mode 100755 index 0000000..df1810f --- /dev/null +++ b/emulation/qemu_multi_uart.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# +# MIT License +# +# Copyright (c) 2018-2019 Andre Richter +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +QEMU=/usr/local/Cellar/qemu/HEAD-3365de01b5-custom/bin/qemu-system-aarch64 +QEMU_OPTS=-M raspi3 -d int + +tmux new-session -d -s raspi3 & +sleep 1 +tmux new-window -t raspi3:1 +tmux new-window -t raspi3:2 + +tmux send-keys -t raspi3:0 "clear; echo '=== MiniUart ==='; bash /dev/ptmx" C-m +tmux send-keys -t raspi3:1 "clear; printf '=== PL011 Uart ===\n\n';bash /dev/ptmx" C-m + +FIRST=$(ps aux | grep ptmx | sort | awk '{print $7}' | sed '1q;d') +SECOND=$(ps aux | grep ptmx | sort | awk '{print $7}' | sed '2q;d') + +tmux send-keys -t raspi3:2 "clear; cat emulation/instructions.txt && ${QEMU} ${QEMU_OPTS} -kernel kernel8.img -serial /dev/$SECOND -serial /dev/$FIRST && tmux kill-session" C-m + +tmux join-pane -s raspi3:0 -t 2 +tmux join-pane -s raspi3:1 -t 2 + +tmux select-pane -t 1 +tmux attach-session -t raspi3