intermezzOS / kernel

A hobby operating system, in Rust
http://intermezzos.github.io/
Apache License 2.0
1.39k stars 91 forks source link

changed ld to x86_64-pc-elf-ld #26

Closed slayerjain closed 7 years ago

steveklabnik commented 8 years ago

Thanks @slayerjain !

We had been discussing this on IRC. On debian, I use plain 'ol ld, but I think this expanded form is better. The real question is, should we switch based on platform, or always use this particular cross version, and if so, how to get it on linux with regularity. I am gonna investigate.

slayerjain commented 8 years ago

@steveklabnik It's gonna be cool, I'm excited !

steveklabnik commented 8 years ago

I am still not 100% sure what the best thing to do is here. One option is what xv6 does:

https://github.com/mit-pdos/xv6-public/blob/master/Makefile#L31-L35

jtdowney commented 8 years ago

I would lean toward what xv6 does, attempt to autodetect if plain ld will work and let the user override if otherwise needed.

WilsonGiese commented 8 years ago

This seems alright and will probably work in most cases as long as the book's instructions are followed.

Note that $ which ld will return with 0 on OS X but will fail. I guess if no tool prefix is provided you'd want to check for x86_64-pc-elf-ld first, and then default to ld.

roneesh commented 8 years ago

I had to change:

build/kernel.bin: build/multiboot_header.o build/boot.o linker.ld
    /Users/roneesh/opt/bin/x86_64-pc-elf-ld -n -o build/kernel.bin -T linker.ld build/multiboot_header.o build/boot.o

build/os.iso: build/kernel.bin grub.cfg
    mkdir -p build/isofiles/boot/grub
    cp grub.cfg build/isofiles/boot/grub
    cp build/kernel.bin build/isofiles/boot/
    /Users/roneesh/opt/bin/grub-mkrescue -o build/os.iso build/isofiles
steveklabnik commented 7 years ago

Now that we use Cargo to build, this isn't how to do things. Thank you though! I will be adding instructions to the book shortly.