6 ms·
How to run FreeBSD 13 in QEMU on Apple Silicon Mac
- codetrotter 6y agoRemember to star the gist if it is helpful to you ;)
- MaxBarraclough 6y agoThe FAQ asks you not to ask for upvotes. https://news.ycombinator.com/newsfaq.html https://news.ycombinator.com/newsfaq.html
- codetrotter 6y agoI’m not asking for upvotes. I am saying to star it on GitHub if it is useful. GitHub stars and HN upvotes are two different unrelated things.
- ivanstegic 6y agoSmash that like button! Subscribe!
- codetrotter 6y agoWhat I have come to realize is that the default action for people online, including myself, is often to read/watch and move on. A gentle reminder to give a signal back will push some people to take the time to do so.
- anotherhue 6y agoBeware a slow burning Time of Check to Time of Use attack. What you like/star today may change tomorrow, but your public association with it will remain.
- codetrotter 6y agoNot sure I follow what you mean.
- vijayr02 6y agoNot OP, but as an example: get lots of 5 star reviews for a genuinely useful product and then on sell the listing to a shady seller. I guess OP is thinking of an even more high profile issue (exaggerated example: you donate to a charity that espouses human rights and it later pivots to genocide - your reputation is toast now).
- codetrotter 6y agoI see. I think this will always be a potential problem indeed. And there is no simple solution to it. I used to have a friend who turned out to be very different from what I had thought. And she started interpreting stuff that I had posted to my Facebook in all sorts of... well frankly crazy ways. And she turned really unpleasant, and I ended up blocking her across all channels where she was contacting me. So I know first hand what it is like to be treated in a very hostile manner by someone. I still think about that sometimes. And I think of people who have not just one person turn against them but whole groups of people turn against them. And I don’t have an answer for what to do about it. But my current thinking is that we should live our lives as we see fit and not be deterred by anyone who has the wrong picture and who insists on holding on to that picture. And to instead focus as much as possible on the people that you have healthy interactions with. What that means is, to be open for new things and new ideas still, and engaging in discussion, but if you encounter someone who is too antagonistic, stop interacting with them. So in the example of having associated with a project or organization or group or something, that is taken over and changes into something bad, disassociate from them when you are made aware of it, and to anyone that asks about it say as it is that they weren’t like that before and that you have left them. Anyone that continues to insist that you have ties to something you don’t, cut off contact. Don’t try to defend against them or anything. But like I said, for people that have a whole group of people turn on them I don’t know what they should do.
- 6y ago
- protomyth 6y agoI would love the origin person of that phrase because it is almost universal with YouTubers.
- smarx007 6y agoNow, I am really curious why would it be of any value (putting aside the HN policy discouraging it) to anyone. I understand that GH repo stars help project visibility and may be good on CV but gists?
- codetrotter 6y agoI use the number of stars as a measure for how much the guide is of use to people. If it’s not useful to anyone then I know not to spend time on that. Short though as the guide is, and even though it is based on much hard work of others, it still took time to make, much in part because when I write stuff like this I spend a lot of time actually redoing steps to ensure to the best of my ability that what I am writing will work for others too. So I like to know that people find it useful.
- llarsson 6y agoSo you wrote it just for GitHub stars? Not because it was useful to yourself?
- codetrotter 6y agoThe motivation to run FreeBSD in a VM on my M1 MBP comes from being an active user of FreeBSD for a long time. For example my mail, web and VPN server runs FreeBSD. And I have been running FreeBSD both on desktops and laptops for a long time as well. The motivation to make a guide for others to follow is that it should be useful for others too. What I am saying is, when it’s useful for others it’s worth spending the time on writing up how to do it and share it with others.
- ontouchstart 6y agoYou definitely got my attention so I bookmarked you as a comment here so I can find your post later myself. https://news.ycombinator.com/from?site=gist.github.com https://news.ycombinator.com/from?site=gist.github.com Learn to live in attention economy with HTTP.
- tbrock 6y agoDoes setting CPU to cortex-a72 mean that it runs natively on the m1 or with minimal translation?
- pm215 6y agoThe command line argument that means 'run natively' is the "-accel hvf" one, which makes QEMU use the Hypervisor.framework macOS APIs. (This is why you have to use an out-of-tree patchset at the moment -- mainline QEMU only supports hvf on x86 CPUs right now.) The hvf support patches don't make any attempt to make the guest CPU report different ID values or features, so regardless of what actual cpu type you ask for with -cpu the guest sees whatever the host CPU is.
- u678u 6y agoI've spent way too long getting VMs to work on various platforms. I hate paying for software but does vmware make it a lot easier? It sucks to use free OSs, but then pay to virtualize.
- mobilemidget 6y agoyes certainly would suck to pay, because in the end VMWare isn't issue free either.
- pimeys 6y agoNext thing: run FreeBSD 13 natively on M1. It would be really nice, because even on this X230 this OS is really damn fast and snappy. Wayland and sway are super nice.
- codetrotter 6y agoOh yes, that would be so good. I hope to see the Linux on M1 project work out, and that the learnings from those people could enable running FreeBSD natively on M1 too!
- jamesfmilne 6y agoSomeone is working on getting OpenBSD running on Apple M1, I would imagine their work would be useful to assist porting FreeBSD too: https://twitter.com/bluerise/status/1354216838406823936 https://twitter.com/bluerise/status/1354216838406823936
- webmobdev 6y agoDoubt if that will ever happen as even older Intel Mac Minis still have issues running FreeBSD - https://wiki.freebsd.org/IntelMacMini https://wiki.freebsd.org/IntelMacMini
- tyingq 6y agoThere's 5 open PRs. Two seem to be boot related, which probably wouldn't apply to the M1. The Xorg one and the drm one are related to an Intel integrated GPU. That leaves just the firewire one as possibly an issue. Though I get the general point that hardware drivers could be an issue. Perhaps, though, the upside of the M1 is sufficient incentive for people to figure it out.
- pimeys 6y agoMaybe Apple does a favor for us and releases docs for their hardware, so it would be easier to write drivers for the open source operating systems. That would be the best news for 2021.
- sarusso 6y agoHave you run any performance benchmarks?
- kristiandupont 6y agoI am running an ARM Ubuntu server in QEMU. SSH'ing to that gives me a complete dev environment that so far seems to work flawlessly. I guess it's slower than if I was running things natively but on the other hand, I get seamless Docker support and it's still significantly snappier than my semi-beefy PC (and this is the Air). https://twitter.com/kristiandupont/status/1353438638290333697 https://twitter.com/kristiandupont/status/135343863829033369...
- drewg123 6y agoI needed a FreeBSD/arm64 box, and so I did something similar a few weeks ago based on instructions for running Windows ARM64 on M1. The issue that I have is that the VM burns tons of battery even when idle. It was explained to me that there are 2 different instructions on ARM to say "i'm idle, wake me up if something happens" (like x86 mwait), and Apple M1 uses one, while everybody else uses the other. Is this fixed in either FreeBSD or Qemu at this point? BTW, I'm super impressed that a 4-core VM on my M1 13" MBP can build world in about 130% of the time of a 32-core Ampere EMAG.
- tyingq 6y ago"it was explained to me that there are 2 different instructions on ARM to say "i'm idle, wake me up if something happens" (like x86 mwait), and Apple M1 uses one, while everybody else uses the other." That had me curious, so I searched around a bit. And I found one QEMU patch that seems like the right one: https://patchew.org/QEMU/20210120224444.71840-1-agraf@csgraf.de/20210120224444.71840-10-agraf@csgraf.de/ https://patchew.org/QEMU/20210120224444.71840-1-agraf@csgraf... This appears to be his latest/greatest bundle: https://patchew.org/QEMU/20210120224444.71840-1-agraf@csgraf.de/ https://patchew.org/QEMU/20210120224444.71840-1-agraf@csgraf...
- floatboth 6y ago> can build world in about 130% of the time of a 32-core Ampere EMAG This says more about the eMAG than the M1, to be honest :D The APM X-Gene derived cores in the eMAG are far behind current cores from everyone else. The new Ampere Altra is using stock Arm Neoverse cores. (Which makes me wonder if all they got out of the APM acquisition was just one dead-end generation of product…) > Is this fixed in either FreeBSD or Qemu at this point? Not in FreeBSD for sure, as an obsessive commit watcher I can say I haven't seen any M1 quirks land. > 2 different instructions on ARM to say "i'm idle, wake me up if something happens" (like x86 mwait), and Apple M1 uses one, while everybody else uses the other Everybody should use both in different circumstances: https://community.arm.com/developer/ip-products/processors/f/cortex-a-forum/5695/difference-between-wfi-and-wfe https://community.arm.com/developer/ip-products/processors/f... But according to Corellium's Linux work "the CPU tends to lose state" when using WFI for system idle: https://github.com/corellium/linux-m1/commit/b8ecd5924678f1c04bf1e5b0b7d8996285da06ba#diff-8eb78bad8526b19aa333cb00a0da1b0090f023d80f6b707975f5fbf641b16a49R133-R139 https://github.com/corellium/linux-m1/commit/b8ecd5924678f1c... Not sure why this would have an impact on VM idling… (upd: yeah it's QEMU-side stuff, see other comments)
- gardaani 6y agoLinux can be run on Virtualization.framework on Mac M1 without qemu [1]. Would it be possible to run FreeBSD similarly without qemu? [1] https://github.com/evansm7/vftool https://github.com/evansm7/vftool
- codetrotter 6y agoWhen I went on my quest to run FreeBSD on my M1, I was originally looking at tools like the one you link. As far as I could tell, the Virtualization framework is Linux specific(?) https://developer.apple.com/documentation/virtualization https://developer.apple.com/documentation/virtualization And in the guide in the OP, we are using some patches that someone wrote so that QEMU uses the Hypervisor framework. https://developer.apple.com/documentation/hypervisor https://developer.apple.com/documentation/hypervisor And from what I understand but please correct me if I am wrong, the Virtualization framework is actually a layer on top of the Hypervisor framework. So if I am correct in my understanding the way that the QEMU patches do it should in theory be comparable in performance to the way that the Virtualization framework does it. I would like to do some benchmarking of Linux on the Virtualization framework versus Linux on QEMU to see if there is a difference. However, good benchmarking is no easy feat. So ideally someone else who is really good at benchmarking Linux would do this and write about it.
- my123 6y agoYes, Virtualization.framework's XPC service (because VM is out-of-process there) is implemented on top of Hypervisor.framework.