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 CHANGEPERM=chmod 644
NM=nm NM=nm
OBJCOPY=objcopy -O binary -R .note -R .comment -S 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' 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' 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 all: system.sys
system.sys: piggy.o voffset.h zoffset.h realmode/setup.bin system.sys: system.tmp
tools/build setup.bin system.bin zoffset.h system.sys $(OBJCOPY) $^ $@
system.tmp: piggy.o voffset.h zoffset.h realmode/setup.bin
tools/build realmode/setup.bin system.bin zoffset.h system.tmp
sync sync
voffset.h: system voffset.h: system
$(NM) system|$(VOFFSET)>voffset.h $(NM) system|$(VOFFSET)>voffset.h
zoffset.h: system zoffset.h: piggy.o
$(NM) system|$(ZOFFSET)>zoffset.h $(NM) piggy.o|$(ZOFFSET)>zoffset.h
togit: clean indent togit: clean indent
@ -30,6 +34,8 @@ piggy.o: piggy.S
system: systemc.o system.o ../lib/libs.o system: systemc.o system.o ../lib/libs.o
$(LINK) -T system.ld 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 system.bin: system
$(OBJCOPY) $^ $@ $(OBJCOPY) $^ $@
@ -54,6 +60,9 @@ clean:
$(REMOVE) system $(REMOVE) system
$(REMOVE) piggy.S $(REMOVE) piggy.S
$(REMOVE) *.o $(REMOVE) *.o
$(REMOVE) *.tmp
$(REMOVE) *.sym
$(REMOVE) *.map
$(REMOVE) *.gz $(REMOVE) *.gz
$(REMOVE) *.h $(REMOVE) *.h
$(REMOVE) *.out $(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 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 LINK=ld -m elf_i386 -n
CONVERT=dos2unix 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 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 REMOVE=rm -f
CHANGEPERM=chmod 644 CHANGEPERM=chmod 644
NM=nm
OBJCOPY=objcopy -O binary -R .note -R .comment -S
OBJDEBUG=objcopy --only-keep-debug
all: setup.bin all: setup.bin
sync sync
setup.bin: setupc.o setup.o setup: setupc.o setup.o
$(LINK) -T setup.ld 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 setupc.o: setup.c
$(GCC) $@ $^ $(GCC) $@ $^
@ -20,7 +27,10 @@ setup.o: setup.S
$(ASM) $@ $^ $(ASM) $@ $^
clean: clean:
$(REMOVE) setup
$(REMOVE) *.o $(REMOVE) *.o
$(REMOVE) *.sym
$(REMOVE) *.map
$(REMOVE) *.out $(REMOVE) *.out
$(REMOVE) *.bin $(REMOVE) *.bin
$(REMOVE) *.sys $(REMOVE) *.sys

View File

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

View File

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

View File

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