Commit f06333e
committed
WIP: build Linux on MacOS
I just built the ARCH=arm64 defconfig Linux kernel on MacOS Monterey
12.5.1!
$ make LLVM=1 -j8
Hacked up patch for now, will need to clean these up and break them up
into individual patches before sending.
Issues Encountered:
1. SUBARCH defaults to arm rather than arm64; fix regex in
scripts/subarch.include.
2. MacOS doesn't distribute elf.h and neither does Homebrew. I used
gelf.h from libelf from Homebrew, but then had to muck up a bunch of
build flags to invoke pkg-config via HOSTPKG_CONFIG. I think a better
approach would be just to include a minimal elf.h in the kernel
sources for MacOS hosts, similar to
https://gist.github.com/mlafeldt/3885346 but smaller.
3. MacOS doesn't distribute endian.h. I used a combination of
machine/endian.h and https://gist.github.com/yinyin/2027912, but
probably should include a minimal copy in kernel sources similar to
elf.h above.
4. pkg-config doesn't detect libcrypto from openssl from HomeBrew
because MacOS uses LibreSSL or something. brew install openssl prints
a warning about it.
5. MacOS' FORTIFY_SOURCE implementation seems broken wrt.
scripts/mod/file2alias.c.
6. MacOS sys/types.h defines uuid_t, which conflicts with
scripts/mod/file2alias.c.
For the build, I built the following from source:
1. clang
2. lld
3. llvm-nm
4. llvm-objcopy
5. llvm-objdump
6. llvm-strip
From Homebrew I needed to install:
1. libelf (probably not necessary)
2. pkg-config
3. bash (the one that ships with macos is too old, doesn't understand
lastpipe)
4. md5sha1sum
5. openssl
Before all of the above I needed to create a case-sensitive volume to
check out the kernel sources.
It probably wouldn't hurt to add the above to some documentation.
Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>1 parent f76349c commit f06333e
17 files changed
Lines changed: 40 additions & 9 deletions
File tree
- arch
- arm64
- kernel/vdso32
- kvm/hyp/nvhe
- arm/vdso
- certs
- scripts
- mod
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
| 388 | + | |
388 | 389 | | |
389 | 390 | | |
390 | 391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
88 | 90 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
6 | 12 | | |
7 | 13 | | |
8 | 14 | | |
| |||
0 commit comments