GithubHelp home page GithubHelp logo

dahliaos / fimage Goto Github PK

View Code? Open in Web Editor NEW
281.0 9.0 23.0 125.93 MB

Portable Fuchsia Emulator

Home Page: https://docs.dahliaos.io/os/fimage

License: BSD 2-Clause "Simplified" License

Shell 100.00%
google fuchsia emulator fimage gui hacktoberfest

fimage's Introduction

title permalink summary
Portable Fuchsia Emulator (FImage)
os/fimage.html
Explanation of the FImage tool, and its usage

Portable Fuchsia Emulator (FImage)

Note

FImage is provided for the convenience of developers and enthusiasts who don't want to compile Fuchsia. We are in no way affiliated Google. For more information, see fimage/LICENSE.
The windows method is highly unstable and should only be used if you cannot install or boot into linux on your device.

TL;DR

  • The FImage emulator can be downloaded here.
  • For more information on the Fuchsia Emulator, see this document.

To quickly run FImage, use the commands below inside of its folder:

./ffx-linux-x64 platform preflight
./network-config
./fimage-gui 4096

See Explore Fuchsia for tips on what you can do next. When you're done, you can clean up via dm shutdown.

Recommended Requirements

  • linux

    • 8GiB of RAM or more
    • an Intel processor produced after 2010 (If you have a dedicated GPU)
    • A 4th generation Intel processor (If you do not have a dedicated GPU) (Ivy Bridge technically works, but has all sorts of visual bugs)
    • Ubuntu 20.04 or equivalent
    • curl, unzip,git
    • Up-to-date graphics drivers
  • windows (wsl2)

    • Windows 10/11 build that supports wsl2 with wslg.
    • Ubuntu 20.04 wsl2 with wslg
    • 16GiB of RAM or more

linux

Fimage Quick Start

First, download the latest Fimage tool at fimage/releases. Extract the file fimage-<version>.zip and go into the fimage folder.

Begin by checking your hardware, using the provided ffx tool. FFX Documentation on fuchsia.dev

./ffx-linux-x64 platform preflight

This will print information about the hardware and software. If you are missing any dependencies or lacking hardware, it will let you know. The most common error is related to a lack of a supported GPU, to negate this, FImage uses software rendering by default, which may affect performance. If you have a supported GPU (Intel Ivy Bridge or newer), use the fimage-gui-hostGPU script to run FImage.

After following the instructions generated by the ffx preflight checks, you will need to configure networking, using the command below. This will configure the network interfaces for FEMU.

./network-config

Finally, the emulator is ready to run! Select one of the different launch options and use that to launch the emulator.

The command syntax is the same for each option. For example, to launch an FImage instance with 4GiB of RAM and a GUI, use:

./fimage-gui 4096

The launch options are as follows:

  • fimage-headless - Fuchsia emulator using only the command line
  • fimage-gui - Fuchsia emulator with the FEMU interface and the Ermine user shell
  • fimage-gui-hostGPU - Same as fimage-gui, using hostGPU; if supported

FImage on dahliaOS Linux-based Builds

Fimage can be installed on dahliaOS Linux with:

dap install fimage

Flutter Development with FImage

A guide to Flutter development with FImage can be found here: Setting up FImage for Application Development

Windows (wsl2)

A WIP script is in testing thats should enable to atleast boot fuchsia in the terminal. Booting fuchsia with the fimage gui is possible but highly unstable.

Fimage Quick Start

First install wsl2 on windows by opening powershell or windows terminal and running this command.

wsl --install

After that reboot your machine and open up again powershell or windows terminal and running the first command to use fimage in cli mode recommended or the second command to use fimage in gui mode. If you use the gui mode and close fimage make sure you run the reset command afterwards.

cli command

wget https://docs.dahliaos.io/scripts/fimage/windows/wsl2/launch.sh && sudo chmod +x launch.sh; sudo ./launch.sh -cli

gui command

wget https://docs.dahliaos.io/scripts/fimage/windows/wsl2/launch.sh && sudo chmod +x launch.sh; sudo ./launch.sh -gui

reset command

wget https://docs.dahliaos.io/scripts/fimage/windows/wsl2/launch.sh && sudo chmod +x launch.sh; sudo ./launch.sh -reset

Command-line interface in gnome-terminal

Known Issues

  • Flutter development doesn't work yet, due to a bug in the Flutter tool that escapes IPv6 addresses improperly
  • Performance when drawn with the software GPU is expectedly awful
  • Mouse input is laggy
  • Terminal application within ermine crashes (Fuchsia bug?); negated by pressing enter in the terminal FEMU was launched from.
  • Extreme jank on Ivy Bridge devices using host GPU

compiling Fuchsia for Fimage

Follow the documented steps from fuchsia.dev and then set the full target with tools, fx set workstation.qemu-x64 --with-base=//bundles:tools

export FUCHSIA_SSH_CONFIG="/Users/nmcain/fuchsia/out/default/ssh-keys/ssh_config"

fimage's People

Contributors

ignapk avatar larsb24 avatar nealmcb avatar nmcain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fimage's Issues

Confusing permission errors really implicate udev issues with /dev/kvm

Thanks for making it easier to run fushcia!

I was puzzled by a variety of confusing kvm permission errors trying to get configured on Ubuntu 18.04. E.g.

$ ./fimage-headless 2048
...
cannot add library /home/usr/fuchsia/fimage-210528/linux-x64/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed
added library /home/usr/fuchsia/fimage-210528/linux-x64/lib64/vulkan/libvulkan.so
cannot add library /home/usr/fuchsia/fimage-210528/linux-x64/lib64/vulkan/libvulkan.so.1: full
Could not access KVM kernel module: Permission denied
qemu-system-x86_64-headless: failed to initialize KVM: Permission denied
./fimage-headless: line 2: 27139 User defined signal 1   linux-x64/emulator -feature VirtioInput,GLDirectMem,VirtioMouse,KVM,Vulkan -window-size 1280x800 -gpu swiftshader_indirect -no-location-ui -no-window -no-hidpi-scaling -fuchsia -kernel default/multiboot.bin -initrd init/fuchsia-ssh.zbi -m $1 -serial stdio -vga none -device virtio-keyboard-pci -smp 4 -device virtio-mouse-pci -machine q35 -device isa-debug-exit,iobase=0xf4,iosize=0x04 -enable-kvm -cpu host,migratable=no,+invtsc -netdev type=tap,ifname=qemu,id=net0,script=scripts/start-unsecure-internet.sh,downscript=no -device virtio-net-pci,vectors=8,netdev=net0,mac=52:54:00:63:5e:7a -drive file=init/fvm_raw.blk,format=raw,if=none,id=vdisk -device virtio-blk-pci,drive=vdisk -append 'TERM=xterm-256color zircon.nodename=fuchsia_fimage kernel.serial=legacy kernel.entropy-mixin=ec98e395c5dd4771931a91dfe7e044a651c3b8b0be2828c8bf6544d151f62e2f kernel.halt-on-panic=false '

I had my account properly set up for kvm, since it tells me that the KVM line in /etc/group should end with ":" followed by your username. and that's true...

That file /home/usr/fuchsia/fimage-210528/linux-x64/lib64/vulkan/libvulkan.so.1 exists, but I don't know what full means in that context and don't see good tips on the web.

That problem turned out to be incorrect permissions on /dev/kvm itself. But note you can't just change the permissions with chmod. You need to configure udev, as described concisely in Gerd's answer at Android Studio: /dev/kvm device permission denied.

Since the error is misleading, it would help to have the shell scripts check for that explicitly and give better hints.

Fails on pixelbook go

Preflight generates the error in fimage-210528:
BUG: An internal command error occurred.
Could not run 'lspci'

Caused by:
No such file or directory (os error 2)

None of the files seemed to land in my linux container in a way they could be executed. Had to chmod -R 1777 * -

Then got this error: emulator: Android emulator version 30.7.2.0 (build_id ) (CL:N/A)
emulator: ERROR: can't find the emulator executable.

How to cleanly shut down the VM, for restart?

I haven't figured out how to exit the VM. When I use Ctrl-Z to suspend it and then kill it, the network ends up busy,

qemu-system-x86_64-headless: could not configure /dev/net/tun (qemu): Device or resource busy

and I resort to:

sudo ip link delete qemu
sudo ip link delete brqemu
./network-config

How can we bring it down cleanly? Perhaps we can modify the network-config script to clean up also?

standalone ./tools/zbi executable is needed

I'm trying to use fimage to develop fuchsia app but I don't have fuchsia source. So, I don't have ./tools/zbi to put ssh pub key.
Please add a standalone zbi executable in this repo, thanks.

dm suspend says "send_SuspendToRam: Failure with error: ZX_ERR_NOT_SUPPORTED"

Qemu is a real CPU hog for natural reasons. It would be nice to be able to pause or suspend Fuchsia / Zircon.

My first attempt was simply to use the Linux shell suspend approach (ctrl-z), but if you wait more than a few seconds to put the process back in the foreground, it crashes:

ZIRCON KERNEL OOPS                                                                                           
lockup_detector: no heartbeat from CPU-1 in 42506438 ms, last_heartbeat=520344414253 observed now=43026782921300 name=unknown.

Reported by [CPU-2] (message rate limited)
ZIRCON KERNEL PANIC
timer_ints: 146242, interrupts: 0

        tweight=0.2952270507 nfair=7 ndeadline=0 vtime=180747885048 period=8 tema=12583943 tutil=0.0
UPTIME: 43026795ms

I was happy to see a dm suspend command, but it says:

[00031.044] 21072:21074> [shutdown-shim]: checking power_manager liveness
send_SuspendToRam: Failure with error: ZX_ERR_NOT_SUPPORTED[00031.065]
 21072:21074> [shutdown-shim]: trying to forward command

What would it take to support SuspendToRam in this environment?

Are there other ways to pause the emulation and resume quickly?

Unable to start due to failing firewall config.

In scripts/start-unsecure-internet.sh there is this statement to allow DNS.

sudo ufw allow dns comment 'Fuchsia qemu DNS'

On my Ubuntu 22.04 LTS machine that gives the error

ERROR: Could not find a profile matching 'dns'

and Fuschsia simply does not start.

On my machine I replaced this with this and now Fuschsia does start

sudo ufw allow proto udp from 0.0.0.0 to 255.255.255.255 port 53 comment 'Fuchsia qemu DNS'

I'm unsure if this is a problem with my machine or something else.

How do I fix color and resolution issues

I ran the fimage using./fimage-gui 4096 in vm (ubuntu20.04). The color was not correct and the resolution was not correct:
image
image

but using the screenshort tool, I did get the right image
image

./ffx-linux-x64 platform preflight
Running pre-flight checks...

[✓] Found all needed build dependencies: curl, git, unzip

[!] Did not find tested and supported graphics acceleration hardware. Usage of the
graphical Fuchsia emulator (fx vdl start) may fall back to a slow software
renderer. The terminal emulator (fx qemu) is unaffected.
Found the following chipsets: Cirrus Logic GD 5446
Only a small set of chipsets are officially supported:
https://fuchsia.dev/fuchsia-src/get-started/set_up_femu#supported-hardware

[✓] Found tuntap device named 'qemu' for current user

There were some warnings, but you can still carry on. Continue at https://fuchsia.dev/fuchsia-src/get-started

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.