i watched a video of gopher-os and looked through it's github repository 
for ways to extract the object files needed and tried his command as 
follows, but i'm getting these errors which i can't resolve:

GOARCH=386 GOOS=linux go build -n 2>&1 | sed -e "1s|^|set -e\n|" -e 
"1s|^|export GOOS=linux\n|" -e "1s|^|export GOARCH=386\n|" -e "1s|^|export 
CGO_ENABLED=0\n|" -e "1s|^|WORK='./build'\n|" -e "1s|^|alias pack='go tool 
pack'\n|" -e "/^mv/d" -e "s|-extld|-tmpdir='./build' -linkmode=external 
-extldflags='-nostdlib' -extld|g" | sh 2>&1 | sed -e "s/^/ | /g"

Errors/Warnings:

 | loadinternal: cannot find runtime/cgo
 | /usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 
0000000008049000

The above command is able to produce an object file in the ./build 
directory i specified, i can link it without any errors, but when i try to 
run the executable it doesn't work.

i know there is nothing wrong with the linker script because i have created 
object files using the gccgo cross-compiler, and they work.
i wish to use the extra set of features the 'go build' cross-compiler is 
able to provide that gccgo cross-compiler cannot.


On Sunday, August 30, 2020 at 1:31:58 AM UTC+5:30 nasirhu...@gmail.com 
wrote:

> I would like to +1 Amnon here, 
>
> Although, If you're looking forward to implementing a Kernel in Go, there 
> is a project called GopherOS (https://github.com/gopher-os/gopher-os/) 
> that can be of help to you.
>
> In order to generate the .o file, you can refer to the make file here: 
> https://github.com/gopher-os/gopher-os/blob/master/Makefile#L56 and 
> additionally use the make file for building and loading your Kernel too.
>
> Best,
>
> --
> Nasir Hussain 
>
> On Sat, Aug 29, 2020 at 8:34 PM Amnon <amn...@gmail.com> wrote:
>
>> Go is not the best language to write a kernel on. But some people have 
>> done it as an intellectual exercise.
>> Look at https://github.com/ycoroneos/G.E.R.T
>> Or https://github.com/f-secure-foundry/tamago
>> Or read 
>> https://speakerdeck.com/achilleasa/bare-metal-gophers-can-you-write-an-os-kernel-in-go
>>
>> It is quite a bit of work. But you will learn a fair bit along the way.
>>
>>
>> On Saturday, 29 August 2020 14:32:08 UTC+1, saurav deshpande wrote:
>>>
>>> Hello, I was trying to write a basic kernel in golang. Before actually 
>>> implementing anything in the kernel.go file I wanted to see how go build 
>>> cross compiler can be used.
>>> I am currently using :
>>> *go version go1.15*  *linux/amd64*
>>>
>>> I wrote 3 files: a *loader* (*boot.asm*)file, a *linker(linker.ld) *file 
>>> and an *kernel(kernel.go)* file.
>>> I want to run the kernel on virtual machine, arch: linux-32bit.
>>> I need step wise help to successfully running this kernel. 
>>> how to compile it with go build and generate a ".o" file,then using 
>>> linker.ld to link boot.s and kernel.o.
>>> I tired the makefile format of gopher os but didnt get anywhere, so 
>>> thought if someone could help me from scratch.
>>> Thank you.
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/7d6979b3-d9ed-481b-b47f-fcf83eae4092o%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/7d6979b3-d9ed-481b-b47f-fcf83eae4092o%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/46d1c819-f359-4ad0-aee8-c3732b63332cn%40googlegroups.com.

Reply via email to