On Thu, Aug 15, 2013 at 6:11 AM, Ross Schulman <
rsch...@gmail.com> wrote:
> Hi Logan and others.
> I'm in exactly the same boat: interested in developing a hobby kernel in Go
> and wondering what would have to change to get a compiler pointed at
> something like i586-elf is for gcc. It seems obvious that much of the
> runtime (just like much of libc) would not be available in the new
> environment and that it would have to be built back up on the other side,
> but now I'm not even sure that's possible from what people here seem to be
> saying. That would be too bad as it sounds like an interesting project that
> I'd love to collaborate with others on.
The Go compiler/linker generates code that assumes thread local
variables, and those have to live somewhere. I think that is the only
system dependency in the compiler/linker; everything else is in the
runtime. So to get a compiler/linker like i586-elf, pick a TLS
scheme, and you may as well use the one that most ELF systems use. So
in fact the default Go compiler is already pretty much a i586-elf
compiler.
Then you'll need to write key functions like runtime·newosproc and
runtime·SysAlloc for your OS. In general you need to get the runtime
package fully up and running, or you won't be able to do anything.
Once you have runtime you can at least run a hello world program using
the builtin print function. Then you can think about the syscall and
other packages.
Ian
> On Thursday, August 8, 2013 6:45:10 PM UTC-4,
logan.nea...@gmail.com wrote:
>>
>> So, originally I had planned on attempting to write a toy kernel in Go. I
>> wanted to do as much of it as I could in Go and the rest in Assembly and
>> stay away from any C dependencies, if I could. However, to my knowledge, the
>> Tiny Runtime is no longer available. Even if it were, I'm not sure that I've
>> seen any documentation on how to use it.
>>
>> I know that the Tiny runtime was removed because it was taking too much
>> effort to keep it updated with the rest of the language. At least, this was
>> the reason I saw a developer cite. So, what steps would need to be taken to
>> bring the Tiny runtime back up to date? I still have dreams of writing a
>> kernel in Go, but even if that never occurs, I'd be happy to be able to run
>> Go code on bare metal.
>>
>> Many people have argued that some of the features that make the Go runtime
>> so large (the GC, goroutines, etc) are not feasible in the Tiny runtime and,
>> at that point, it's not really Go. They may be right regarding the
>> feasibility, but I disagree that the lack of those features makes the
>> language completely different. I would still enjoy programming in Go without
>> some of those features. I sure hope they can be included, but it's not a
>> deal breaker.
>>
>> So, can anyone point me on the right track?
>