Early bravo kernel debug technics
I am currently experimenting with this 3.0 kernel. Because of general instabilities, wrong chosen kernel config files and using the wrong tool chain, I have developed some technics which could help kernel developers on Bravo too. (You should use GCC 4.7 and bravo_config and for some earlier commits bravo3_config)
First idea: Using some hardware of the device to give feedback while early boot time. We can use bravo_reset() and also the vibrator.
Second Idea: Use ram_console which gives us the last kernel log in proc/last_kmesg after a reboot. So try to enable ram_console as early as possible and do a reset of the device before it hangs
… While reset press volume down and go into fastboot and boot a stable kernel for reading proc/last_kmesg. This helps a lot especially after a bravo_reset() was added to kernel/panic.c …..
ram_console has a configuration for early initialization. But his would also need some memory resources reserved. And do not forget, the stable kernel booting after the reset needs the same settings for finding the last logs. Another quick and dirty way: Remove the ram_console device from your plattfrom device list and add initialize the console manually within bravo_init:
changes for bravo_board.c:
@@ -1466,7 +1466,7 @@ static struct platform_device *devices[] __initdata = {
&bcm_bt_lpm_device,
#endif
&msm_device_uart_dm1,
- &ram_console_device,
+// &ram_console_device,
&bravo_rfkill,
&msm_device_dmov,
&msm_device_smd,
+
+struct ram_console_buffer;
+
+int __init ram_console_init(struct ram_console_buffer *buffer,
+ size_t buffer_size, const char *bootinfo,
+ char *old_buf);
+
static void __init bravo_init(void)
{
int ret;
pr_info("bravo_init() revision=%d\n", system_rev);
+
+ struct ram_console_buffer *buffer;
+ request_mem_region(0x03A00000, 0x00040000, "BRAVO");
+ buffer = (struct ram_console_buffer*)ioremap(0x03A00000, 0x00040000);
+ ram_console_init(buffer, 0x00040000, NULL, NULL);
(sorry for the hard coded constants, you will find them within bravo_board.h for ram_console memory definitions I think...)
and remove the static modifier for the ram_console_init declaration within drivers/staging/android/ram_console.c
After this you should be able to do a reset after the call ram_console_init via bravo_reset() and to see proc/last_kmsg after rebooting into a stable kernel.
Here are some samples:
==============================================================================================================================
This commit makes a function barvo_vibrate (credits to AndroidJaspie) available and adds it to bravo_init and free_initmem:
commit 3c01cca1d7b840aafdcd13580cec64ca8e30190b
Author: Thomas Lehner <thomas.lehner@justremotephone.com>
Date: Tue Feb 3 07:51:49 2015 +0100
Temporary: Add some debug vibrations...
diff --git a/arch/arm/mach-msm/board-bravo.c b/arch/arm/mach-msm/board-bravo.c
index 32b04f3..32b527b 100644
--- a/arch/arm/mach-msm/board-bravo.c
+++ b/arch/arm/mach-msm/board-bravo.c
@@ -1727,10 +1727,21 @@ static void __init msm_qsd_spi_init(void)
int bravo_init_mmc(int sysrev, unsigned debug_uart);
+void barvo_vibrate(void)
+{
+ printk("barvo_vibrate");
+ *(volatile uint32_t*)(MSM_GPIO1_BASE + 0x0808) |= 0x200000;
+ mdelay(200);
+ *(volatile uint32_t*)(MSM_GPIO1_BASE + 0x0808) &= ~0x200000;
+ mdelay(800);
+}
+
static void __init bravo_init(void)
{
int ret;
+ barvo_vibrate();
+
pr_info("bravo_init() revision=%d\n", system_rev);
msm_hw_reset_hook = bravo_reset;
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index db80bd3..d8f497a 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -804,8 +804,12 @@ void __init mem_init(void)
}
}
+void barvo_vibrate(void);
+
void free_initmem(void)
{
+ barvo_vibrate();
+
unsigned long reclaimed_initmem;
#ifdef CONFIG_HAVE_TCM
extern char __tcm_start, __tcm_end;
==============================================================================================================================
This commit makes bravo_reset available and adds it to panic and after the optical joystick key was pressed:
commit c2e69d93b15e867cf05027cad5bb38ced8b09d2d
Author: Thomas Lehner <thomas.lehner@justremotephone.com>
Date: Tue Feb 3 08:07:20 2015 +0100
Tempory: Add reset on panic and on press OJ key pressed for debug...
diff --git a/arch/arm/mach-msm/board-bravo.c b/arch/arm/mach-msm/board-bravo.c
index dc9721c..bedb26c 100644
--- a/arch/arm/mach-msm/board-bravo.c
+++ b/arch/arm/mach-msm/board-bravo.c
@@ -1541,7 +1541,7 @@ static struct perflock_platform_data bravo_perflock_data = {
// Reset
///////////////////////////////////////////////////////////////////////
-static void bravo_reset(void)
+void bravo_reset(void)
{
printk("bravo_reset()\n");
gpio_set_value(BRAVO_GPIO_PS_HOLD, 0);
diff --git a/drivers/input/misc/gpio_matrix.c b/drivers/input/misc/gpio_matrix.c
index 996a422..08fe948 100644
--- a/drivers/input/misc/gpio_matrix.c
+++ b/drivers/input/misc/gpio_matrix.c
@@ -109,6 +109,8 @@ static void remove_phantom_keys(struct gpio_kp *kp)
}
}
+void bravo_reset(void);
+
static void report_key(struct gpio_kp *kp, int key_index, int out, int in)
{
struct gpio_event_matrix_info *mi = kp->keypad_info;
@@ -144,6 +146,10 @@ static void report_key(struct gpio_kp *kp, int key_index, int out, int in)
#ifdef CONFIG_OPTICALJOYSTICK_CRUCIAL
if (mi->info.oj_btn && keycode == BTN_MOUSE) {
if (need_send_spec_key == pressed) {
+
+ printk("key pressed -> reset");
+ bravo_reset();
+
curcial_oj_send_key(keycode, pressed);
need_send_spec_key = !pressed;
printk(KERN_INFO "%s: send OJ action key, pressed: %d\n",
diff --git a/kernel/panic.c b/kernel/panic.c
index 564c7bc..9ce9592 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -51,6 +51,8 @@ static long no_blink(int state)
return 0;
}
+void bravo_reset(void);
+
/* Returns how long it waited in ms */
long (*panic_blink)(int state);
EXPORT_SYMBOL(panic_blink);
@@ -107,6 +109,9 @@ NORET_TYPE void panic(const char * fmt, ...)
bust_spinlocks(0);
+ printk("Bravo reset on panic!");
+ bravo_reset();
+
if (!panic_blink)
panic_blink = no_blink;
I hope this helps,
Thomas