Closed slayerjain closed 7 years ago
@steveklabnik It's gonna be cool, I'm excited !
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
I would lean toward what xv6 does, attempt to autodetect if plain ld
will work and let the user override if otherwise needed.
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
.
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
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.
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.