From a14e13edf1c65dab0b3ae7f82cf3d44bedf8fad7 Mon Sep 17 00:00:00 2001 From: Regia König Date: Wed, 24 Aug 2022 11:07:52 +0200 Subject: Some changes --- Makefile_for_memtest_gdb | 85 ++--------------------------------------------- create_debug.sh | 10 ++++++ memtest_efi_modified.lds | 7 ++-- test_code/OVMF_VARS.fd | Bin 540672 -> 540672 bytes 4 files changed, 15 insertions(+), 87 deletions(-) diff --git a/Makefile_for_memtest_gdb b/Makefile_for_memtest_gdb index fdbcb4c..58025f7 100644 --- a/Makefile_for_memtest_gdb +++ b/Makefile_for_memtest_gdb @@ -74,7 +74,7 @@ APP_OBJS = app/badram.o \ OBJS = boot/startup.o boot/efisetup.o $(SYS_OBJS) $(LIB_OBJS) $(TST_OBJS) $(APP_OBJS) -all: memtest.bin memtest.efi +all: memtest.efi -include boot/efisetup.d -include $(subst .o,.d,$(SYS_OBJS)) @@ -141,90 +141,9 @@ memtest_shared: $(OBJS) ldscripts/memtest_shared.lds Makefile memtest_shared.bin: memtest_shared objcopy -O binary $< memtest_shared.bin -memtest.bin: memtest_shared.bin boot/bootsect.o boot/setup.o ldscripts/memtest_bin.lds - $(eval SIZES=$(shell size -B -d memtest_shared | grep memtest_shared)) - $(LD) --defsym=_bss_size=$(word 3,$(SIZES)) -T ldscripts/memtest_bin.lds boot/bootsect.o boot/setup.o -b binary memtest_shared.bin -o memtest.bin - memtest.efi: memtest_shared.bin boot/header.o boot/setup.o ldscripts/memtest_efi.lds $(eval SIZES=$(shell size -B -d memtest_shared | grep memtest_shared)) $(LD) --defsym=_bss_size=$(word 3,$(SIZES)) -T ldscripts/memtest_efi.lds boot/header.o boot/setup.o -b binary memtest_shared.bin -o memtest.efi -memtest.mbr: memtest_shared.bin boot/mbr.o ldscripts/memtest_mbr.lds - $(LD) -T ldscripts/memtest_mbr.lds boot/mbr.o -b binary memtest_shared.bin -o memtest.mbr - -floppy.img: memtest.bin - dd if=/dev/zero of=floppy.img bs=1474560 count=1 - dd if=memtest.bin of=floppy.img bs=1474560 conv=notrunc - -esp.img: memtest.efi - @mkdir -p iso/EFI/BOOT - cp memtest.efi iso/EFI/BOOT/bootx64.efi - @rm -f esp.img - /sbin/mkdosfs -n MEMTEST-ESP -F12 -C esp.img 4096 - mcopy -s -i esp.img iso/EFI :: - -memtest.iso: memtest.mbr floppy.img esp.img - @mkdir -p iso/boot - cp floppy.img iso/boot/floppy.img - xorrisofs -pad -R -J -volid MT86PLUS_64 -graft-points -hide-rr-moved --grub2-mbr memtest.mbr \ - -b /boot/floppy.img --efi-boot --interval:appended_partition_2:all:: \ - -part_like_isohybrid -iso_mbr_part_type 0x00 -append_partition 2 0xef ./esp.img \ - -o ./memtest.iso /boot=./iso/boot /EFI=./iso/EFI - -iso: memtest.iso - clean: - rm -rf boot system lib tests app *.img *.iso memtest* iso grub-* - -# grub-memtest.iso can be used for testing the various different boot modes, -# using GRUB as an intermediate bootloader. Upstream GRUB only supports the -# 16-bit and 32-bit boot protocols, via the "linux16" and "linux" commands. -# Fedora add support for the EFI handover boot protocols, via the "linuxefi" -# command, and, since 2019, remove support for the 32-bit protocol, aliasing -# the "linux" command to either "linux16" or "linuxefi", depending on whether -# you boot in legacy or EFI mode. Mageia follows Fedora, but restores support -# for the 32-bit protocol, via the "linux32" command. Other distributions no -# doubt do their own thing. The boot menu on grub-memtest.iso attempts to -# support all these options. - -GRUB_FONT_DIR ?= /usr/share/grub - -GRUB_LIB_DIR ?= /usr/lib/grub - -GRUB_MKIMAGE := $(shell command -v grub2-mkimage || command -v grub-mkimage) - -GRUB_MODULES = iso9660 fat part_msdos all_video font gfxterm gfxmenu \ - boot chain configfile echo ls - -grub-eltorito.img: - $(GRUB_MKIMAGE) --output $@ --prefix /boot/grub --format i386-pc-eltorito biosdisk $(GRUB_MODULES) - -grub-bootx64.efi: - $(GRUB_MKIMAGE) --output $@ --prefix /EFI/BOOT/grub --format x86_64-efi $(GRUB_MODULES) - -grub-esp.img: memtest.efi grub-bootx64.efi ../grub/grub-efi.cfg - @mkdir -p grub-iso/EFI/BOOT/grub/x86_64-efi grub-iso/EFI/BOOT/grub/fonts - cp memtest.efi grub-iso/EFI/BOOT/memtest - cp grub-bootx64.efi grub-iso/EFI/BOOT/bootx64.efi - cp ../grub/grub-efi.cfg grub-iso/EFI/BOOT/grub/grub.cfg - cp $(GRUB_FONT_DIR)/unicode.pf2 grub-iso/EFI/BOOT/grub/fonts/ - cp $(GRUB_LIB_DIR)/x86_64-efi/*.mod grub-iso/EFI/BOOT/grub/x86_64-efi/ - @rm -f grub-esp.img - /sbin/mkdosfs -n MT86P_ESP -F12 -C grub-esp.img 8192 - mcopy -s -i grub-esp.img grub-iso/EFI :: - -grub-memtest.iso: memtest.bin grub-eltorito.img ../grub/grub-legacy.cfg grub-esp.img - @mkdir -p grub-iso/boot/grub/i386-pc grub-iso/boot/grub/fonts - cp memtest.bin grub-iso/boot/memtest - cp grub-eltorito.img grub-iso/boot/eltorito.img - cp ../grub/grub-legacy.cfg grub-iso/boot/grub/grub.cfg - cp $(GRUB_FONT_DIR)/unicode.pf2 grub-iso/boot/grub/fonts/ - cp $(GRUB_LIB_DIR)/i386-pc/*.mod grub-iso/boot/grub/i386-pc/ - xorrisofs -pad -R -J -volid MT86PLUS_64 -graft-points -hide-rr-moved \ - --grub2-mbr $(GRUB_LIB_DIR)/i386-pc/boot_hybrid.img \ - -b /boot/eltorito.img -no-emul-boot -boot-load-size 4 -boot-info-table --grub2-boot-info \ - --efi-boot --interval:appended_partition_2:all:: \ - -part_like_isohybrid -iso_mbr_part_type 0x00 -append_partition 2 0xef ./grub-esp.img \ - -o ./grub-memtest.iso /boot=./grub-iso/boot /EFI=./grub-iso/EFI - -grub-iso: grub-memtest.iso + rm -rf boot system lib tests app *.img *.iso memtest* iso grub-* \ No newline at end of file diff --git a/create_debug.sh b/create_debug.sh index 19047bc..ada21f9 100755 --- a/create_debug.sh +++ b/create_debug.sh @@ -1,3 +1,13 @@ #! /bin/sh objdump -h memtest_shared +objdump -h boot/header.o +objdump -h boot/setup.o + +BSS_SIZE=$(size -B -d memtest_shared | grep memtest_shared | tr -s ' ' | cut -d' ' -f3) +echo $BSS_SIZE +echo "bss_size: $BSS_SIZE" + + + +ld --defsym=_bss_size=$BSS_SIZE -T memtest_efi_modified.lds boot/header.o boot/setup.o -b memtest_shared -o memtest_modified.efi diff --git a/memtest_efi_modified.lds b/memtest_efi_modified.lds index 90e7f76..179fe93 100644 --- a/memtest_efi_modified.lds +++ b/memtest_efi_modified.lds @@ -17,10 +17,9 @@ SECTIONS { . = ALIGN(512); _text_end = . ; } - - /* - /DISCARD/ : { *(*) } - */ + .debug : { + *(.debug*) + } _text_size = (_text_end - _text_start); diff --git a/test_code/OVMF_VARS.fd b/test_code/OVMF_VARS.fd index cfa9ff2..53d80c2 100644 Binary files a/test_code/OVMF_VARS.fd and b/test_code/OVMF_VARS.fd differ -- cgit v1.2.3-55-g7522