[PATCH docs] Enhancing instructions on QEMU

C├ędric Le Goater clg at kaod.org
Wed Jul 27 22:43:34 AEST 2016


On 07/13/2016 10:20 PM, 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

git clone  https://github.com/openbmc/qemu


> +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=<path>/flash-palmetto,format=raw,if=mtd \
> +-net nic,macaddr=C0:FF:EE:00:00:02,model=ftgmac100  \

That's my preferred MAC ! :)

you will have to do a "setenv ethaddr" in u-boot for the MAC to be taken
into account like on a real system. 

> +-net bridge,id=net0,helper=/usr/lib/qemu-bridge-helper,br=virbr0
> +```

eventually add : 

	run this command :

		sudo chmod +s /usr/lib/qemu-bridge-helper

	to be able to launch the guest without being root.



I think you could even define a virt domain[1] for the ast guest and use
the virsh command to start, destroy, get the console, etc. 

Cheers,

C.

[1] http://libvirt.org/formatdomain.html


> +### 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=<path>/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
> +
> +
>  ## Booting the host
>  
>  Login:
> 



More information about the openbmc mailing list