Skip to content

Commit

Permalink
build: strip debug info into a separate file
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Oct 12, 2021
1 parent 2ed40e2 commit ec36ce3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
cscope.*
*.iso
*.img
*.debug
Makeconf.local
.DS_Store
drivers/acpi/acpica/source/
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ SHELL := bash
RM := rm
LN := ln
SYMLINK := $(LN) -s -f
OBJCOPY := objcopy
STRIP := strip

GRUB_FILE := grub-file
GRUB_MKIMAGE := grub-mkimage
Expand Down Expand Up @@ -146,6 +148,7 @@ OBJS := $(SOURCES:%.c=%.o)
OBJS += $(ASM_SOURCES:%.S=%.o)

TARGET := kernel64.bin
TARGET_DEBUG := $(TARGET).debug

# On Linux systems, we build directly. On non-Linux, we rely on the 'docker%'
# rule below to create an Ubuntu container and perform the Linux-specific build
Expand All @@ -169,6 +172,9 @@ $(TARGET): $(OBJS) $(PREP_LINK_SCRIPT)
$(VERBOSE) rm -rf $(SYMBOLS_NAME).S
@echo "LD " $(TARGET) $(SYMBOLS_NAME).o
$(VERBOSE) $(LD) -T $(PREP_LINK_SCRIPT) -o $@ $(OBJS) $(PFMLIB_LINKER_FLAGS) $(SYMBOLS_NAME).o
@echo "STRIP"
$(VERBOSE) $(OBJCOPY) --only-keep-debug $(TARGET) $(TARGET_DEBUG)
$(VERBOSE) $(STRIP) -s $(TARGET)

$(PFMLIB_ARCHIVE): $(PFMLIB_TARBALL)
@echo "UNTAR libpfm"
Expand Down Expand Up @@ -203,6 +209,7 @@ clean:
$(VERBOSE) find $(KTF_ROOT) -name cscope.\* -delete
$(VERBOSE) find $(PFMLIB_DIR) -mindepth 1 ! -name $(PFMLIB_NAME)-$(PFMLIB_VER).tar.gz -delete
$(VERBOSE) $(RM) -rf $(ACPICA_DEST_DIR)/source
$(VERBOSE) $(RM) -f $(TARGET_DEBUG)

# Check whether we can use kvm for qemu
ifeq ($(SYSTEM),LINUX)
Expand Down

0 comments on commit ec36ce3

Please sign in to comment.