ccs kernel debug
Some time, we need to debug kernel for locate key message. So need to single step to debug kernel code. Below method that provided you to debug kernel code.
1 understand below file
- system.map
vmlinux
2 Kernel ccs debug step:
- Congigure CONFIG_DEBUG_INFO=y, once you configure the info, you need to check the .config file.
diff --git a/ti_config_fragments/boot_opt.cfg b/ti_config_fragments/boot_opt.cfg
index 02b3c6b..693eaea 100644
--- a/ti_config_fragments/boot_opt.cfg
+++ b/ti_config_fragments/boot_opt.cfg
@@ -53,7 +53,7 @@ CONFIG_DEBUG_FS=n
CONFIG_KPROBES=n
# Remove debug info from kernel to reduce size
-CONFIG_DEBUG_INFO=n
+CONFIG_DEBUG_INFO=y
# Change kernel compression to LZO which has faster decompression
# times compared to gzip.
- Make file add configure for debug:ccflags-y := -DDEBUG -O0
- Debug single file:CFLAGS_omap_hwmod.o += -O0
- load symbol: vmlinux
3 example
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 3466e05..6c48b8c0 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -10,6 +10,8 @@ obj-y := id.o io.o control.o mux.o devices.o fb.o serial.o timer.o pm.o \
common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
omap_device.o sram.o drm.o
+CFLAGS_omap_hwmod.o += -O0
+CFLAGS_io.o += -O0
hwmod-common = omap_hwmod.o omap_hwmod_reset.o \
omap_hwmod_common_data.o
clock-common = clock.o
diff --git a/arch/arm/mach-omap2/clockdomains7xx_data.c b/arch/arm/mach-omap2/clockdomains7xx_data.c
index dd37efa..8f0252c 100644
--- a/arch/arm/mach-omap2/clockdomains7xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains7xx_data.c
@@ -352,7 +352,7 @@ static struct clockdomain iva_7xx_clkdm = {
.dep_bit = DRA7XX_IVA_STATDEP_SHIFT,
.wkdep_srcs = iva_wkup_sleep_deps,
.sleepdep_srcs = iva_wkup_sleep_deps,
- .flags = CLKDM_CAN_HWSUP_SWSUP,
+ .flags = CLKDM_CAN_FORCE_WAKEUP,
};
static struct clockdomain coreaon_7xx_clkdm = {
@@ -736,5 +736,6 @@ void __init dra7xx_clockdomains_init(void)
{
clkdm_register_platform_funcs(&omap4_clkdm_operations);
clkdm_register_clkdms(clockdomains_dra7xx);
+ printk(KERN_DEBUG ">>>>> fredy; clkdoms register \n");
clkdm_complete_init();
}
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 24e05ad..bf578ea 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -3346,6 +3346,10 @@ struct omap_hwmod *omap_hwmod_lookup(const char *name)
* caller of omap_hwmod_for_each(). @fn is called with
* omap_hwmod_for_each() held.
*/
+char nameoftempoh[20][20];
+int idxtempoh =0;
+int actualidx=0;
+
int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),
void *data)
{
@@ -3356,7 +3360,11 @@ int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),
return -EINVAL;
list_for_each_entry(temp_oh, &omap_hwmod_list, node) {
+ strcpy(nameoftempoh[idxtempoh],temp_oh->name);
ret = (*fn)(temp_oh, data);
+ idxtempoh=(idxtempoh+1)%20;
+ actualidx++;
+
if (ret)
break;
}
@@ -3471,8 +3479,13 @@ static int __init omap_hwmod_setup_all(void)
omaphwmod_dur = read_fast_counter();
omap_hwmod_build_ti_hwmod_list();
_ensure_mpu_hwmod_is_setup(NULL);
+ idxtempoh=0;
+ actualidx=0;
omap_hwmod_for_each(_init, NULL);
+ idxtempoh=0;
+ actualidx=0;
+
omap_hwmod_for_each(_setup, NULL);
omaphwmod_dur = read_fast_counter() - omaphwmod_dur;
diff --git a/arch/arm/mach-omap2/powerdomains7xx_data.c b/arch/arm/mach-omap2/powerdomains7xx_data.c
index 7fb8714..4d630f9 100644
--- a/arch/arm/mach-omap2/powerdomains7xx_data.c
+++ b/arch/arm/mach-omap2/powerdomains7xx_data.c
@@ -36,7 +36,7 @@ static struct powerdomain iva_7xx_pwrdm = {
.name = "iva_pwrdm",
.prcm_offs = DRA7XX_PRM_IVA_INST,
.prcm_partition = DRA7XX_PRM_PARTITION,
- .pwrsts = PWRSTS_OFF_ON,
+ .pwrsts = PWRSTS_ON,
.banks = 4,
.pwrsts_mem_on = {
[0] = PWRSTS_ON, /* hwa_mem */
@@ -394,7 +394,7 @@ void __init dra7xx_powerdomains_init(void)
{
pwrdm_register_platform_funcs(&omap4_pwrdm_operations);
pwrdm_register_pwrdms(powerdomains_dra7xx);
-
+ printk(KERN_DEBUG ">>>>> fredy; pwrdoms register \n");
if (soc_is_dra76x())
pwrdm_register_pwrdms(powerdomains_dra76x);
else if (soc_is_dra74x())
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index af9e9af..9524d76 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -14,7 +14,7 @@ obj-$(CONFIG_COMMON_CLK) += clk-gpio.o
ifeq ($(CONFIG_OF), y)
obj-$(CONFIG_COMMON_CLK) += clk-conf.o
endif
-
+ccflags-y := -DDEBUG -O0
# hardware specific clock types
# please keep this section sorted lexicographically by file/directory path name
obj-$(CONFIG_MACH_ASM9260) += clk-asm9260.o
diff --git a/init/Makefile b/init/Makefile
index 7bc47ee..564e6e1 100644
--- a/init/Makefile
+++ b/init/Makefile
@@ -1,7 +1,6 @@
#
# Makefile for the linux kernel.
#
-
obj-y := main.o version.o mounts.o
ifneq ($(CONFIG_BLK_DEV_INITRD),y)
obj-y += noinitramfs.o
@@ -13,7 +12,7 @@ obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o
ifneq ($(CONFIG_ARCH_INIT_TASK),y)
obj-y += init_task.o
endif
-
+ccflags-y := -DDEBUG -O0
mounts-y := do_mounts.o
mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o
mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o
diff --git a/init/main.c b/init/main.c
index 649c622..1dd93ed 100644
--- a/init/main.c
+++ b/init/main.c
@@ -503,7 +503,7 @@ static void __init mm_init(void)
ioremap_huge_init();
mm_init_dur = read_fast_counter() - mm_init_dur;
}
-
+volatile int done=1;
asmlinkage __visible void __init start_kernel(void)
{
char *command_line;
@@ -511,6 +511,10 @@ asmlinkage __visible void __init start_kernel(void)
u32 start_time_pmu;
u32 setup_arch_time_pmu;
u32 setup_arch_time_32k;
+ while (done==1)
+ {
+ asm("NOP");
+ }
start_time_pmu = ARM_CCNT_Read();
@@ -723,7 +727,7 @@ static void __init do_ctors(void)
#endif
}
-bool initcall_debug;
+bool initcall_debug = 1;
core_param(initcall_debug, initcall_debug, bool, 0644);
#ifdef CONFIG_KALLSYMS
@@ -777,10 +781,14 @@ static bool __init_or_module initcall_blacklisted(initcall_t fn)
return false;
}
#else
+static char blacklist_buf[128] = "\0";
+
static int __init initcall_blacklist(char *str)
{
- pr_warn("initcall_blacklist requires CONFIG_KALLSYMS\n");
+ snprintf(blacklist_buf, 127, "%s", str);
+ pr_debug("blacklisted initcall %s\n", blacklist_buf);
return 0;
+
}
static bool __init_or_module initcall_blacklisted(initcall_t fn)
@@ -796,13 +804,13 @@ static int __init_or_module do_one_initcall_debug(initcall_t fn)
unsigned long long duration;
int ret;
- printk(KERN_DEBUG "calling %pF @ %i\n", fn, task_pid_nr(current));
+ printk(KERN_INFO "calling %pF @ %i\n", fn, task_pid_nr(current));
calltime = ktime_get();
ret = fn();
rettime = ktime_get();
delta = ktime_sub(rettime, calltime);
duration = (unsigned long long) ktime_to_ns(delta) >> 10;
- printk(KERN_DEBUG "initcall %pF returned %d after %lld usecs\n",
+ printk(KERN_INFO "initcall %pF returned %d after %lld usecs\n",
fn, ret, duration);
return ret;
@@ -813,7 +821,13 @@ int __init_or_module do_one_initcall(initcall_t fn)
int count = preempt_count();
int ret;
char msgbuf[64];
+ char fn_name[128] = "\0";
+ snprintf(fn_name, 127, "%pf", fn);
+ if (!strcmp(fn_name, blacklist_buf)) {
+ pr_debug("function %pf returning without executing\n", fn);
+ return -EPERM;
+ }
if (initcall_blacklisted(fn))
return -EPERM;
diff --git a/ti_config_fragments/boot_opt.cfg b/ti_config_fragments/boot_opt.cfg
index 02b3c6b..693eaea 100644
--- a/ti_config_fragments/boot_opt.cfg
+++ b/ti_config_fragments/boot_opt.cfg
@@ -53,7 +53,7 @@ CONFIG_DEBUG_FS=n
CONFIG_KPROBES=n
# Remove debug info from kernel to reduce size
-CONFIG_DEBUG_INFO=n
+CONFIG_DEBUG_INFO=y
# Change kernel compression to LZO which has faster decompression
# times compared to gzip.