SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By fatalfeel
#187783
When
cat /sys/module/hellotest/sections/.text = 0x00000000
Try this way

1.
gedit /root/project_board/free_imx/myandroid/kernel_imx/kernel/module.c
//in function load_module(struct load_info *info, const char __user *uargs, int flags)

//after
err = post_relocation(mod, info);
//add
printk(KERN_WARNING ".ko name=%s coreaddr=%x\n", mod->name, mod->module_core);

[mod->module_core] will apply to add-symbol-file later

2.
root@matrix_io:/ # insmod /data/hellomod/hellotest.ko
[ 590.764322] .ko name=hellotest coreaddr=7f11c000

3.
in eclipse right click your project
Debug As -> Debug Configurations -> GDB Hardware Debugging
click [Startup tab]
uncheck the all items on startup page
add those lines under [Halt] box but do not check [Halt]
add-symbol-file /root/project_board/free_imx/out/matrix_io/uboot/u-boot 0x7f11c000
then click [Apply]
By fatalfeel
#187786
It's the global variable problem
kptr_restrict

another way to cat .text

modify module_sect_show() in module.c
--> return sprintf(buf, "0x%p\n", (void *)sattr->address) /*sprintf(buf, "0x%pK\n", (void *)sattr->address)*/;

cat /sys/module/hellotest/sections/.text
root@matrix_io:/ # insmod /data/hellomod/hellotest.ko
[ 139.012925] .ko name=hellotest / coreaddr=0x7f11c000
[ 139.019392] Hello, world
root@matrix_io:/ # cat /sys/module/hellotest/sections/.text
0x7f11c000

demo photo:
https://picasaweb.google.com/1061855410 ... 4292643346
By fatalfeel
#187827
in device/fsl/matrix/etc/init.rc

write /proc/sys/kernel/kptr_restrict 2
to
write /proc/sys/kernel/kptr_restrict 0