[PATCH docs] Enhancing instructions on QEMU

Andrew Jeffery andrew at aj.id.au
Mon Jul 18 09:24:58 AEST 2016


On Wed, 2016-07-13 at 15:20 -0500, OpenBMC Patches wrote:
> From: Chris Austen <austenc at us.ibm.com>
> 
> Added step by step details on using QEMU in both a virtual
> bridge and tap environment.  Latest features of QEMU palmetto
> integration now allow for uboot flash support and ftgmac100
> device support.  That means you can start the qemu session
> from uboot and run the real ftgmac ethernet device.
> 
> Signed-off-by: Chris Austen <austenc at us.ibm.com>
> ---
>  cheatsheet.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 59 insertions(+)
> 
> diff --git a/cheatsheet.md b/cheatsheet.md
> index 873fbf9..37a9c60 100644
> --- a/cheatsheet.md
> +++ b/cheatsheet.md
> @@ -105,6 +105,65 @@ qemu-system-arm \
>  
>  To quit, type `Ctrl-a c` to switch to the QEMU monitor, and then `quit` to exit.
>  
> +## Using QEMU With Network capabilities
> +
> +In an attempt to get a palmetto working model with network capabilties a fork
> +was created.  The plan is to merge it back in to the qemu repo but for right now
> +the steps required to build, launch and verify are as follows.
> +
> +Compile a Palmetto flash image via Yocto and locate the file...
> +>build/tmp/deploy/images/palmetto/flash-palmetto
> +
> +```
> +git clone git at github.com:legoater/qemu.git

I agree with Joel here, I don't think we should be patching the docs to
point at someone's "private" tree. It's not great that openbmc/qemu
isn't yet suitable for you, but I'll try to resolve that as soon as I
can.

> +cd qemu
> +git checkout aspeed
> +mkdir build
> +cd build
> +../configure --target-list=arm-softmmu
> +make
> +cd arm-softmmu
> +```
> +
> +### Use a bridge device
> +Using a bridge device requires a bit of root access to set it up.  The benefit
> +is your qemu session runs in the bridges subnet so no port forwarding is needed.
> +There are packages needed to yourself a virbr0 such as
> +```
> +apt-get install libvirt libvirt-bin bridge-utils uml-utilities qemu-system-common
> +```
> +
> +```
> +./qemu-system-arm -m 256 -M palmetto-bmc -nographic \
> +-drive file=/flash-palmetto,format=raw,if=mtd \
> +-net nic,macaddr=C0:FF:EE:00:00:02,model=ftgmac100  \
> +-net bridge,id=net0,helper=/usr/lib/qemu-bridge-helper,br=virbr0
> +```
> +
> +### Use a tap device
> +When running in an environment that does not support you having root you will
> +need to forward the model ports.
> +```
> +./qemu-system-arm -m 256 -M palmetto-bmc -nographic \
> +-drive file=/flash-palmetto,format=raw,if=mtd \
> +-net nic \
> +-net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu \
> +
> +```
> +Now you just need to redirect to communicate...
> +```
> +curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST https://localhost:2443/login -d "{\"data\": [ \"root\", \"0penBmc\" ] }"
> +```
> +or
> +```
> +ssh -p 2222 root at localhost
> +```
> +
> +There are some other useful parms like that can redirect the console to another
> +window.  This results in having an easily accessible qemu command session.
> +-monitor stdio -serial pty -nodefaults
> +
> +

At face value I don't think all of this information belongs in the
cheatsheet (I haven't tried out the commandlines or verified their
behaviour against the text, so I may send a follow-up email along those
lines). I'd suggest a separate qemu document if this is the type of
content you want to add. My aim with the existing cheatsheet entry was
to provide the least amount of supporting words for the commandline to
have context, and explicitly avoided step-by-step instructions like
"how to build".

Given the openbmc/qemu repository supports booting from the flash image
the existing cheatsheet commandline should be updated. Again, I hope to
address the differences between openbmc/qemu and legoater/qemu soon.

Cheers,

Andrew

>  ## Booting the host
>  
>  Login:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20160718/c0639808/attachment.sig>


More information about the openbmc mailing list