> On Feb 13, 2022, at 6:56 AM, Abhijeet Tripathi
> <[email protected]> wrote:
>
>
> On Sun, Feb 13, 2022 at 7:09 PM Anders Montonen <[email protected]>
> wrote:
> Hi,
>
>> On 13 Feb 2022, at 14:24, Abhijeet Tripathi <[email protected]>
>> wrote:
>>
>> Hello yocto-devs,
>>
>> I'm new to the yocto project and trying to set up a build environment on my
>> M1 Mac which is arm64 architecture.
>>
>> I'm following the steps as mentioned in below link:
>> https://github.com/crops/docker-win-mac-docs/wiki/Mac-Instructions
>>
>> But it is always pulling up containers based on amd64 architecture. Are
>> there any updated steps/link to set up a build environment specific to M1
>> Mac(arm64)?
>
> Looking at Docker Hub, none of the published Crops containers are built for
> ARM64. You can try building the containers yourself, making sure to pick base
> distros that are available for ARM64.
>
> Note that there are plenty of reports of Docker performing poorly on Macs,
> probably because of the file system implementation. You may be better off
> using a full VM via e.g. UTM.
>
> I initially started with UTM but the problem with virtual machines is that we
> can only use half the resources of the machine.
> This makes the builds slower, so I was looking at the container way.
>
> Can you point me to any documentation which I can use to build customized
> containers for yocto builds?
>
> Thanks,
> Abhijeet
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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#56179): https://lists.yoctoproject.org/g/yocto/message/56179
Mute This Topic: https://lists.yoctoproject.org/mt/89112092/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-