(resending to the list...)

On 01/16/15 00:35, James Bottomley wrote:
> The UEFI Security Sub team needs to do some prototyping across all
> supported architectures.  We've been having some discussions about how a
> particular feature would work on different architectures and have
> decided that prototyping it with edk2 would help ... unfortunately none
> of us has any ARM systems (and anyway, virtual images are so much easier
> to handle for those of us on the move).  I've heard that you two may
> have some experimental patches to make Ovmf work on ARM, so I was
> wondering if you could share them?  I'm also going to have to run them
> under qemu-arm on an x86 system, so any information you could share
> about doing that (does it actually work) would be helpful.

Not experimental. :)

(1) Cross-compile the latest upstream edk2 with:

source edksetup.sh
make -C "$EDK_TOOLS_PATH"
export GCC48_AARCH64_PREFIX=aarch64-linux-gnu-

build \
  -a AARCH64 \
  -t GCC48 \
  -p ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.dsc \
  -n $(getconf _NPROCESSORS_ONLN) \
  --report-file=/tmp/build.aa64virt.report \
  --log=/tmp/build.aa64virt.log \
  -b DEBUG \
  -D INTEL_BDS

cp Build/ArmVirtualizationQemu-AARCH64/DEBUG_GCC48/FV/QEMU_EFI.fd \
   /tmp/

(2) Check out the latest upstream qemu (git), and apply the following
patch on top (it's been reviewed and queued in target-arm.next):

http://article.gmane.org/gmane.comp.emulators.qemu/312419/raw

Proposed / example build command:

./configure \
  --target-list=aarch64-softmmu \
  --prefix=/opt/qemu-installed \
  --enable-debug \
  --disable-gtk
make -j $(getconf _NPROCESSORS_ONLN)
make install

(3) The following script runs an aarch64 UEFI guest on (eg.) an x86_64
host, with a virtio-net NIC ("user" backend, slow but no privileges are
needed), a virtio-scsi CD-ROM (installer ISO for example), and a
virtio-blk hard disk. The image file ("disk.img") should be created in
advance with "qemu-img create ...".

# change to the directory hosting the image file, the flash drives,
# and the ISO image
cd /mnt/data/arm-images/BLAH

# recreate the first flash drive from the most recent firmware build
cat /tmp/QEMU_EFI.fd /dev/zero \
| head -c $((64 * 1024 * 1024)) > flash0.img

# create second flash drive (varstore) if it doesn't exist
if ! [ -e flash1.img ]; then
  head -c $((64 * 1024 * 1024)) /dev/zero > flash1.img
fi

# you can switch between the guest's serial line and the qemu
# monitor with [C-a c]
/opt/qemu-installed/bin/qemu-system-aarch64 \
  -nodefaults \
  -nodefconfig \
  -nographic \
  \
  -m 2048 \
  -cpu cortex-a57 \
  -M virt \
  \
  -drive if=pflash,format=raw,file=flash0.img,readonly \
  -drive if=pflash,format=raw,file=flash1.img \
  \
  -chardev stdio,signal=off,mux=on,id=char0 \
  -mon chardev=char0,mode=readline,default \
  -serial chardev:char0 \
  \
  -netdev user,id=netdev0,hostfwd=tcp:127.0.0.1:2222-:22 \
  -device virtio-net-device,netdev=netdev0,bootindex=2 \
  \
  -drive if=none,file=disk.img,id=hd0,format=qcow2 \
  -device virtio-blk-device,drive=hd0,bootindex=0 \
  \
  -device virtio-scsi-device,id=scsi0 \
  \
  -drive id=cd0,if=none,format=raw,readonly,file=BLAH.iso \
  -device scsi-cd,bus=scsi0.0,drive=cd0,bootindex=1

For prebuilt firmware & usage notes about libvirt, see
<https://fedoraproject.org/wiki/Architectures/AArch64/Install_with_QEMU>.

Thanks
Laszlo

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to