SlideShare una empresa de Scribd logo
1 de 31
Descargar para leer sin conexión
Using QEMU
       for
Cross Development


  Tetsuyuki Kobayashi

     Kyoto Microcomputer Co., Ltd.   1
Let's use QEMU
                    to boost your project


               Real system : System emulator
                          =
                    Atoms : Bits

                            This is what I impress today.
                            Take advantage of 'bits'!


                                    Kyoto Microcomputer Co., Ltd.   2
”Being Digital” by Nicholas Negroponte
 http://archives.obs-us.com/obs/english/books/nn/ch01c01.htm
Who am I?

   20+ years involved in embedded systems
       10 years in real time OS, such as iTRON
       10 years in embedded Java Virtual Machine
       Now Gcc, Linux, QEMU, Android, …
   Blogs
       http://d.hatena.ne.jp/embedded/ (Personal)
       http://blog.kmckk.com/ (Corporate)
   Twitter
       @tetsu_koba
                       Kyoto Microcomputer Co., Ltd.   3
Today's topic

   What is QEMU
   Atoms vs Bits
   QEMU is NOT good for …
   QEMU is GOOD for …
   Practices (from KMC blog)





           Kyoto Microcomputer Co., Ltd.   4
About QEMU

   http://wiki.qemu.org/
   QEMU is
    a generic and open source
    machine emulator
    and virtualizer.



                     Kyoto Microcomputer Co., Ltd.   5
QEMU is used …

   As virtualizer,
       KVM
       Xen
       VirtualBox
   Host CPU == Target CPU
       Today I don't focus on this.



                        Kyoto Microcomputer Co., Ltd.   6
QEMU is used …

   As a system emulator,
   Host CPU != Target CPU
   Many open source projects such as:
       Android
       Maemo
       Symbian
       ARM port of Open Solaris
        ...
                       Kyoto Microcomputer Co., Ltd.   7
QEMU has …

   Virtual disk.
   Many of virtual devices.
   Tiny Code Generator (TCG) to execute fast.
   Port redirector, Virtual network card.
   Bootloader to boot Linux kernel.
   gdbserver to connect gdb.
   ...

                     Kyoto Microcomputer Co., Ltd.   8
QEMU is *NOT* …

   Cycle accurate simulator (which is
    usually used for H/W development).
   So QEMU is not good for developing device
    driver which have to take account of accurate
    cycles.




                    Kyoto Microcomputer Co., Ltd.   9
License

   The whole QEMU is GPL.
   The QEMU virtual CPU core library (libqemu.a)
    is LGPL.
   TCG is BSD like license.
   Each virtual hardware has their own license.
       Check the source file.
   QEMU is a trademark of Fabrice Bellard.


                        Kyoto Microcomputer Co., Ltd.   10
Atoms vs Bits

   Developing embedded system require real
    system (= the physical board).
       Because the GOAL is there.



   System emulator is good complement for it.



   System emulator is 'bits', so free from any
    physical limitation.
   I mention QEMU for the system emulator.
                      Kyoto Microcomputer Co., Ltd.   11
How to get

   The physical board needs money to buy.
       Some special board can not buy because of dis-
        continue.



   QEMU does not need any money to get.




                       Kyoto Microcomputer Co., Ltd.     12
Footprint

   The physical board needs space to put.
       No space for a dozen of boards on your desk.



   QEMU does not need any desk space.
       (but disk space.)




                       Kyoto Microcomputer Co., Ltd.   13
Portability (in Physical)

   Bring the physical board and set it up is a work.
       The board might be crash in trouble.



   You are happy to bring QEMU in your USB key.
   Or you can transfer it via broad band network.




                       Kyoto Microcomputer Co., Ltd.   14
Duplication & Distribution

   The physical board can not be duplicate.



   You can duplicate your QEMU as many as you
    like and distribute them.
       You might ask for experts to take a look your
        problem on QEMU.




                        Kyoto Microcomputer Co., Ltd.   15
QEMU is *NOT* good for

   Performance evaluation.
   Especially SMP mode.
       SMP is simulated in single thread, not parallel.
       Deadly slow.
   Interesting session about QEMU multi core
       Japan Technical Jamboree24, Dec 2008
       CELF_JTJ24_qemu-multicore_English.pdf
       http://tree.celinuxforum.org/CelfPubWiki/JapanTechnicalJamboree24


                             Kyoto Microcomputer Co., Ltd.                  16
QEMU is *NOT* good for

   developing a device driver for a
    *NEW* device.
       Before, you need the accurate virtual device for the
        device.
       You have to develop a device driver with REAL
        device at first. Then you can develop virtual device
        with the device driver.




                        Kyoto Microcomputer Co., Ltd.          17
QEMU is *NOT* good for

   Compiling a huge mount of source
    code.
       Too slow for compiling.
       It takes more than one night to compile Linux
        kernel.




                        Kyoto Microcomputer Co., Ltd.   18
QEMU is GOOD for

   Learning.
       Even if you tweak too much to break, you lose
        nothing.
       Not only for beginners. Experts may examine the
        latest Linux kernel except for x86/x86_64, using
        QEMU.




                       Kyoto Microcomputer Co., Ltd.       19
QEMU is GOOD for

   Developing applications.
       without the real system.
       Android SDK is a perfect example.
   also good for designers to evaluate UI.




                        Kyoto Microcomputer Co., Ltd.   20
QEMU is GOOD for

   Testing.
       Fault injection by the virtual device.
       You can duplicate as many as you like and test
        them in parallel.
       Still need testing on real system.




                         Kyoto Microcomputer Co., Ltd.   21
Practice #1

       Following blog pages are written in Japanese. Try
        machine translation such as Google. It will work.
   Building QEMU from source archive
       QEMU requires zlib and SDL to build.
       http://blog.kmckk.com/archives/2223793.html
   Net-installing Debian on QEMU
       Don't use obsolete installer.
       http://blog.kmckk.com/archives/2233167.html

                       Kyoto Microcomputer Co., Ltd.        22
Practice #2

   Rebuilding kernel from Debian source package
       Get the source package and extract and patch it on
        ARM QEMU.
       Do compiling on PC Linux.
       QEMU system emulator is too slow to compile
        kernel.
       http://blog.kmckk.com/archives/2237994.html
Practice #3

   How to setup NFS server for QEMU
       Need ”insecure” option for NFS because QEMU
        redirect NFS port.
       http://blog.kmckk.com/archives/2257952.html




                       Kyoto Microcomputer Co., Ltd.   24
Practice #4

   Booting Debian in NFS root on ARM QEMU
       Booting from NFS root is good for early-stage
        developing.
                   You can read/write target file system any time.
                   You can boot kernel before implementing storage
                     device.
                   You don't have to care about size of storage.
       http://blog.kmckk.com/archives/2257962.html
Practice #5

   Build latest kernel in kernel.org and try SMP
    mode
       Finally the latest kernel successfully ran.
       versatile_defconfig remains old. It need updated.
       You can try another virtual board easily on QEMU.
       SMP implementation of QEMU is just simple and
        can not run fast.
       http://blog.kmckk.com/archives/2333826.html
Practice #6

   Try ARM Ubuntu using QEMU
       Ubuntu 9.04 is built for ARMv5TE.
       Ubuntu 9.10, ARMv6.
       Ubuntu 10.04, ARMv7 Thumb2.
       Debian, ARMv4T
       Rootstock script is nice and easy to build Ubuntu
        root file system.
       http://blog.kmckk.com/archives/2339128.html
Practice #7

   Using debugger with QEMU
       Dive into QEMU itself using gdb.
       Connect gdb to target machine of QEMU.
       Debug both the target and QEMU itself using 2
        gdbs.
       Another debugger for QEMU.
       http://blog.kmckk.com/archives/2363473.html
Other topics

   TCG and QEMU internals
       http://blog.kmckk.com/archives/2067157.html
       http://blog.kmckk.com/archives/2067178.html
       http://blog.kmckk.com/archives/2067210.html
   Using user mode emulation of QEMU + binfmt
    + chroot to self-build
       http://blog.kmckk.com/archives/2342452.html



                       Kyoto Microcomputer Co., Ltd.   29
Q&A

   & Demo




      Thank you for listening!
      Any comments to blogs are welcome.
                 Kyoto Microcomputer Co., Ltd.   30
One more thing ...




KMC PARTNER debugger for QEMU
Breaking at do_execve in linux kernel running on Android emulator.


                    Kyoto Microcomputer Co., Ltd.                    31

Más contenido relacionado

La actualidad más candente

Kernel_Crash_Dump_Analysis
Kernel_Crash_Dump_AnalysisKernel_Crash_Dump_Analysis
Kernel_Crash_Dump_Analysis
Buland Singh
 

La actualidad más candente (20)

Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !
Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !
Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !
 
eBPF Trace from Kernel to Userspace
eBPF Trace from Kernel to UserspaceeBPF Trace from Kernel to Userspace
eBPF Trace from Kernel to Userspace
 
PF開発に使えるAOSPのツール達
PF開発に使えるAOSPのツール達PF開発に使えるAOSPのツール達
PF開発に使えるAOSPのツール達
 
AllwinnerタブレットのOSを作ってみる(中編)
AllwinnerタブレットのOSを作ってみる(中編)AllwinnerタブレットのOSを作ってみる(中編)
AllwinnerタブレットのOSを作ってみる(中編)
 
Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...
Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...
Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...
 
不揮発メモリ(NVDIMM)とLinuxの対応動向について(for comsys 2019 ver.)
不揮発メモリ(NVDIMM)とLinuxの対応動向について(for comsys 2019 ver.)不揮発メモリ(NVDIMM)とLinuxの対応動向について(for comsys 2019 ver.)
不揮発メモリ(NVDIMM)とLinuxの対応動向について(for comsys 2019 ver.)
 
BPF / XDP 8월 세미나 KossLab
BPF / XDP 8월 세미나 KossLabBPF / XDP 8월 세미나 KossLab
BPF / XDP 8월 세미나 KossLab
 
Podman rootless containers
Podman rootless containersPodman rootless containers
Podman rootless containers
 
UM2019 Extended BPF: A New Type of Software
UM2019 Extended BPF: A New Type of SoftwareUM2019 Extended BPF: A New Type of Software
UM2019 Extended BPF: A New Type of Software
 
Ixgbe internals
Ixgbe internalsIxgbe internals
Ixgbe internals
 
Study on Android Emulator
Study on Android EmulatorStudy on Android Emulator
Study on Android Emulator
 
BKK16-504 Running Linux in EL2 Virtualization
BKK16-504 Running Linux in EL2 VirtualizationBKK16-504 Running Linux in EL2 Virtualization
BKK16-504 Running Linux in EL2 Virtualization
 
Basic of virtual memory of Linux
Basic of virtual memory of LinuxBasic of virtual memory of Linux
Basic of virtual memory of Linux
 
from Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Worksfrom Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Works
 
eBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux KerneleBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux Kernel
 
Kernel_Crash_Dump_Analysis
Kernel_Crash_Dump_AnalysisKernel_Crash_Dump_Analysis
Kernel_Crash_Dump_Analysis
 
Kernel Recipes 2015: Representing device-tree peripherals in ACPI
Kernel Recipes 2015: Representing device-tree peripherals in ACPIKernel Recipes 2015: Representing device-tree peripherals in ACPI
Kernel Recipes 2015: Representing device-tree peripherals in ACPI
 
Launch the First Process in Linux System
Launch the First Process in Linux SystemLaunch the First Process in Linux System
Launch the First Process in Linux System
 
HKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
HKG15-505: Power Management interactions with OP-TEE and Trusted FirmwareHKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
HKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
 
Heterogeneous multiprocessing on androd and i.mx7
Heterogeneous multiprocessing on androd and i.mx7Heterogeneous multiprocessing on androd and i.mx7
Heterogeneous multiprocessing on androd and i.mx7
 

Destacado

ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?
Tetsuyuki Kobayashi
 

Destacado (10)

From printk to QEMU: Xen/Linux Kernel debugging
From printk to QEMU: Xen/Linux Kernel debuggingFrom printk to QEMU: Xen/Linux Kernel debugging
From printk to QEMU: Xen/Linux Kernel debugging
 
Android ipm 20110409
Android ipm 20110409Android ipm 20110409
Android ipm 20110409
 
Tricky implementation of Go ARM soft float
Tricky implementation of Go ARM soft floatTricky implementation of Go ARM soft float
Tricky implementation of Go ARM soft float
 
Android On Ubuntu for developer
Android On Ubuntu for developerAndroid On Ubuntu for developer
Android On Ubuntu for developer
 
Logging system of Android
Logging system of AndroidLogging system of Android
Logging system of Android
 
Froyo DalvikVM JIT
Froyo DalvikVM JITFroyo DalvikVM JIT
Froyo DalvikVM JIT
 
Reusing your existing software on Android
Reusing your existing software on AndroidReusing your existing software on Android
Reusing your existing software on Android
 
Tips of Malloc & Free
Tips of Malloc & FreeTips of Malloc & Free
Tips of Malloc & Free
 
Logging system of Android
Logging system of AndroidLogging system of Android
Logging system of Android
 
ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?ADB(Android Debug Bridge): How it works?
ADB(Android Debug Bridge): How it works?
 

Similar a Using QEMU for cross development

Similar a Using QEMU for cross development (20)

Improving User Experience with Ubiquitous QuickBoot
 Improving User Experience with Ubiquitous QuickBoot Improving User Experience with Ubiquitous QuickBoot
Improving User Experience with Ubiquitous QuickBoot
 
Improving MeeGo boot-up time
Improving MeeGo boot-up timeImproving MeeGo boot-up time
Improving MeeGo boot-up time
 
The Andc Cluster
The Andc ClusterThe Andc Cluster
The Andc Cluster
 
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMUSFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
 
MIPS-X
MIPS-XMIPS-X
MIPS-X
 
”Bare-Metal Container" presented at HPCC2016
”Bare-Metal Container" presented at HPCC2016”Bare-Metal Container" presented at HPCC2016
”Bare-Metal Container" presented at HPCC2016
 
Status of AEM for Intel and AMD
Status of AEM for Intel and AMDStatus of AEM for Intel and AMD
Status of AEM for Intel and AMD
 
The Yocto Project
The Yocto ProjectThe Yocto Project
The Yocto Project
 
Getting started with LinuxBoot Firmware on AArch64 Server
Getting started with LinuxBoot Firmware on AArch64 Server Getting started with LinuxBoot Firmware on AArch64 Server
Getting started with LinuxBoot Firmware on AArch64 Server
 
Reducing boot time in embedded Linux
Reducing boot time in embedded LinuxReducing boot time in embedded Linux
Reducing boot time in embedded Linux
 
Tweaking Google TV emulator
Tweaking Google TV emulatorTweaking Google TV emulator
Tweaking Google TV emulator
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Reducing the boot time of Linux devices
Reducing the boot time of Linux devicesReducing the boot time of Linux devices
Reducing the boot time of Linux devices
 
ChromePad - Chromium OS for ThinkPad
ChromePad - Chromium OS for ThinkPadChromePad - Chromium OS for ThinkPad
ChromePad - Chromium OS for ThinkPad
 
TI TechDays 2010: swiftBoot
TI TechDays 2010: swiftBootTI TechDays 2010: swiftBoot
TI TechDays 2010: swiftBoot
 
ChromePad - Chromium OS ThinkPad X220
ChromePad - Chromium OS ThinkPad X220ChromePad - Chromium OS ThinkPad X220
ChromePad - Chromium OS ThinkPad X220
 
Krenel Based Virtual Machine In Centos7
Krenel Based Virtual Machine In Centos7Krenel Based Virtual Machine In Centos7
Krenel Based Virtual Machine In Centos7
 
BeagleBone Black Booting Process
BeagleBone Black Booting ProcessBeagleBone Black Booting Process
BeagleBone Black Booting Process
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox tests
 
Custum GNU/Linux Kali distribution
Custum GNU/Linux Kali distribution Custum GNU/Linux Kali distribution
Custum GNU/Linux Kali distribution
 

Más de Tetsuyuki Kobayashi

Simple and efficient way to get the last log using MMAP
Simple and efficient way to get the last log using MMAPSimple and efficient way to get the last log using MMAP
Simple and efficient way to get the last log using MMAP
Tetsuyuki Kobayashi
 

Más de Tetsuyuki Kobayashi (18)

some topic of ffmpeg
some topic of ffmpeg some topic of ffmpeg
some topic of ffmpeg
 
New VIdeo CODEC AV1
New VIdeo CODEC AV1 New VIdeo CODEC AV1
New VIdeo CODEC AV1
 
Try new transport protocol SRT (ver. 2)
Try new transport protocol SRT  (ver. 2)Try new transport protocol SRT  (ver. 2)
Try new transport protocol SRT (ver. 2)
 
Try new transport protocol SRT
Try new transport protocol SRTTry new transport protocol SRT
Try new transport protocol SRT
 
Raspberry Pi Zero とカメラモジュールで作るライブ配信実験機
Raspberry Pi Zero とカメラモジュールで作るライブ配信実験機Raspberry Pi Zero とカメラモジュールで作るライブ配信実験機
Raspberry Pi Zero とカメラモジュールで作るライブ配信実験機
 
WebOS Open Source Edition を試してみた
WebOS Open Source Edition を試してみたWebOS Open Source Edition を試してみた
WebOS Open Source Edition を試してみた
 
Linuxのユーザーランドをinitから全てまるごとgolangで書く
Linuxのユーザーランドをinitから全てまるごとgolangで書くLinuxのユーザーランドをinitから全てまるごとgolangで書く
Linuxのユーザーランドをinitから全てまるごとgolangで書く
 
組み込みLinuxでのGolangのススメ(Go con版)
組み込みLinuxでのGolangのススメ(Go con版)組み込みLinuxでのGolangのススメ(Go con版)
組み込みLinuxでのGolangのススメ(Go con版)
 
組み込みLinuxでのGolangのススメ
組み込みLinuxでのGolangのススメ組み込みLinuxでのGolangのススメ
組み込みLinuxでのGolangのススメ
 
ARM 64bit has come!
ARM 64bit has come!ARM 64bit has come!
ARM 64bit has come!
 
Virtual memory 20070222-en
Virtual memory 20070222-enVirtual memory 20070222-en
Virtual memory 20070222-en
 
Simple and efficient way to get the last log using MMAP
Simple and efficient way to get the last log using MMAPSimple and efficient way to get the last log using MMAP
Simple and efficient way to get the last log using MMAP
 
Patch101
Patch101Patch101
Patch101
 
Inter-process communication of Android
Inter-process communication of AndroidInter-process communication of Android
Inter-process communication of Android
 
Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'
 
Init of Android
Init of AndroidInit of Android
Init of Android
 
Let's play with Goldfish
Let's play with GoldfishLet's play with Goldfish
Let's play with Goldfish
 
Opensource Android
Opensource AndroidOpensource Android
Opensource Android
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Using QEMU for cross development

  • 1. Using QEMU for Cross Development Tetsuyuki Kobayashi Kyoto Microcomputer Co., Ltd. 1
  • 2. Let's use QEMU to boost your project Real system : System emulator = Atoms : Bits This is what I impress today. Take advantage of 'bits'! Kyoto Microcomputer Co., Ltd. 2 ”Being Digital” by Nicholas Negroponte http://archives.obs-us.com/obs/english/books/nn/ch01c01.htm
  • 3. Who am I?  20+ years involved in embedded systems  10 years in real time OS, such as iTRON  10 years in embedded Java Virtual Machine  Now Gcc, Linux, QEMU, Android, …  Blogs  http://d.hatena.ne.jp/embedded/ (Personal)  http://blog.kmckk.com/ (Corporate)  Twitter  @tetsu_koba Kyoto Microcomputer Co., Ltd. 3
  • 4. Today's topic  What is QEMU  Atoms vs Bits  QEMU is NOT good for …  QEMU is GOOD for …  Practices (from KMC blog)  Kyoto Microcomputer Co., Ltd. 4
  • 5. About QEMU  http://wiki.qemu.org/  QEMU is a generic and open source machine emulator and virtualizer. Kyoto Microcomputer Co., Ltd. 5
  • 6. QEMU is used …  As virtualizer,  KVM  Xen  VirtualBox  Host CPU == Target CPU  Today I don't focus on this. Kyoto Microcomputer Co., Ltd. 6
  • 7. QEMU is used …  As a system emulator,  Host CPU != Target CPU  Many open source projects such as:  Android  Maemo  Symbian  ARM port of Open Solaris  ... Kyoto Microcomputer Co., Ltd. 7
  • 8. QEMU has …  Virtual disk.  Many of virtual devices.  Tiny Code Generator (TCG) to execute fast.  Port redirector, Virtual network card.  Bootloader to boot Linux kernel.  gdbserver to connect gdb.  ... Kyoto Microcomputer Co., Ltd. 8
  • 9. QEMU is *NOT* …  Cycle accurate simulator (which is usually used for H/W development).  So QEMU is not good for developing device driver which have to take account of accurate cycles. Kyoto Microcomputer Co., Ltd. 9
  • 10. License  The whole QEMU is GPL.  The QEMU virtual CPU core library (libqemu.a) is LGPL.  TCG is BSD like license.  Each virtual hardware has their own license.  Check the source file.  QEMU is a trademark of Fabrice Bellard. Kyoto Microcomputer Co., Ltd. 10
  • 11. Atoms vs Bits  Developing embedded system require real system (= the physical board).  Because the GOAL is there.   System emulator is good complement for it.   System emulator is 'bits', so free from any physical limitation.  I mention QEMU for the system emulator. Kyoto Microcomputer Co., Ltd. 11
  • 12. How to get  The physical board needs money to buy.  Some special board can not buy because of dis- continue.   QEMU does not need any money to get. Kyoto Microcomputer Co., Ltd. 12
  • 13. Footprint  The physical board needs space to put.  No space for a dozen of boards on your desk.   QEMU does not need any desk space.  (but disk space.) Kyoto Microcomputer Co., Ltd. 13
  • 14. Portability (in Physical)  Bring the physical board and set it up is a work.  The board might be crash in trouble.   You are happy to bring QEMU in your USB key.  Or you can transfer it via broad band network. Kyoto Microcomputer Co., Ltd. 14
  • 15. Duplication & Distribution  The physical board can not be duplicate.   You can duplicate your QEMU as many as you like and distribute them.  You might ask for experts to take a look your problem on QEMU. Kyoto Microcomputer Co., Ltd. 15
  • 16. QEMU is *NOT* good for  Performance evaluation.  Especially SMP mode.  SMP is simulated in single thread, not parallel.  Deadly slow.  Interesting session about QEMU multi core  Japan Technical Jamboree24, Dec 2008  CELF_JTJ24_qemu-multicore_English.pdf  http://tree.celinuxforum.org/CelfPubWiki/JapanTechnicalJamboree24 Kyoto Microcomputer Co., Ltd. 16
  • 17. QEMU is *NOT* good for  developing a device driver for a *NEW* device.  Before, you need the accurate virtual device for the device.  You have to develop a device driver with REAL device at first. Then you can develop virtual device with the device driver. Kyoto Microcomputer Co., Ltd. 17
  • 18. QEMU is *NOT* good for  Compiling a huge mount of source code.  Too slow for compiling.  It takes more than one night to compile Linux kernel. Kyoto Microcomputer Co., Ltd. 18
  • 19. QEMU is GOOD for  Learning.  Even if you tweak too much to break, you lose nothing.  Not only for beginners. Experts may examine the latest Linux kernel except for x86/x86_64, using QEMU. Kyoto Microcomputer Co., Ltd. 19
  • 20. QEMU is GOOD for  Developing applications.  without the real system.  Android SDK is a perfect example.  also good for designers to evaluate UI. Kyoto Microcomputer Co., Ltd. 20
  • 21. QEMU is GOOD for  Testing.  Fault injection by the virtual device.  You can duplicate as many as you like and test them in parallel.  Still need testing on real system. Kyoto Microcomputer Co., Ltd. 21
  • 22. Practice #1  Following blog pages are written in Japanese. Try machine translation such as Google. It will work.  Building QEMU from source archive  QEMU requires zlib and SDL to build.  http://blog.kmckk.com/archives/2223793.html  Net-installing Debian on QEMU  Don't use obsolete installer.  http://blog.kmckk.com/archives/2233167.html Kyoto Microcomputer Co., Ltd. 22
  • 23. Practice #2  Rebuilding kernel from Debian source package  Get the source package and extract and patch it on ARM QEMU.  Do compiling on PC Linux.  QEMU system emulator is too slow to compile kernel.  http://blog.kmckk.com/archives/2237994.html
  • 24. Practice #3  How to setup NFS server for QEMU  Need ”insecure” option for NFS because QEMU redirect NFS port.  http://blog.kmckk.com/archives/2257952.html Kyoto Microcomputer Co., Ltd. 24
  • 25. Practice #4  Booting Debian in NFS root on ARM QEMU  Booting from NFS root is good for early-stage developing.  You can read/write target file system any time.  You can boot kernel before implementing storage device.  You don't have to care about size of storage.  http://blog.kmckk.com/archives/2257962.html
  • 26. Practice #5  Build latest kernel in kernel.org and try SMP mode  Finally the latest kernel successfully ran.  versatile_defconfig remains old. It need updated.  You can try another virtual board easily on QEMU.  SMP implementation of QEMU is just simple and can not run fast.  http://blog.kmckk.com/archives/2333826.html
  • 27. Practice #6  Try ARM Ubuntu using QEMU  Ubuntu 9.04 is built for ARMv5TE.  Ubuntu 9.10, ARMv6.  Ubuntu 10.04, ARMv7 Thumb2.  Debian, ARMv4T  Rootstock script is nice and easy to build Ubuntu root file system.  http://blog.kmckk.com/archives/2339128.html
  • 28. Practice #7  Using debugger with QEMU  Dive into QEMU itself using gdb.  Connect gdb to target machine of QEMU.  Debug both the target and QEMU itself using 2 gdbs.  Another debugger for QEMU.  http://blog.kmckk.com/archives/2363473.html
  • 29. Other topics  TCG and QEMU internals  http://blog.kmckk.com/archives/2067157.html  http://blog.kmckk.com/archives/2067178.html  http://blog.kmckk.com/archives/2067210.html  Using user mode emulation of QEMU + binfmt + chroot to self-build  http://blog.kmckk.com/archives/2342452.html Kyoto Microcomputer Co., Ltd. 29
  • 30. Q&A  & Demo Thank you for listening! Any comments to blogs are welcome. Kyoto Microcomputer Co., Ltd. 30
  • 31. One more thing ... KMC PARTNER debugger for QEMU Breaking at do_execve in linux kernel running on Android emulator. Kyoto Microcomputer Co., Ltd. 31