Home Building Yocto images with the new Apple M1
Post
Cancel

Building Yocto images with the new Apple M1

Intro

Hello fellow Yocto engineers 🙂

I guess, you already know that this new Apple M1 SoC has shaken the IT world. Well, this is not another post for praising Apple for its new SoC. There was already a lot of praising in the media and especially from consumers that after having ARM processors to their mobiles, tablets, routers and TV boxes, now they will get them also to their laptops and their desktops.

The M1 is great and blah, blah, blah… but can it run Crisis? Eh.. I mean, Yocto?

Let’s find out…

The challengers

I’ve done my tests in two systems. On the blue corner is my main Linux workstation that I’m using for almost everything and its specs are:

  • Ryzen 7 2700X with 8C/16T @ 4GHz (overclocked)
  • 32GB DDR4 - 3200MHz
  • 1TB EVO 960 nvme
  • NVidia RTX2060 Super
  • Ubuntu 20.04.2 LTS

On the red corner is a 13 “ Apple MacBook Air (MBA) with the following specs:

  • M1, 2020 SoC with 8 cores @ 3.2GHz
  • 16GB RAM
  • 1TB SSD
  • macOS Big Sur 11.2.3

How to Yocto with the M1?

Well, for the Linux box there’s no much things to say. I’m just using either a docker image or Ubuntu itself to build images. I haven’t seen any difference in using those two different options, so the speed is almost exactly the same which is expected as docker in Linux is running native without any hypervisor in between.

But, how can the MBA build a Yocto image? That’s easy. Using virtualization, of course. And specifically using Parallels. Probably some of you already nod with disappointment, but wait for the results.

In case of parallels, there are a few images that you can use for free and Ubuntu 20.04 is one of them. Therefore, in just a few minutes I had a VM running and ready to build Yocto images. After doing all the needed updated I’ve compared the two Ubuntu versions and these are the results.

Ryzen Ubuntu Parallels Ubuntu
Version 20.04.2 LTS 20.04.2 LTS
Kernel 5.9.10-050910 5.4.0-66-generic

As you can see both Ubuntu versions are the same, but I’m using a newer kernel on my workstation. I’ve tried to build the same kernel for Parallels but although I succeeded, when I’ve tried to boot from that kernel it failed. I guess it needs some customization in order to boot with Parallels. Didn’t spend more time on it.

Benchmark setup

My benchmark will be my allwinner yocto BSP repo, because I know the ins and outs of this build and I’ve built it dozens of times. For the desktop I’ll build the repo using 8 and 16 threads and in case of MBA I’ll use 8 threads which is the maximum number of cores.

This is the parallels configuration in the MBA:

As you can see I’ve used all 8 cores and only 8GB of RAM. The reason I didn’t use the whole RAM is to get so get a bit similar results with the much cheaper basic version of MBA with 8GB RAM and 256GB SSD.

At this point I need to mention that I’m using the free 14-days trial version of Parallels, which means that I can use all the 8 cores, but after the trial expires only the 4 cores can be used in the standard version and only the pro version can utilize all cores. I’ll explain those things later in more detail, though.

The commands I’ve used for all tests are the following:

```sh mkdir allwinner cd allwinner mkdir sources cd sources git clone https://gitlab.com/dimtass/meta-allwinner-hx.git git clone –depth 1 -b dunfell https://git.yoctoproject.org/git/poky git clone –depth 1 -b dunfell https://github.com/openembedded/meta-openembedded.git cd .. DISTRO=allwinner-distro-console MACHINE=nanopi-k1-plus source ./setup-environment.sh build time bitbake allwinner-console-image

Actually, I’ve build the image twice and I’ve only benchmarked the second build. The reason I did that is because I wanted the first run to download all the needed packages. Then I’ve deleted the build folder which also includes the sstate-cache and then re-build the image having the packages already in the download folder.

In case of MBA I’ve ran three builds, one while it was connected to the mains power and working at the same time while having 2 chrome instances with 24 tabs opened in total, MS Teams, an email client, VS Code, iterm2 with 3 ssh sessions and slack. All at the same time. The second time while it was connected to mains power and without any additional workload and the third time while it was running on battery without any additional workload.

Finally, in case of the Ryzen workstation to change the number of threads I’ve edited the build/conf/local.conf file before the build. I’ve also made sure that all 8 cores are used in MBA as you can see here:

Results

First I’ll add the screenshots of the results and then I’ll list them in a table. These are the screenshots (click on them to enlarge):

This post is licensed under CC BY 4.0 by the author.

Nanopi-R4S benchmarks with networking optimizations

Moving from Wordpress to Jekyll

Comments powered by Disqus.