Home > Workshops >

Using QEMU to Get Started with Embedded Linux

Mohammed Billoo - Watch Now - Duration: 01:55:00

Using QEMU to Get Started with Embedded Linux
Mohammed Billoo

Getting started with embedded Linux can be a daunting task due to the inherent complexity of the Linux kernel; it can also be costly, since generally any sort of driver development and testing requires hardware. QEMU can serve as an alternative to allow engineers to get started with embedded Linux with minimal cost.

In this workshop, Mohammed Billoo will walk through what QEMU is and the different workflows that it enables, with hands-on demonstrations that attendees can follow along. Demonstrations will include setting up QEMU to emulate an ARM-based machine on a x86-based host PC and launching into a terminal, using QEMU to step through the Linux kernel, and developing and testing a simple device driver with device emulation in QEMU.

This workshop has the following prerequisites:

  1. Install Ubuntu >= 18.04 on your PC (either on bare-metal or as a VM):
  2. Install qemu-system-arm (sudo apt-get install qemu-system-arm)
  3. Install your favorite text editor (e.g. nano, vim)
  4. Clone the buildroot repository on your Ubuntu installation by executing the following from the command line:    $> git clone git://git.buildroot.net/buildroot
  5. Clone the qemu repository on your Ubuntu installation by executing the following from the command line: $> git clone --depth 1 --branch v6.2.0 https://github.com/qemu/qemu.git
  6. Clone the Linux kernel repository on your Ubuntu installation by executing the following from the command line:  $> git clone --depth 1 --branch v5.17 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

M↓ MARKDOWN HELP
italicssurround text with
*asterisks*
boldsurround text with
**two asterisks**
hyperlink
[hyperlink](https://example.com)
or just a bare URL
code
surround text with
`backticks`
strikethroughsurround text with
~~two tilde characters~~
quote
prefix with
>

Tobi_Lifschitz
Score: 0 | 3 weeks ago | 1 reply

Hi Mohammed, thank you for the workshop. What benefits would you say using QEMU has, compared to using a development board to start developing a project, if cost is not a problem? Also, based on your experience, does it makes sense to use QEMU in more complex or simpler projects?

mabSpeaker
Score: 0 | 3 weeks ago | no reply

Hi,
Excellent questions! Usually, I use QEMU to test out a driver if I'm running into hardware issues on a custom board, or when I'm waiting for a component/part to arrive. When using a development board, the latter may be more of a reason to use QEMU. I would say it makes more sense to use QEMU for simpler projects, or tasks that are pretty localized, such as when working on a specific driver, kernel module, or kernel feature.

dcomer
Score: 0 | 3 weeks ago | 1 reply

I did not see the setup instructions. Where are they please?

KeithH_TX
Score: 0 | 3 weeks ago | no reply

Click into the [Abstract] tab above. see: This workshop has the following prerequisites:

Install Ubuntu >= 18.04 on your PC (either on bare-metal or as a VM):
Install qemu-system-arm (sudo apt-get install qemu-system-arm)
Install your favorite text editor (e.g. nano, vim)
Clone the buildroot repository on your Ubuntu installation by executing the following from the command line: $> git clone git://git.buildroot.net/buildroot
Clone the qemu repository on your Ubuntu installation by executing the following from the command line: $> git clone --depth 1 --branch v6.2.0 https://github.com/qemu/qemu.git
Clone the Linux kernel repository on your Ubuntu installation by executing the following from the command line: $> git clone --depth 1 --branch v5.17 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

dcomer
Score: 0 | 3 weeks ago | no reply

Never mind... :(

15:42:54	 From  Prasanna : Hi, Glad to be here. Can someone post instructions/pre-requisite to be setup if any? I didn't get any instructions through email.
15:43:21	 From  Keith Hill : This workshop has the following prerequisites:

Install Ubuntu >= 18.04 on your PC (either on bare-metal or as a VM):
Install qemu-system-arm (sudo apt-get install qemu-system-arm)
Install your favorite text editor (e.g. nano, vim)
Clone the buildroot repository on your Ubuntu installation by executing the following from the command line:    $> git clone git://git.buildroot.net/buildroot
Clone the qemu repository on your Ubuntu installation by executing the following from the command line: $> git clone --depth 1 --branch v6.2.0 https://github.com/qemu/qemu.git
Clone the Linux kernel repository on your Ubuntu installation by executing the following from the command line:  $> git clone --depth 1 --branch v5.17 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
15:43:22	 From  Charles Miller : Look in the Abstract for the talk, @Prasanna.
15:43:56	 From  Jacob Beningo : The link to the abstract is at: https://embeddedonlineconference.com/workshop/Using_QEMU_to_Get_Started_with_Embedded_Linux
15:44:03	 From  Jacob Beningo : Thanks Keith for posting the details
15:44:20	 From  Prasanna : Thank you.
15:45:59	 From  Haroldo : Would I be able to follow the workshop if I'm running 20.04 Ubuntu?
15:46:16	 From  Haroldo : Thanks
15:50:42	 From  Leandro Pérez : QEMU permit simulate ARM-M architectures?
15:57:52	 From  Leandro Pérez : amazing
16:01:51	 From  Burak ŞEKER : can QEMU be used to simulate ARM Cortex A architectures? Cortex A9 for instance?
16:02:05	 From  Burak ŞEKER : thanks a lot
16:05:15	 From  Mohammed Billoo : $> wget https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabi/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi.tar.xz

$> tar xvf gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi.tar.xz
16:05:29	 From  Keith Hill : Could I also use the yocto poky_sdk cross tools I already have installed?
16:06:00	 From  Keith Hill : its Gcc 7.5.0
16:06:28	 From  Aditya S : could you increase the size please?
16:06:29	 From  Haroldo : It is a bit small
16:06:59	 From  Burak ŞEKER : better
16:07:02	 From  Dave Comer : bigger
16:07:05	 From  Mathieu Peterer : It's OK
16:07:05	 From  Aditya S : thanks
16:07:09	 From  Haroldo : thanks
16:07:13	 From  Gabriel Aguilar Lemus : little bigger would be great, thanks
16:07:15	 From  Dave Comer : yes
16:07:16	 From  Dave Comer : tnx
16:07:18	 From  Tobi Lifschitz : Perfect
16:11:40	 From  Erik : Are the header version and gcc version chosen just to match this specific linaro toolchain build?
16:11:40	 From  Mathieu Peterer : Hard to navigate that fast menuconfig, would it be possible to post your .config afterwards?
16:12:48	 From  Erik : Are the header version and gcc version chosen just to match this specific linaro toolchain build?
16:12:55	 From  Keith Hill : Are you choosing A9 because you're running on a Mac?
16:15:49	 From  Tobi Lifschitz : Yes please, can you share your .config when you are done so we can follow up?
16:19:16	 From  Prasanna : I had hard time in listening and doing things. What is the recommendation? should i listen and do things later?
16:19:44	 From  Erik : .config file for those that want to follow:  https://pastebin.com/rGiueP7C
16:20:45	 From  Dave Comer : Why did you not use $ARCH?
16:23:12	 From  Erik : What was the Linux ARCH=arm CROSS_COMPILE command from previous step?
16:23:33	 From  Mohammed Billoo : ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make imx_v6_v7_defconfig
16:23:51	 From  Mohammed Billoo : ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make -j12 ==> build the kernel
16:24:51	 From  Michael Kirkhart : It has been awhile since I have had to build embedded linux kernels - this brings back some old memories.
16:32:59	 From  Haroldo : Getting a list of steps and commands used would be great, I'm having a hard time following.
16:36:18	 From  Haroldo : Thanks
16:44:16	 From  Erwin : good to be in 2022, when I build my first kernel it took nearly one day to complete :-)
16:46:01	 From  Prasanna : Just curious what linux your running on your host machine  and How powerful machine it is?
16:56:44	 From  Eric Lundquist : For boards that use u-boot to load the kernel how is that done in QEMU?
16:56:52	 From  Lisa Shi : why the build error did not stop j 12 work?
16:56:59	 From  davis.sebastian : Does Digi uses the same kernel as Sebrilite ?
17:19:50	 From  Erwin : is there a way to easily feed series of data like ADC Emulation?
17:19:57	 From  Keith Hill : What if my processor isn't available in Qemu? (imx8 for example)
17:21:57	 From  Keith Hill : Great; thanks!
17:22:03	 From  Erik : Just curious for your patch: Which imx8 flavor? 8m?
17:22:35	 From  Erik : Awesome.  Thank you.
17:22:41	 From  Dave Comer : Excellent presentation. Re you open for contact vial your linked for questions?
17:24:19	 From  Ramsay Family : What can you do if you want to debug a boot loader? Can you trick it and give the loader image as the OS?
17:25:02	 From  Dave Comer : ?
17:25:27	 From  Ramsay Family : Hehe and blinkys
17:26:16	 From  Ramsay Family : Thank you much!
17:27:17	 From  Haroldo : Thanks
17:27:36	 From  Mark : thanks
17:27:55	 From  Erik : Great job Mohammed, very informative.  Thank you.
17:27:58	 From  Mathieu Peterer : Thx
17:28:02	 From  Lisa Shi : Thanks
17:28:03	 From  Keith Hill : Thanks!

OUR SPONSORS