Add linker scripts

This commit is contained in:
Alex Kotov 2022-01-27 06:43:20 +05:00
parent b1c943c245
commit 61d542720e
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 26 additions and 2 deletions

View File

@ -9,7 +9,7 @@ CROSS="$BIN/i386-elf-"
${CROSS}gcc -c src/x86_stage1.S -o src/x86_stage1.o
${CROSS}gcc -c src/x86_stage2.S -o src/x86_stage2.o
${CROSS}ld -Ttext 200000 --oformat binary -o src/x86_stage1.bin src/x86_stage1.o
${CROSS}ld -Ttext 200000 --oformat binary -o src/x86_stage2.bin src/x86_stage2.o
${CROSS}ld -Tsrc/x86_stage1.ld --oformat binary -o src/x86_stage1.bin src/x86_stage1.o
${CROSS}ld -Tsrc/x86_stage2.ld --oformat binary -o src/x86_stage2.bin src/x86_stage2.o
./testyboot mbr mbr.bin src/x86_stage1.bin
cat mbr.bin src/x86_stage2.bin > disk.img

12
src/x86_stage1.ld Normal file
View File

@ -0,0 +1,12 @@
OUTPUT_ARCH("i386")
ENTRY(_start)
SECTIONS
{
. = 0x7c00;
.text :
{
*(.text);
}
}

12
src/x86_stage2.ld Normal file
View File

@ -0,0 +1,12 @@
OUTPUT_ARCH("i386")
ENTRY(_start)
SECTIONS
{
. = 0x7e00;
.text :
{
*(.text);
}
}