You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fdefdf1
Browse filesBrowse the repository at this point in the historyBrowse files
* feat: userland is bin crate; awkernel is lib crate
* feat(x86): compile mpboot with kernel/build.rs
* Add template external userland as example
* feat(aarch64): add assembly via global_asm!
* feat(userland_extern): add support for Aarch64
Applications can use `awkernel_async_lib`, `awkernel_lib`, and `awkernel_drivers`.
@@ -95,7 +98,6 @@ etc
95
98
### x86_64
96
99
97
100
```text
98
-
$ make kernel/asm/x86
99
101
$ cargo doc_x86
100
102
$ ls target/x86_64-kernel/doc/awkernel/index.html
101
103
$ ls target/aarch64-kernel/doc/awkernel_lib/index.html
@@ -120,28 +122,29 @@ Debug build.
120
122
$ make x86_64
121
123
```
122
124
123
-
#### Developing for x86_64 on macOS
125
+
#### Building x86_64 on Apple Silicon (or another non-x86_64 host)
124
126
125
-
`kernel/asm/x86/mpboot.S` mixes 16/32/64-bit code and needs a real GNU assembler and linker.
126
-
By default, Apple systems provide an alias so `gcc` points to `clang`.
127
-
Also, modern Apple Silicon processors are aarch64.
128
-
Therefore, we must install a GNU x86_64 ELF cross toolchain:
127
+
The x86_64 build includes `kernel/asm/x86/mpboot.S`, an assembly file that mixes 16-, 32-, and 64-bit code. The build script assembles and links it with GNU tools, then uses `objcopy` to create a binary image. A Rust target alone does not provide these tools.
128
+
129
+
On Apple Silicon, install an x86_64 ELF GNU toolchain:
129
130
130
131
```text
131
132
$ brew install x86_64-elf-gcc x86_64-elf-binutils
132
133
```
133
134
134
-
Then, when building your application, point to this specific cross toolchain:
135
+
The build script automatically uses the `x86_64-elf-` tool prefix if `x86_64-elf-gcc` is available. Otherwise, it tries the host tools (`gcc`, `ld`, and `objcopy`), which may not support this build on a non-x86_64 host.
136
+
137
+
To select a toolchain with a different prefix, pass that prefix as `CROSS_COMPILE`. For example, if its tools are named `my-x86_64-elf-gcc`, `my-x86_64-elf-ld`, and `my-x86_64-elf-objcopy`, run:
135
138
136
139
```text
137
-
$ make x86_64 RELEASE=1 CROSS_COMPILE=x86_64-elf-
140
+
$ make x86_64 RELEASE=1 CROSS_COMPILE=my-x86_64-elf-
138
141
```
139
142
140
143
> [!IMPORTANT]
141
144
>
142
-
> Do not remove the trailing `-`
143
-
144
-
This way, Awkernel will use the `x86_64-elf-gcc` compiler and the `x86_64-elf-ld` linker.
145
+
> `CROSS_COMPILE` is a prefix, not a path to the compiler. Keep the trailing `-` so the build can append `gcc`, `ld`, and `objcopy` to it.
146
+
>
147
+
> For example, `CROSS_COMPILE=x86_64-elf-` selects `x86_64-elf-gcc`, `x86_64-elf-ld`, and `x86_64-elf-objcopy`.
0 commit comments