Skip to content

Commit

Permalink
Copy kernel ELF file to allow debugging with GDB
Browse files Browse the repository at this point in the history
  • Loading branch information
edubart committed Feb 17, 2023
1 parent e057224 commit 1eae489
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
linux-*.elf
linux-*.bin
linux-nobbl-*.bin
linux-headers-*.tar.xz
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ BASE:=/opt/riscv
HEADERS := linux-headers-$(KERNEL_VERSION).tar.xz
IMAGE := linux-nobbl-$(KERNEL_VERSION).bin
LINUX := linux-$(KERNEL_VERSION).bin
LINUX_ELF:= linux-$(KERNEL_VERSION).elf
SELFTEST := linux-selftest-$(KERNEL_VERSION).ext2

BUILD_ARGS :=
Expand Down Expand Up @@ -85,6 +86,7 @@ copy:
docker cp $$ID:$(BASE)/kernel/artifacts/$(HEADERS) . && \
docker cp $$ID:$(BASE)/kernel/artifacts/$(IMAGE) . && \
docker cp $$ID:$(BASE)/kernel/artifacts/$(LINUX) . && \
docker cp $$ID:$(BASE)/kernel/artifacts/$(LINUX_ELF) . && \
docker cp $$ID:$(BASE)/kernel/artifacts/$(SELFTEST) . && \
docker rm -v $$ID

Expand All @@ -107,9 +109,9 @@ checksum: $(KERNEL_SRCPATH) $(RISCV_PK_SRCPATH)
dep:
mkdir dep
$(KERNEL_SRCPATH): URL=https://github.com/cartesi/linux/archive/v${KERNEL_VERSION}.tar.gz
$(KERNEL_SRCPATH): dep
$(KERNEL_SRCPATH): | dep
T=`mktemp` && wget "$(URL)" -O $$T && mv $$T $@ || rm $$T

$(RISCV_PK_SRCPATH): URL=https://github.com/cartesi/riscv-pk/archive/v${RISCV_PK_VERSION}.tar.gz
$(RISCV_PK_SRCPATH): dep
$(RISCV_PK_SRCPATH): | dep
T=`mktemp` && wget "$(URL)" -O $$T && mv $$T $@ || rm $$T
2 changes: 2 additions & 0 deletions build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ KERNEL_VERSION ?= $(shell make -sC $(LINUX_DIR) kernelversion)
HEADERS := artifacts/linux-headers-$(KERNEL_VERSION).tar.xz
IMAGE := artifacts/linux-nobbl-$(KERNEL_VERSION).bin
LINUX := artifacts/linux-$(KERNEL_VERSION).bin
LINUX_ELF := artifacts/linux-$(KERNEL_VERSION).elf
SELFTEST := artifacts/linux-selftest-$(KERNEL_VERSION).ext2
ARTIFACTS := $(HEADERS) $(IMAGE) $(LINUX) $(SELFTEST)

Expand All @@ -28,6 +29,7 @@ $(LINUX_DIR)/vmlinux $(IMAGE) $(HEADERS) &: $(LINUX_DIR)/.config
INSTALL_HDR_PATH=$(abspath work/linux-headers)
tar cJf $(HEADERS) $(abspath work/linux-headers)
cp work/linux/arch/riscv/boot/Image $(IMAGE)
cp $(LINUX_DIR)/vmlinux $(LINUX_ELF)

env:
@echo export ARCH=riscv
Expand Down

0 comments on commit 1eae489

Please sign in to comment.