diff --git a/.gitignore b/.gitignore index bda2ccda..d150f89a 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ compile_commands.json # Ignore generated executables and other generated files # **/.detect-openssl.dep.c +*.debug ap_tools/ap-check cmsfs-fuse/cmsfs-fuse cpacfstats/cpacfstats diff --git a/genprotimg/boot/Makefile b/genprotimg/boot/Makefile index 2d44d279..82b3a63b 100644 --- a/genprotimg/boot/Makefile +++ b/genprotimg/boot/Makefile @@ -2,6 +2,7 @@ include ../../common.mak FILES := stage3a.bin stage3b.bin stage3b_reloc.bin +DEBUG_FILES := $(addsuffix .debug,$(FILES)) ifeq ($(HOST_ARCH),s390x) ZIPL_DIR := $(rootdir)/zipl @@ -75,6 +76,9 @@ stage3b.elf: head.o $(ZIPL_OBJS) $(LINK) $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,-T,$< -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ @chmod a-x $@ +%.bin.debug: %.elf + $(OBJCOPY) --only-keep-debug $< $@ + %.bin: %.elf $(OBJCOPY) -O binary $< $@ @chmod a-x $@ @@ -89,7 +93,7 @@ else # `-include $(dependencies_c)` statement). .PHONY: $(dependencies_c) -$(FILES): +$(FILES) $(DEBUG_FILES): echo " SKIP $@ due to HOST_ARCH != s390x" install: @@ -97,9 +101,9 @@ install: endif .DEFAULT_GOAL := all -all: $(FILES) +all: $(FILES) $(DEBUG_FILES) clean: - rm -f *.o *.elf *.bin *.map .*.d *.lds + rm -f -- *.o *.elf *.bin *.map .*.d *.lds *.debug .PHONY: all clean diff --git a/zipl/boot/Makefile b/zipl/boot/Makefile index 2761955c..641384b2 100644 --- a/zipl/boot/Makefile +++ b/zipl/boot/Makefile @@ -13,15 +13,17 @@ ALL_CFLAGS = $(NO_PIE_CFLAGS) -Os -g $(INCLUDE_PARMS) \ -W -Wall -Wformat-security -fno-sanitize=all -Wno-array-bounds ALL_LDFLAGS += -fno-sanitize=all -FILES = fba0.bin fba1b.bin fba2.bin \ +INC_FILES := fba0.bin fba1b.bin fba2.bin \ eckd0_ldl.bin eckd0_cdl.bin \ eckd1.bin eckd1b.bin eckd2.bin \ tape0.bin \ eckd2dump_sv.bin tape2dump.bin fba2dump.bin eckd2dump_mv.bin +FILES := $(INC_FILES) stage3.bin +DEBUG_FILES := $(addsuffix .debug,$(FILES)) -all: .loaders tape0.bin stage3.bin +all: .loaders $(FILES) $(DEBUG_FILES) -.loaders: $(FILES) +.loaders: $(INC_FILES) touch .loaders # Prevent make from using some default rules... @@ -75,12 +77,15 @@ stage3.exec: head.o stage3.o kdump3.o libc.o ebcdic.o ebcdic_conv.o sclp.o \ %.exec: %.o $(LINK) -Wl,-T,$(filter %.lds,$^) $(NO_PIE_LDFLAGS) $(NO_WARN_RWX_SEGMENTS_LDFLAGS) -Wl,--build-id=none -m64 -static -nostdlib $(filter %.o, $^) -o $@ +%.bin.debug: %.exec + $(OBJCOPY) --only-keep-debug $< $@ + %.bin: %.exec $(OBJCOPY) -O binary $< $@ clean: rm -f -- *.o *.exec *.bin $(FILES) tape0.bin *.xxx *.yyy \ - stage3.bin *.lds .*.lds.d .loaders + stage3.bin *.lds .*.lds.d .loaders *.debug .PHONY: all clean