feat: ajout des informations de déboguage séparée pour les différentes parties du noyau (compressées ou non, mode réel ou non)

This commit is contained in:
Nicolas Hordé 2019-01-02 13:59:16 +01:00
parent fda7fdc711
commit e30592d7d4
5 changed files with 35 additions and 12 deletions

View File

@ -7,21 +7,25 @@ REMOVE=rm -f
CHANGEPERM=chmod 644
NM=nm
OBJCOPY=objcopy -O binary -R .note -R .comment -S
OBJDEBUG=objcopy --only-keep-debug
ZOFFSET=sed -n -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|_ehead\|_text\|z_.*\)$$/\#define ZO_\2 0x\1/p'
VOFFSET=sed -n -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p'
COMP=gzip -5
COMP=gzip -9 -f
all: system.sys
system.sys: piggy.o voffset.h zoffset.h realmode/setup.bin
tools/build setup.bin system.bin zoffset.h system.sys
system.sys: system.tmp
$(OBJCOPY) $^ $@
system.tmp: piggy.o voffset.h zoffset.h realmode/setup.bin
tools/build realmode/setup.bin system.bin zoffset.h system.tmp
sync
voffset.h: system
$(NM) system|$(VOFFSET)>voffset.h
zoffset.h: system
$(NM) system|$(ZOFFSET)>zoffset.h
zoffset.h: piggy.o
$(NM) piggy.o|$(ZOFFSET)>zoffset.h
togit: clean indent
@ -30,6 +34,8 @@ piggy.o: piggy.S
system: systemc.o system.o ../lib/libs.o
$(LINK) -T system.ld system.o ../lib/libs.o
$(OBJDEBUG) system system.sym
$(NM) system > system.map
system.bin: system
$(OBJCOPY) $^ $@
@ -54,6 +60,9 @@ clean:
$(REMOVE) system
$(REMOVE) piggy.S
$(REMOVE) *.o
$(REMOVE) *.tmp
$(REMOVE) *.sym
$(REMOVE) *.map
$(REMOVE) *.gz
$(REMOVE) *.h
$(REMOVE) *.out

View File

@ -1,17 +1,24 @@
GCC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -I ../../include -m16 -fomit-frame-pointer -fno-pic -mno-mmx -mno-sse -mno-80387 -mno-fp-ret-in-387 -c -o
ASM=gcc -nostdinc -ffreestanding -fno-builtin -m16 -fomit-frame-pointer -fno-pic -mno-mmx -mno-sse -mno-80387 -mno-fp-ret-in-387 -c -o
ASM=gcc -nostdinc -ffreestanding -fno-builtin -m16 -fomit-frame-pointer -fno-pic -mno-mmx -mno-sse -mno-80387 -mno-fp-ret-in-387 -I ../ -I ../../include -c -o
LINK=ld -m elf_i386 -n
CONVERT=dos2unix
INDENT=indent -nhnl -l75 -ppi3 -ts8 -bls -nbc -di8 -nbad -nbap -nsob -i8 -bl -bli0 -ncdw -nce -cli8 -cbi0 -npcs -cs -saf -sai -saw -nprs -lp -npsl
REMOVE=rm -f
CHANGEPERM=chmod 644
NM=nm
OBJCOPY=objcopy -O binary -R .note -R .comment -S
OBJDEBUG=objcopy --only-keep-debug
all: setup.bin
sync
setup.bin: setupc.o setup.o
setup: setupc.o setup.o
$(LINK) -T setup.ld setupc.o setup.o
$(OBJDUMP)
setup.bin: setup
$(OBJCOPY) $^ $@
$(OBJDEBUG) setup setup.sym
$(NM) setup > setup.map
setupc.o: setup.c
$(GCC) $@ $^
@ -20,7 +27,10 @@ setup.o: setup.S
$(ASM) $@ $^
clean:
$(REMOVE) setup
$(REMOVE) *.o
$(REMOVE) *.sym
$(REMOVE) *.map
$(REMOVE) *.out
$(REMOVE) *.bin
$(REMOVE) *.sys

View File

@ -19,6 +19,8 @@
#include "voffset.h"
#include "zoffset.h"
#define __AC(X, Y) (X##Y)
#define _AC(X, Y) __AC(X,Y)
SEGBOOT = 0x07C0
SEGSYS = 0x1000

View File

@ -5,6 +5,7 @@
*/
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
OUTPUT(setup)
ENTRY(_start)
SECTIONS

View File

@ -10,12 +10,13 @@ SECTIONS
.text ALIGN(16): {
*(.text)
}
. = 0x200000;
.data ALIGN(16): {
*(.data)
}
.bss ALIGN(16): {
__bss_start = .;
*(.bss)
__bss_end = .;
}
_end = .;
}