Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support build_system.sh on M1 Mac #29

Closed
wants to merge 7 commits into from
Closed

Conversation

kfatehi
Copy link

@kfatehi kfatehi commented Dec 24, 2021

This PR only focuses on build_system.sh

build_system.sh

The existing check (uname -p) does not work. the check I added (uname -m) might be sufficient for whatever environment warranted the addition of the first, but for now, this PR adds a check for M1 which works.

keyvan@Keyvans-MacBook-Air ~ % uname -p
arm
keyvan@Keyvans-MacBook-Air ~ % uname -m
arm64

The actual run of build_system ended for me on:

Creating empty filesystem
./build_system.sh: line 41: fallocate: command not found

So then I made the next commit which creates the empty filesystem inside the docker container.

Here I also removed the /dev/null piping so that in case the thing is giving feedback or asking if you want to overwrite the user isn't stuck wondering what's going on.

Then we get stuck at:

Mounting empty filesystem
umount: illegal option -- l
usage: umount [-fv] [-t fstypelist] special | node
       umount -a[fv] [-h host] [-t fstypelist]
mount: You must specify a filesystem type with -t.

Because the BSD/Mac umount does not have a -l (show labels). It's at this point I realized probably the rest of the work needs to happen in a container anyway because we lack most of these subsequent disk mounting commands....

So that is what I did in the remainder of the script and it seems to have worked.

image

@kfatehi kfatehi marked this pull request as ready for review December 24, 2021 06:16
@kfatehi kfatehi changed the title *WIP* Support building on M1 Mac Support build_system.sh on M1 Mac Dec 24, 2021
@robbederks
Copy link
Contributor

Are you sure the image works? 4.3MB (in your screenshot) seems a bit small for the system partition 😅

@kfatehi
Copy link
Author

kfatehi commented Dec 24, 2021

Are you sure the image works? 4.3MB (in your screenshot) seems a bit small for the system partition 😅

Haha no definitely not. It takes around a day or two to build on my 16 core amd64 machine. I turned off buildkit which is on by default in Mac and has other issues, so I think that might have been the problem. With it off, it's taking much longer so we'll see if it worked

Edit had nothing to do with buildkit (although buildkit being on is problematic in other ways, like you cannot use docker commands over ssh), i found my bug in the commit that follows this comment. The problem was that I was mounting the file in the container, so in order for the contents to populate the image file, I have to do that operation within the helper container so that the mount driver (?) knows where to route writes to; doing it outside of the helper of course fails because the host is unaware of the mount.

@kfatehi
Copy link
Author

kfatehi commented Dec 24, 2021

Updated the screenshot which now shows proper size. Should be good to test, but I don't want to mess up my current tici so I have not tried to flash it and find out.

@kfatehi
Copy link
Author

kfatehi commented Dec 25, 2021

Here's a build on linux/amd64 on this branch. Not sure why there is a size difference.

image

@adeebshihadeh
Copy link
Contributor

M1 should be supported now. Did a bunch of the production AGNOS builds with a mac mini.

@kfatehi kfatehi deleted the m1 branch July 2, 2023 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants