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 authored and 82marbag committed Oct 13, 2021
1 parent 2ed40e2 commit f73df53
Show file tree
Hide file tree
Showing 2 changed files with 13 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
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ SHELL := bash
RM := rm
LN := ln
SYMLINK := $(LN) -s -f
OBJCOPY := objcopy
STRIP := strip
ifeq ($(SYSTEM), MACOS)
STRIP_OPTS := -S
else
STRIP_OPTS := -s
endif

GRUB_FILE := grub-file
GRUB_MKIMAGE := grub-mkimage
Expand Down Expand Up @@ -146,6 +153,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 +177,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) $(STRIP_OPTS) $(TARGET)

$(PFMLIB_ARCHIVE): $(PFMLIB_TARBALL)
@echo "UNTAR libpfm"
Expand Down Expand Up @@ -203,6 +214,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 f73df53

Please sign in to comment.