Code: Select all
i686-elf-gcc -c $(C_FILE) -o $(O_FILE) -std=gnu99 -ffreestanding -O2 -Wall -Wextra -DKERNEL_MODE=64 #for C source files
i686-elf-gcc $(S_FILE) -o $(O_FILE) -ffreestanding -nostdlib -r -DKERNEL_MODE=64 #for .S assembly files
i686-elf-as $(S_FILE) -o $(O_FILE) #for .s assembly files
i686-elf-gcc -T boot32.ld -o boot32.o -ffreestanding -O2 -nostdlib -r $(OBJ32) -lgcc
Code: Select all
x86_64-elf-gcc -c $(C_FILE) -o $(O_FILE) -std=gnu99 -ffreestanding -O2 -Wall -Wextra -DKERNEL_MODE=64 #for C source files
x86_64-elf-gcc $(S_FILE) -o $(O_FILE) -ffreestanding -nostdlib -r -DKERNEL_MODE=64 #for .S assembly files
x86_64-elf-objcopy -O elf64-x86-64 -B i386 -I binary $(BINARY_DATA) $(BINARY_OBJECT) #for binary data
Code: Select all
x86_64-elf-gcc -T linker.ld -o myos.bin -ffreestanding -O2 -nostdlib boot32.o $(OBJ64) -lgcc
Code: Select all
[...]x86_64-elf/bin/ld: i386 architecture of input file `boot32.o' is incompatible with i386:x86-64 output
Also, I'm using Multiboot, so the bootstrap code *must* be 32-bit, and the entire image loadable by the bootloader.