Re: Building Yocto on M1 Mac
Robert Joslyn
On Feb 13, 2022, at 6:56 AM, Abhijeet Tripathi <abhijeettripathi3003@...> wrote:A Dockerfile like this works for me: FROM ubuntu:20.04 ARG DEBIAN_FRONTEND=noninteractive ENV LANG=en_US.UTF-8 RUN apt-get update \ && apt-get -y install \ locales \ sudo \ vim-tiny \ && sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \ && locale-gen \ && apt-get -y install \ binutils \ build-essential \ chrpath \ cpio \ diffstat \ gawk \ git \ lz4 \ python3 \ python3-distutils \ wget \ zstd \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -G sudo --uid=1000 -s /bin/bash yocto RUN install -d -o yocto -g yocto /yocto USER yocto Save that to a file called “Dockerfile”. You can build a container called “yocto” with: docker build -t yocto . You can run this with something like: docker run —rm —mount type=volume,src=yocto,dst=/yocto -it yocto Once in the container, go to /yocto to do work within a Docker volume. I have an M1 MacBook Air and can use this container to run builds. As others have said, it’s not fast, but it does work if it’s what you have. Normally I don’t do builds on the MacBook, I usually ssh into my Linux desktop and do my work there. You got me curious though, so I did a quick comparison of building on my MacBook Air and my desktop. Using the container built with that Dockerfile, I ran this sequence (the download is separate to avoid download time, which is highly variable): git clone https://git.yoctoproject.org/poky.git -b honister cd poky . oe-init-build-env bitbake core-image-minimal —runonly=fetch rm -rf tmp/ sstate-cache/ time bitbake core-image-minimal On my 2020 M1 MacBook Air (8 cores, 16 GB RAM, docker using 8 cores and 8 GB), the build took 84 minutes. My desktop with an AMD Ryzen 9 3950X (16 cores, 64 GB RAM) it takes 21 minutes. Docker performance has always been bad for me on MacOS, so it wouldn’t surprise me if it’s faster to use a normal VM than docker (which uses a VM internally too). Robert |
|