4

Arm64 runtime qemu with GDB Debugger!

 11 months ago
source link: https://gist.github.com/paranlee/46ac12cd5f8ad22138ecf3955717e116
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

patch

sed -i 's/-O2/-Og/g' Makefile

Disable BUILD_BUG_ON easy! :)

git diff include/asm-generic/fixmap.h

diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h
index 8cc7b09c1bc7..f6588d25e9fa 100644
--- a/include/asm-generic/fixmap.h
+++ b/include/asm-generic/fixmap.h
@@ -29,7 +29,7 @@
  */
 static __always_inline unsigned long fix_to_virt(const unsigned int idx)
 {
-       BUILD_BUG_ON(idx >= __end_of_fixed_addresses);
+       BUILD_BUG_ON(false && idx >= __end_of_fixed_addresses);
        return __fix_to_virt(idx);
 }

git diff include/linux/thread_info.h

diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 0999f6317978..bb6f799422ea 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -204,7 +204,7 @@ static __always_inline __must_check bool
 check_copy_size(const void *addr, size_t bytes, bool is_source)
 {
        int sz = __compiletime_object_size(addr);
-       if (unlikely(sz >= 0 && sz < bytes)) {
+       if (false && unlikely(sz >= 0 && sz < bytes)) {
                if (!__builtin_constant_p(bytes))
                        copy_overflow(sz, bytes);
                else if (is_source)

build

make defconfig
make -j8
build with arm64 default config

qemu aarch64

qemu-system-aarch64 -S \
-machine virt -cpu cortex-a72 -machine type=virt -machine gic_version=3 -nographic \
-smp 4 -m 4096 \
-kernel arch/arm64/boot/Image \
--append "console=ttyAMA0 nokaslr" -s

gdb-multiarch

gdb-multiarch
setup arch aarch64
target remote:1234
file vmlinux

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK