Anonymous user
Go Bare Bones: Difference between revisions
no edit summary
[unchecked revision] | [unchecked revision] |
mNo edit summary |
No edit summary |
||
Line 12:
:''Main article: [[GCC Cross-Compiler]], [[Why do I need a Cross Compiler?]]
The first thing you should do is set up a
So instead of using: <source lang="bash">../gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers</source> We use: <source lang="bash">../gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++,go --without-headers</source>
Line 229:
Compile using: <source lang="bash">i686-elf-gccgo -static -Werror -nostdlib -nostartfiles -nodefaultlibs -c terminal.go -o terminal.go.o</source>
== How imported packages are found ==
When you import a package with gccgo it will look for the import data in the following files and will use the first one it finds.
*
*
*
*
== Writing a kernel in Go ==
Now we create the file kernel.go that
<source lang="go">package kernel
Line 316 ⟶ 318:
<source lang="bash">i686-elf-gcc -T linker.ld -o myos.bin -ffreestanding -O2 -nostdlib boot.o terminal.go.o kernel.go.o -lgcc</source>
The file myos.bin is now your kernel. Note that we are linking against [[libgcc]], which implements various
== Testing your operating system (QEMU) ==
Virtual Machines are very useful for
QEMU supports booting multiboot kernels directly without using a bootable medium:
|