Download The GCC file at http://www.2shared.com/file/J_FU0h68/DJGPP.html
Install Nasm as well.
Make the required environment variables by Right Clicking MyComputer -> properties -> Advanced -> Enviroment Variables. In the system variable section, click New, add to
Variable Name: DJGPP
VariableValue : %SystemDrive%\djgpp\djgpp.env
And add to the Path Variable, the address of the nasm installed directory as well as gcc (usually in C:\djgpp\bin),and the ld directory (eg: C:\ld\bin).
Note: do not use the ld inside Djgpp to link. Use the ld in the link provided.
Nasm Command Line1: nasm -Z Error1.txt -f elf -o File1.o File1.asm
Nasm Command Line2: nasm -Z Error2.txt -f elf -o File2.o File2.asm
GCC command Line: gcc @GCCArguements.txt -c -o main.o main.c
LD Command Line: ld -T "C:\ld\bin\link.ld" -o File3.bin @LinkArguements.txt
Make a text file called LinkArguements.txt and write into it : File1.o File2.o main.o
which ld will link with File1.o first and File2.o Second and main.o third. If you want additional files add it to the text file in your required order.
Likewise make a GCCArguements.txt and add to it
-ffreestanding -fno-leading-underscore
PS: Change "C:\ld\bin\link.ld" in the linker script as required
PS: The @LinkArguements.txt & @GCCArguements.txt helps you to get around the 127 character limit in xp. Seems like this is no longer a problem for Windows 7 though, but either ways it works.
Also the linker Script link.ld:
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(START)
phys = 0xC0000000; Adjust this to your requirements like 0x100000 for 1MB kernel
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata)
*(.rdata)
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
}
end = .; KernelEnd = .;
}