i've been working on my kernel project and to simulate it (that is to run it on QEMU), i need it as a .iso file.
I have an assembly file and to assemble it - as --32 boot.s -o boot.o
and for the main code (which is in c++), to compile it - gcc -S kernel.cpp -lstdc++ -o kernel.o
gives no error. but,
while linking it with this linker script:-
ENTRY(_start)
SECTIONS
{
/* we need 1MB of space atleast */
. = 1M;
/* text section */
.text BLOCK(4K) : ALIGN(4K)
{
*(.multiboot)
*(.text)
}
/* read only data section */
.rodata BLOCK(4K) : ALIGN(4K)
{
*(.rodata)
}
/* data section */
.data BLOCK(4K) : ALIGN(4K)
{
*(.data)
}
/* bss section */
.bss BLOCK(4K) : ALIGN(4K)
{
*(COMMON)
*(.bss)
}
}
(the linking command i'm using is ld -T linker.ld kernel.o boot.o -o OS.bin)
it says:-
ld:kernel.o: file format not recognized; treating as linker script
ld:kernel.o:1: syntax error
am i doing something wrong with linking or assembling boot.s or compiling kernel.cpp?