SlideShare une entreprise Scribd logo
1  sur  31
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

How to Choose a Software Update Mechanism for Embedded Linux Devices
How to Choose a Software Update Mechanism for Embedded Linux DevicesHow to Choose a Software Update Mechanism for Embedded Linux Devices
How to Choose a Software Update Mechanism for Embedded Linux Devices
Leon Anavi
 

Tendances (20)

BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
Software update for IoT: the current state of play
Software update for IoT: the current state of playSoftware update for IoT: the current state of play
Software update for IoT: the current state of play
 
Stefano Cordibella - An introduction to Yocto Project
Stefano Cordibella - An introduction to Yocto ProjectStefano Cordibella - An introduction to Yocto Project
Stefano Cordibella - An introduction to Yocto Project
 
QEMU - Binary Translation
QEMU - Binary Translation QEMU - Binary Translation
QEMU - Binary Translation
 
Qemu
QemuQemu
Qemu
 
root権限無しでKubernetesを動かす
root権限無しでKubernetesを動かす root権限無しでKubernetesを動かす
root権限無しでKubernetesを動かす
 
LCA14: LCA14-502: The way to a generic TrustZone® solution
LCA14: LCA14-502: The way to a generic TrustZone® solutionLCA14: LCA14-502: The way to a generic TrustZone® solution
LCA14: LCA14-502: The way to a generic TrustZone® solution
 
Yocto Project introduction
Yocto Project introductionYocto Project introduction
Yocto Project introduction
 
Git超入門(ハンズオン).pdf
Git超入門(ハンズオン).pdfGit超入門(ハンズオン).pdf
Git超入門(ハンズオン).pdf
 
Linux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platformLinux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platform
 
ElixirでFPGAを設計する
ElixirでFPGAを設計するElixirでFPGAを設計する
ElixirでFPGAを設計する
 
Introduction to yocto
Introduction to yoctoIntroduction to yocto
Introduction to yocto
 
TFLite NNAPI and GPU Delegates
TFLite NNAPI and GPU DelegatesTFLite NNAPI and GPU Delegates
TFLite NNAPI and GPU Delegates
 
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily JobLuca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
Luca Ceresoli - Buildroot vs Yocto: Differences for Your Daily Job
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
 
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsShorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation Systems
 
U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
 
YoctoをつかったDistroの作り方とハマり方
YoctoをつかったDistroの作り方とハマり方YoctoをつかったDistroの作り方とハマり方
YoctoをつかったDistroの作り方とハマり方
 
How to Choose a Software Update Mechanism for Embedded Linux Devices
How to Choose a Software Update Mechanism for Embedded Linux DevicesHow to Choose a Software Update Mechanism for Embedded Linux Devices
How to Choose a Software Update Mechanism for Embedded Linux Devices
 
ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!ARM Trusted FirmwareのBL31を単体で使う!
ARM Trusted FirmwareのBL31を単体で使う!
 

En vedette

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
 

En vedette (11)

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
 
Basic of virtual memory of Linux
Basic of virtual memory of LinuxBasic of virtual memory of Linux
Basic of virtual memory of Linux
 
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?
 

Similaire à Using QEMU for cross development

Similaire à 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
 
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
 
淺談 Live patching technology
淺談 Live patching technology淺談 Live patching technology
淺談 Live patching technology
 

Plus 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
 

Plus 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
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

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