GalaxyNexusI9250SerialConsole » History » Version 11
Denis 'GNUtoo' Carikli, 11/03/2012 01:01 PM
| 1 | 1 | Denis 'GNUtoo' Carikli | h1. GalaxyNexusSerialConsole |
|---|---|---|---|
| 2 | |||
| 3 | * http://redmine.replicant.us/projects/replicant/wiki/S5PC110Bootloader works as a serial cable. |
||
| 4 | |||
| 5 | When you connect the cable you get the FIQ debugger, but what if you want kgdb instead: |
||
| 6 | * apply that patch: |
||
| 7 | <pre> |
||
| 8 | diff --git a/arch/arm/mach-omap2/board-tuna.c b/arch/arm/mach-omap2/board-tuna.c |
||
| 9 | index a022a43..7098227 100644 |
||
| 10 | --- a/arch/arm/mach-omap2/board-tuna.c |
||
| 11 | +++ b/arch/arm/mach-omap2/board-tuna.c |
||
| 12 | @@ -1001,6 +1001,8 @@ static inline void __init board_serial_init(void) |
||
| 13 | omap_serial_init_port_pads(0, uart1_pads, uart1_pads_sz, NULL); |
||
| 14 | omap_serial_init_port_pads(1, tuna_uart2_pads, |
||
| 15 | ARRAY_SIZE(tuna_uart2_pads), &tuna_uart2_info); |
||
| 16 | + omap_serial_init_port_pads(2,tuna_uart3_pads, |
||
| 17 | + ARRAY_SIZE(tuna_uart3_pads), NULL); |
||
| 18 | omap_serial_init_port_pads(3, tuna_uart4_pads, |
||
| 19 | ARRAY_SIZE(tuna_uart4_pads), NULL); |
||
| 20 | } |
||
| 21 | </pre> |
||
| 22 | * remove the FIQ debugger in the kernel configuration. |
||
| 23 | |||
| 24 | * change the CMDLINE trough the kernel configuration: |
||
| 25 | Use: |
||
| 26 | <pre>CONFIG_CMDLINE="console=ttyO2 androidboot.console=ttyO2 [...]"</pre> |
||
| 27 | Instead of: |
||
| 28 | <pre>CONFIG_CMDLINE="console=ttyFIQ0 androidboot.console=ttyFIQ0 [...]"</pre> |
||
| 29 | 2 | Denis 'GNUtoo' Carikli | |
| 30 | 3 | Denis 'GNUtoo' Carikli | * Verify that you get the kernel messages. |
| 31 | 2 | Denis 'GNUtoo' Carikli | |
| 32 | 3 | Denis 'GNUtoo' Carikli | * Then change the cmdline for kgdb |
| 33 | 4 | Denis 'GNUtoo' Carikli | <pre> |
| 34 | CONFIG_CMDLINE="kgdboc=ttyO2,115200 console=ttyO2 androidboot.console=ttyO2 [...]" |
||
| 35 | </pre> |
||
| 36 | |||
| 37 | Don't add kgdbwait tough because it result in that: |
||
| 38 | <pre> |
||
| 39 | (gdb) set remotebaud 115200 |
||
| 40 | (gdb) target remote /dev/ttyUSB0 |
||
| 41 | /dev/ttyUSB0: Device or resource busy. |
||
| 42 | (gdb) target remote /dev/ttyUSB0 |
||
| 43 | Remote debugging using /dev/ttyUSB0 |
||
| 44 | kgdb_breakpoint () |
||
| 45 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/kernel/debug/debug_core.c:954 |
||
| 46 | 954 arch_kgdb_breakpoint(); |
||
| 47 | (gdb) c |
||
| 48 | Continuing. |
||
| 49 | |||
| 50 | Program received signal SIGSEGV, Segmentation fault. |
||
| 51 | __raw_spin_lock_irqsave (lock=0x288) |
||
| 52 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/kernel/spinlock.c:112 |
||
| 53 | 112 BUILD_LOCK_OPS(spin, raw_spinlock); |
||
| 54 | (gdb) bt |
||
| 55 | #0 __raw_spin_lock_irqsave (lock=0x288) |
||
| 56 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/kernel/spinlock.c:112 |
||
| 57 | #1 0xc061aecc in _raw_spin_lock_irqsave (lock=0x288) |
||
| 58 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/kernel/spinlock.c:145 |
||
| 59 | #2 0xc0098620 in try_to_wake_up (p=0x0, state=1611595795, wake_flags=1) |
||
| 60 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/kernel/sched.c:2681 |
||
| 61 | #3 0xc009897c in wake_up_process (p=0x288) |
||
| 62 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/kernel/sched.c:2785 |
||
| 63 | #4 0xc00e2090 in proc_dohung_task_timeout_secs (table=<value optimized out>, write=<value optimized out>, |
||
| 64 | buffer=<value optimized out>, lenp=<value optimized out>, ppos=0xc782bf70) |
||
| 65 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/kernel/hung_task.c:190 |
||
| 66 | #5 0xc0174178 in proc_sys_call_handler (filp=<value optimized out>, buf=0x24808, count=1, ppos=0xc782bf70, |
||
| 67 | write=1) at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/fs/proc/proc_sysctl.c:158 |
||
| 68 | #6 0xc01741b0 in proc_sys_write (filp=0x288, buf=0x600f0013 <Address 0x600f0013 out of bounds>, count=1, |
||
| 69 | ppos=0xc782a000) |
||
| 70 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/fs/proc/proc_sysctl.c:176 |
||
| 71 | #7 0xc0126420 in vfs_write (file=0xc73be500, buf=0x24808 "0", count=<value optimized out>, pos=0xc782bf70) |
||
| 72 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/fs/read_write.c:377 |
||
| 73 | #8 0xc0126590 in sys_write (fd=<value optimized out>, buf=0x24808 "0", count=1) |
||
| 74 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/fs/read_write.c:429 |
||
| 75 | #9 0xc0055a00 in ?? () |
||
| 76 | Cannot access memory at address 0x0 |
||
| 77 | #10 0xc0055a00 in ?? () |
||
| 78 | Cannot access memory at address 0x0 |
||
| 79 | Backtrace stopped: previous frame identical to this frame (corrupt stack?) |
||
| 80 | </pre> |
||
| 81 | 5 | Denis 'GNUtoo' Carikli | |
| 82 | 10 | Denis 'GNUtoo' Carikli | * disable the watchdog timer in the kernel, and recompile it and reflash the boot.img. |
| 83 | 6 | Denis 'GNUtoo' Carikli | |
| 84 | then open a root console and do: |
||
| 85 | <pre> |
||
| 86 | echo g > /proc/sysrq-trigger |
||
| 87 | </pre> |
||
| 88 | 7 | Denis 'GNUtoo' Carikli | |
| 89 | <pre> |
||
| 90 | gnutoo@gnutoo-laptop:~/embedded/android/replicant-4.0$ . build/envsetup.sh |
||
| 91 | including device/ti/panda/vendorsetup.sh |
||
| 92 | including vendor/replicant/vendorsetup.sh |
||
| 93 | including sdk/bash_completion/adb.bash |
||
| 94 | gnutoo@gnutoo-laptop:~/embedded/android/replicant-4.0$ lunch replicant_maguro-eng |
||
| 95 | |||
| 96 | ============================================ |
||
| 97 | PLATFORM_VERSION_CODENAME=REL |
||
| 98 | PLATFORM_VERSION=4.0.4 |
||
| 99 | TARGET_PRODUCT=replicant_maguro |
||
| 100 | TARGET_BUILD_VARIANT=eng |
||
| 101 | TARGET_BUILD_TYPE=release |
||
| 102 | TARGET_BUILD_APPS= |
||
| 103 | TARGET_ARCH=arm |
||
| 104 | TARGET_ARCH_VARIANT=armv7-a-neon |
||
| 105 | HOST_ARCH=x86 |
||
| 106 | HOST_OS=linux |
||
| 107 | HOST_BUILD_TYPE=release |
||
| 108 | BUILD_ID=IMM76L |
||
| 109 | ============================================ |
||
| 110 | |||
| 111 | |||
| 112 | gnutoo@gnutoo-laptop:~/embedded/android/replicant-4.0$ arm-linux-androideabi-gdb |
||
| 113 | GNU gdb (GDB) 7.1-android-gg2 |
||
| 114 | Copyright (C) 2010 Free Software Foundation, Inc. |
||
| 115 | License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> |
||
| 116 | This is free software: you are free to change and redistribute it. |
||
| 117 | There is NO WARRANTY, to the extent permitted by law. Type "show copying" |
||
| 118 | and "show warranty" for details. |
||
| 119 | This GDB was configured as "--host=i686-linux-gnu --target=arm-elf-linux". |
||
| 120 | For bug reporting instructions, please see: |
||
| 121 | <http://www.gnu.org/software/gdb/bugs/>. |
||
| 122 | (gdb) file /home/gnutoo/embedded/android/replicant-4.0/out/target/product/maguro/obj/KERNEL_OBJ/vmlinux |
||
| 123 | Reading symbols from /home/gnutoo/embedded/android/replicant-4.0/out/target/product/maguro/obj/KERNEL_OBJ/vmlinux...done. |
||
| 124 | (gdb) set remotebaud 115200 |
||
| 125 | 8 | Denis 'GNUtoo' Carikli | (gdb) target remote /dev/ttyUSB0 |
| 126 | Remote debugging using /dev/ttyUSB0 |
||
| 127 | kgdb_breakpoint () |
||
| 128 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/kernel/debug/debug_core.c:954 |
||
| 129 | 954 arch_kgdb_breakpoint(); |
||
| 130 | (gdb) bt |
||
| 131 | #0 kgdb_breakpoint () |
||
| 132 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/kernel/debug/debug_core.c:954 |
||
| 133 | #1 0xc00df764 in sysrq_handle_dbg (key=-29306880) |
||
| 134 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/kernel/debug/debug_core.c:745 |
||
| 135 | #2 0xc02f2e18 in __handle_sysrq (key=103, check_mask=false) |
||
| 136 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/drivers/tty/sysrq.c:522 |
||
| 137 | #3 0xc02f2ec4 in write_sysrq_trigger (file=<value optimized out>, buf=<value optimized out>, count=2, |
||
| 138 | ppos=0xc4a01f70) |
||
| 139 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/drivers/tty/sysrq.c:870 |
||
| 140 | #4 0xc016ba88 in proc_reg_write (file=0xc49ea3c0, buf=0x137fc84 "g\n\f@", count=2, ppos=0xc4a01f70) |
||
| 141 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/fs/proc/inode.c:200 |
||
| 142 | #5 0xc0126420 in vfs_write (file=0xc49ea3c0, buf=0x137fc84 "g\n\f@", count=<value optimized out>, |
||
| 143 | pos=0xc4a01f70) at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/fs/read_write.c:377 |
||
| 144 | #6 0xc0126590 in sys_write (fd=<value optimized out>, buf=0x137fc84 "g\n\f@", count=2) |
||
| 145 | at /home/gnutoo/embedded/android/replicant-4.0/kernel/samsung/tuna/fs/read_write.c:429 |
||
| 146 | #7 0xc0055a00 in ?? () |
||
| 147 | Cannot access memory at address 0x0 |
||
| 148 | #8 0xc0055a00 in ?? () |
||
| 149 | Cannot access memory at address 0x0 |
||
| 150 | Backtrace stopped: previous frame identical to this frame (corrupt stack?) |
||
| 151 | (gdb) |
||
| 152 | 7 | Denis 'GNUtoo' Carikli | |
| 153 | </pre> |
||
| 154 | 11 | Denis 'GNUtoo' Carikli | |
| 155 | since we have only 1 serial port, you can also use agent proxy to get kgdb and the console at the same time.... |
||
| 156 | <pre> |
||
| 157 | git clone git://git.kernel.org/pub/scm/utils/kernel/kgdb/agent-proxy.git |
||
| 158 | cd agent-proxy ; make |
||
| 159 | </pre> |