Autoloader for custom "Game" plug-ins

Here are software that related with Samsung B series TVs. Like hex editors, new version of BusyBox or internal software, app programs that will run in your TV hardware.:!:This forum is NOT FOR USER QUESTIONS or Problems.

Re: Autoloader for custom "Game" plug-ins

Postby tusko » Sat Jun 26, 2010 10:09 am

bmwskead: not your fault, it was mine not using g in sed

arris69: you are the best!! And now it also checks that the library actually exists... cool

I stripped the gdb binary. Now it is around 3MB: http://www.box.net/shared/d3uuviu0qu
tusko
 
Posts: 59
Joined: Wed Jun 02, 2010 7:13 pm

Re: Autoloader for custom "Game" plug-ins

Postby bmwskead » Sat Jun 26, 2010 10:41 am

tusko wrote:I stripped the gdb binary.


very nice work again! now i reorganized my startup script and gdb is loaded from mtd_rwarea 30 seconds after startup! :)
bmwskead
 
Posts: 80
Joined: Tue Mar 30, 2010 8:24 pm

Re: Autoloader for custom "Game" plug-ins

Postby tusko » Sat Jun 26, 2010 10:43 am

By the way, the gdb_delay variable was some sort of safety measure... I tried to set it to zero and (at least in my TV) things go OK from the very beginning...
tusko
 
Posts: 59
Joined: Wed Jun 02, 2010 7:13 pm

Re: Autoloader for custom "Game" plug-ins

Postby bruintje71 » Sat Jun 26, 2010 8:26 pm

Great work by the team Tusko & Arris69 !! :D
I have put the gdb binary and the gdbtrick.sh script (the one last posted by Arris69) in the mtd_rwarea.
I now load the gdbtrick.sh script automatically, called from within the Samygo.sh script.
I use it to load the avrfix2-cip "Game" automatically. It works wonderfully!

My TV is a CI+ device: ue32b7000 (UE32B7000WPXXN), patched firmware of course.

Some small things that are perhaps strange (maybe it belongs this way):
If I call the script manually I get the following output containing an error, and nothing more happens after "$3 = 0":

Code: Select all
#  /mtd_rwarea/gdbtrick.sh
The following commands:
---
attach 62
call dlopen("/mtd_tlib/GGame/avrfix2-cip/load.so", 2)
call dlsym($1, "Game_Main")
call $2("/mtd_tlib/GGame/avrfix2-cip/", 0)
detach
---
will be executed by /mtd_rwarea/gdb in 5 secs!!

#

dlopen failed on 'libthread_db.so.1' - libthread_db.so.1: cannot open shared object file: No such file or directory
GDB will not be able to debug pthreads.

(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
0x405fd008 in pthread_cond_wait@@GLIBC_2.4 () from /lib/libpthread.so.0
$1 = 48001128
$2 = 1914337220
$3 = 0


After "$3 = 0" the script (called manually) does not return me the command-prompt cursor, unless I push control-C.
Should I be worried about this last issue?
bruintje71
 
Posts: 27
Joined: Sun Feb 21, 2010 3:17 pm

Re: Autoloader for custom "Game" plug-ins

Postby juzis » Sat Jun 26, 2010 10:14 pm

i made the same:
bruintje71 wrote:I have put the gdb binary and the gdbtrick.sh script (the one last posted by Arris69) in the mtd_rwarea.

i left just channelinfo in gdbtrick.sh:
Code: Select all
#!/bin/sh
### begin configure me
# gdb_binary: where your gdb binary resides
gdb_binary=/mtd_rwarea/
# gdb_commands: this is a temporary file where gdb commands are stored
gdb_commands=/mtd_rwarea/gdbtrick.gdb
# gdb_delay: gdb will be scheduled to run after $gdb_delay seconds
#            this is for letting exeDSP to settle down at TV startup
gdb_delay=30
# libraries: absolute path of libraries to be loaded
#            there can be several, separated spaces!!
#            this script requires paths WITHOUT spaces
libraries="/mtd_tlib/GGame/channelinfo/loader.so" # add more libraries here
### end configure me

and after i run the script i am getting error
Code: Select all
 #mtd_rwarea/gdbtrick.sh
The following commands:
---
attach 49
detach
---
will be executed by /mtd_rwarea/ in 30 secs!!

# mtd_rwarea/gdbtrick.sh: mtd_rwarea/gdbtrick.sh: 38: /mtd_rwarea/: Permission denied

The 38th line is
Code: Select all
{ sleep $gdb_delay; $gdb_binary -batch -x $gdb_commands; } &

what am i doing wrong? I chmoded gdb and gdbtrichk.sh to 755, what else?
juzis
SamyGO Moderator
 
Posts: 6020
Joined: Sun Mar 07, 2010 6:20 pm

Re: Autoloader for custom "Game" plug-ins

Postby bruintje71 » Sat Jun 26, 2010 10:24 pm

Juzis29:

I think you simply need to replace "gdb_binary=/mtd_rwarea/" by "gdb_binary=/mtd_rwarea/gdb"

This is my gdbtrick.sh script:
Code: Select all
#!/bin/sh

### begin configure me

# gdb_binary: where your gdb binary resides
gdb_binary=/mtd_rwarea/gdb

# gdb_commands: this is a temporary file where gdb commands are stored
gdb_commands=/mtd_rwarea/gdbtrick.gdb

# gdb_delay: gdb will be scheduled to run after $gdb_delay seconds
#            this is for letting exeDSP to settle down at TV startup
gdb_delay=5

# libraries: absolute path of libraries to be loaded
#            there can be several, separated spaces!!
#            this script requires paths WITHOUT spaces
libraries="/mtd_tlib/GGame/avrfix2-cip/load.so" # add more libraries here

### end configure me

exeDSP_PID=$(pidof exeDSP)
temp='attach '$exeDSP_PID'\n'

i=0
for l in $libraries
do
        if [ -e "$l" ] ;then
                temp=$temp'call dlopen("'$l'", 2)\n'
                let i++
                temp=$temp'call dlsym($'$i', "Game_Main")\n'
                let i++
                temp=$temp'call $'$i'("'${l%/*}/'", 0)\n'
                let i++
        fi
done
temp=$temp'detach\n'

echo -e 'The following commands:\n---\n'$temp'---\nwill be executed by '$gdb_binary' in '$gdb_delay' secs!!\n'

echo -e $temp >$gdb_commands

{ sleep $gdb_delay; $gdb_binary -batch -x $gdb_commands; rm $gdb_commands; } &


Tusco/Arris69:
Just like to repeat my question here.
After "$3 = 0" the script (called manually) does not return me the command-prompt cursor, unless I push control-C.
Should I be worried about this?
bruintje71
 
Posts: 27
Joined: Sun Feb 21, 2010 3:17 pm

Re: Autoloader for custom "Game" plug-ins

Postby juzis » Sun Jun 27, 2010 6:21 am

bruintje71 wrote:I think you simply need to replace "gdb_binary=/mtd_rwarea/" by "gdb_binary=/mtd_rwarea/gdb"

Nothing happends. I use your script to run manualy. gdb library is placed in /mtd_rwarea/gdb. script is placed in /mtd_rwarea/. I stil get the same permission denied error. I seems that some permissions are not set, but why i allways get the same last line error?
Code: Select all
localhost login: root
-sh: id: not found
# mtd_rwarea/gdbtrick.sh
The following commands:
---
attach 48
detach
---
will be executed by /mtd_rwarea/gdb in 5 secs!!

# mtd_rwarea/gdbtrick.sh: mtd_rwarea/gdbtrick.sh: 33: /mtd_rwarea/gdb: Permission denied
#

the script (called manually) does not return me the command-prompt cursor to, i have to press control-C to get it back.
juzis
SamyGO Moderator
 
Posts: 6020
Joined: Sun Mar 07, 2010 6:20 pm

Re: Autoloader for custom "Game" plug-ins

Postby tusko » Sun Jun 27, 2010 7:26 am

bruintje71: Your output is good. You do not have to worry about the error. Regarding the return to the command prompt... I think that you have not lost the command prompt, because gdb runs in the background, you are only seeing its output ... What happens if you simply press enter several times?

juzis28: Looking your output, it seems that the "libraries" variable in the script is not properly configured. Please made sure that libraries listed in this variable are located where the variable states... If not, post your script copy and I will take a look...
Last edited by tusko on Sun Jun 27, 2010 7:41 am, edited 1 time in total.
tusko
 
Posts: 59
Joined: Wed Jun 02, 2010 7:13 pm

Re: Autoloader for custom "Game" plug-ins

Postby juzis » Sun Jun 27, 2010 7:40 am

gdb binary (sorry for library :)) is placed in /mtd_rwarea/gdb/gdb and chmoded to 755. Directory /mtd_rwarea/gdb/ chmoded to 777. Script is placed in /mtd_rwarea/ and chmoded to 755. /mtd_tlib/GGame/channelinfo/loader.so is in right place too and works well if loaded from game_menu. Here is my script
Code: Select all
#!/bin/sh
### begin configure me
# gdb_binary: where your gdb binary resides
gdb_binary=/mtd_rwarea/gdb/
# gdb_commands: this is a temporary file where gdb commands are stored
gdb_commands=/mtd_rwarea/gdbtrick.gdb
# gdb_delay: gdb will be scheduled to run after $gdb_delay seconds
#            this is for letting exeDSP to settle down at TV startup
gdb_delay=5
# libraries: absolute path of libraries to be loaded
#            there can be several, separated spaces!!
#            this script requires paths WITHOUT spaces
#libraries="/mtd_tlib/GGame/channelinfo/loader.so /mtd_tlib/GGame/avrfix2/telnet.so /mtd_tlib/GGame/Switch/loader.so" # add more libraries here
libraries="/mtd_tlib/GGame/channelinfo/loader.so" # add more libraries here
### end configure me
exeDSP_PID=$(pidof exeDSP)
temp='attach '$exeDSP_PID'\n'
i=0
for l in $libraries
do
        if [ -e "$l" ] ;then
                temp=$temp'call dlopen("'$l'", 2)\n'
                let i++
                temp=$temp'call dlsym($'$i', "Game_Main")\n'
                let i++
                temp=$temp'call $'$i'("'${l%/*}/'", 0)\n'
                let i++
        fi
done
temp=$temp'detach\n'
echo -e 'The following commands:\n---\n'$temp'---\nwill be executed by '$gdb_binary' in '$gdb_delay' secs!!\n'
echo -e $temp >$gdb_commands
{ sleep $gdb_delay; $gdb_binary -batch -x $gdb_commands; rm $gdb_commands; } &

and output:
Code: Select all
# chmod 755 mtd_rwarea/gdb
# /mtd_rwarea/gdbtrick.sh
The following commands:
---
attach 48
call dlopen("/mtd_tlib/GGame/channelinfo/loader.so", 2)
call dlsym($1, "Game_Main")
call $2("/mtd_tlib/GGame/channelinfo/", 0)
detach
---
will be executed by /mtd_rwarea/gdb/ in 5 secs!!

# /mtd_rwarea/gdbtrick.sh: /mtd_rwarea/gdbtrick.sh: 33: /mtd_rwarea/gdb/: Permission denied


i tried to create an empty file, no success:
touch /mtd_rwarea/gdbtrick.gdb and chmod 777 /mtd_rwarea/gdbtrick.gdb
juzis
SamyGO Moderator
 
Posts: 6020
Joined: Sun Mar 07, 2010 6:20 pm

Re: Autoloader for custom "Game" plug-ins

Postby tusko » Sun Jun 27, 2010 7:59 am

Code: Select all
gdb_binary=/mtd_rwarea/gdb/


should be

Code: Select all
gdb_binary=/mtd_rwarea/gdb/gdb


Regarding the other problem... the output confuses me. It seems that it does not find the file "/mtd_tlib/GGame/channelinfo/loader.so", but you say that it is in place. Maybe is also a permission problem? Not sure... Also I cannot test with the TV if there is something wrong in the script, I'm not at home right now.

Maybe you can try to run gdb by hand and execute its commands manually (like I showed some posts ago). This maybe will help to find the problem...

Edit: Do not bother. Now it is OK. Only make the first change. Re-read it ;-)
tusko
 
Posts: 59
Joined: Wed Jun 02, 2010 7:13 pm

PreviousNext

Return to [B] Software

Who is online

Users browsing this forum: No registered users and 2 guests