Skip to content

Commit 761b471

Browse files
committed
test: add debug information to debug kernels
Add debugging information to debug kernels, but split it out by default. Signed-off-by: Pablo Barbáchano <[email protected]>
1 parent cf7dcc3 commit 761b471

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

resources/guest_configs/debug.config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CONFIG_FRAME_POINTER=y
2+
# CONFIG_KGDB=y
3+
# CONFIG_KGDB_SERIAL_CONSOLE=y
4+
CONFIG_DEBUG_INFO=y
5+
CONFIG_DEBUG_INFO_DWARF4=y

resources/rebuild.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,20 @@ function prepare_and_build_rootfs {
193193
build_initramfs
194194
}
195195

196+
function vmlinux_split_debuginfo {
197+
VMLINUX="$1"
198+
DEBUGINFO="$VMLINUX.debug"
199+
VMLINUX_ORIG="$VMLINUX"
200+
if [ $ARCH = "aarch64" ]; then
201+
# in aarch64, the debug info is in vmlinux
202+
VMLINUX_ORIG=linux/vmlinux
203+
fi
204+
objcopy --only-keep-debug $VMLINUX_ORIG $DEBUGINFO
205+
objcopy --preserve-dates --strip-debug --add-gnu-debuglink=$DEBUGINFO $VMLINUX
206+
# gdb does not support compressed files, but compress them because they are huge
207+
gzip -v $DEBUGINFO
208+
}
209+
196210
function build_al_kernels {
197211
if [[ $# = 0 ]]; then
198212
local KERNEL_VERSION="all"
@@ -208,7 +222,6 @@ function build_al_kernels {
208222
clone_amazon_linux_repo
209223

210224
CI_CONFIG="$PWD/guest_configs/ci.config"
211-
FTRACE_CONFIG="$PWD/guest_configs/ftrace.config"
212225

213226
if [[ "$KERNEL_VERSION" == @(all|5.10) ]]; then
214227
build_al_kernel $PWD/guest_configs/microvm-kernel-ci-$ARCH-5.10.config "$CI_CONFIG"
@@ -221,10 +234,18 @@ function build_al_kernels {
221234
fi
222235

223236
# Build debug kernels
237+
FTRACE_CONFIG="$PWD/guest_configs/ftrace.config"
238+
DEBUG_CONFIG="$PWD/guest_configs/debug.config"
224239
OUTPUT_DIR=$OUTPUT_DIR/debug
225240
mkdir -pv $OUTPUT_DIR
226-
build_al_kernel "$PWD/guest_configs/microvm-kernel-ci-$ARCH-5.10.config" "$CI_CONFIG" "$FTRACE_CONFIG"
227-
build_al_kernel "$PWD/guest_configs/microvm-kernel-ci-$ARCH-6.1.config" "$CI_CONFIG" "$FTRACE_CONFIG"
241+
if [[ "$KERNEL_VERSION" == @(all|5.10) ]]; then
242+
build_al_kernel "$PWD/guest_configs/microvm-kernel-ci-$ARCH-5.10.config" "$CI_CONFIG" "$FTRACE_CONFIG" "$DEBUG_CONFIG"
243+
vmlinux_split_debuginfo $OUTPUT_DIR/vmlinux-5.10.*
244+
fi
245+
if [[ "$KERNEL_VERSION" == @(all|6.1) ]]; then
246+
build_al_kernel "$PWD/guest_configs/microvm-kernel-ci-$ARCH-6.1.config" "$CI_CONFIG" "$FTRACE_CONFIG" "$DEBUG_CONFIG"
247+
vmlinux_split_debuginfo $OUTPUT_DIR/vmlinux-6.1.*
248+
fi
228249
}
229250

230251
function print_help {

tools/setup-ci-artifacts.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ for SQUASHFS in *.squashfs; do
4343
mkfs.ext4 -F $EXT4 -d squashfs-root
4444
rm -rf squashfs-root
4545
done
46+
47+
say "Uncompress debuginfo files"
48+
find . -name "*.debug.gz" -print0 | xargs -P4 -0 -t -n1 gunzip

0 commit comments

Comments
 (0)