2011-04-21 04:28:40     Installing Expect tool into kernel in 2009 distribution

Document created by Aaronwu Employee on Aug 27, 2013
Version 1Show Document
  • View in full screen mode

2011-04-21 04:28:40     Installing Expect tool into kernel in 2009 distribution

Shyam sundar (INDIA)

Message: 100068   

 

Hello world,

 

I am trying to install the Expect tool into the kernel image but I am getting the following error

 

make[4]: Entering directory `/root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user/expect'

rm -rf build

mkdir build

(cd build; sh ../configure --host=bfin-linux-uclibc --build=i686-pc-linux-gnu --prefix=/usr --sysconfdir=/etc --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info --localstatedir=/var/lib --disable-dependency-tracking --enable-fast-install --disable-shared --with-tcl=/root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user/tcl/build)

loading site script /root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/vendors/config/config.site

Invalid configuration `NONE': machine `NONE' not recognized

config.site: loading site script frag /root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/vendors/config/bfin/config.site

configuring Expect 5.42.1

checking for autoconf... yes

checking configure up to date... no

checking host system type... Invalid configuration `bfin-linux-uclibc': machine `bfin' not recognized

 

checking target system type... Invalid configuration `bfin-linux-uclibc': machine `bfin' not recognized

 

checking build system type... i686-pc-linux-gnu

checking shell to use within Make... /bin/bash

checking for gcc... bfin-linux-uclibc-gcc

checking whether the C compiler (bfin-linux-uclibc-gcc -pipe -Wall -g -O2      -mcpu=bf537-0.3     -mcpu=bf537-0.3) works... yes

checking whether the C compiler (bfin-linux-uclibc-gcc -pipe -Wall -g -O2      -mcpu=bf537-0.3     -mcpu=bf537-0.3) is a cross-compiler... yes

checking whether we are using GNU C... yes

checking whether bfin-linux-uclibc-gcc accepts -g... yes

checking for building with threads... no (default)

checking for Tcl configuration... configure: error: /root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user/tcl/build directory doesn't contain tclConfig.sh

make[4]: *** [build/build] Error 1

make[4]: Leaving directory `/root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user/expect'

make[3]: *** [expect] Error 2

make[3]: Leaving directory `/root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user'

make[2]: *** [all] Error 2

make[2]: Leaving directory `/root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user'

make[1]: *** [subdirs] Error 1

make[1]: Leaving directory `/root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1'

make: *** [single] Error 2

QuoteReplyEditDelete

 

 

2011-04-21 07:05:30     Re: Installing Expect tool into kernel in 2009 distribution

Shyam sundar (INDIA)

Message: 100081   

 

Hello world,

 

When I do make, I do see that the Expect tool is being install with option --with-tcl=/root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user/tcl/build,

 

I dont see any directory uclinuxdist-2009R1/user/tcl/build !

 

What am I missing for the Expect tool to be added?

QuoteReplyEditDelete

 

 

2011-04-21 19:37:13     Re: Installing Expect tool into kernel in 2009 distribution

Mike Frysinger (UNITED STATES)

Message: 100099   

 

ive imported tcl from upstream uclinux-dist into svn trunk

QuoteReplyEditDelete

 

 

2011-04-25 02:08:45     Re: Installing Expect tool into kernel in 2009 distribution

Shyam sundar (INDIA)

Message: 100139   

 

Hello Mike,

 

I added the tcl directory from the svn trunk, when I compiled it said cannot find ltcl8.3

 

make[5]: Entering directory `/root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user/expect/build'

bfin-linux-uclibc-gcc -pipe -pipe -Wall -g -O2      -mcpu=bf537-0.3  -fno-inline -rdynamic -o expect exp_main_exp.o libexpect5.42.a -L/lib -ltcl8.3 -mcpu=bf537-0.3 -ldl  -lm -lutil

/root/Desktop/DWAS_DEVELOPMENT/build/bfin-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/bin/ld: cannot find -ltcl8.3

collect2: ld returned 1 exit status

make[5]: *** [expect] Error 1

make[5]: Leaving directory `/root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user/expect/build'

make[4]: *** [all] Error 2

make[4]: Leaving directory `/root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user/expect'

make[3]: *** [expect] Error 2

make[3]: Leaving directory `/root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user'

make[2]: *** [all] Error 2

make[2]: Leaving directory `/root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user'

make[1]: *** [subdirs] Error 1

make[1]: Leaving directory `/root/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1'

make: *** [single] Error 2

QuoteReplyEditDelete

 

 

2011-04-25 02:21:50     Re: Installing Expect tool into kernel in 2009 distribution

Mike Frysinger (UNITED STATES)

Message: 100140   

 

ive fixed the linking path in trunk

QuoteReplyEditDelete

 

 

2011-04-25 04:47:26     Re: Installing Expect tool into kernel in 2009 distribution

Shyam sundar (INDIA)

Message: 100141   

 

Hi Mike,

 

Thanks,the image got created,but when I execute the Expect command, it complains fork: function not implemented.

 

I am trying to figure out how to run Expect without fork option.

 

The following is the error

 

root:/> expect -d scpkey.sh

expect version 5.42.1

argv[0] = expect  argv[1] = -d  argv[2] = scpkey.sh

set argc 0

set argv0 "scpkey.sh"

set argv ""

executing commands from command file scpkey.sh

spawn scp /root/.ssh/id_rsa.pub root@x.x.x.x:/root/.ssh/authorized_keys

fork: function not implemented

    while executing

"spawn scp "/root/.ssh/id_rsa.pub" "root@x.x.x.x:/root/.ssh/authorized_keys""

    (file "scpkey.sh" line 2)

 

 

The following is the script I am using to do a scp with the help of Expect

 

#!/usr/bin/expect

spawn scp "/root/.ssh/id_rsa.pub" "root@x.x.x.x:/root/.ssh/authorized_keys"

set timeout 90

expect {

  -re ".*(yes/no)?:.*" { send "yes\n"; interact }

-re ".*password:.*" { send "xxxx\n"; interact }

  eof { exit }

  timeout { puts "\n--TIMEOUT!--\n";exit}

}

exit

QuoteReplyEditDelete

 

 

2011-04-25 12:32:01     Re: Installing Expect tool into kernel in 2009 distribution

Mike Frysinger (UNITED STATES)

Message: 100147   

 

expect will probably need a bit of work to use vfork() when spawning things, but i dont think the "fork" command will ever work

QuoteReplyEditDelete

 

 

2011-04-26 04:46:49     Re: Installing Expect tool into kernel in 2009 distribution

Shyam sundar (INDIA)

Message: 100164   

 

Hello Mike,

 

So if i want to execute the following script,what modifications do i need to make?

 

Do you mean to say I should not use spawn?

 

#!/usr/bin/expect -f

 

set force_conservative 0  ;# set to 1 to force conservative mode even if

              ;# script wasn't run conservatively originally

if {$force_conservative} {

    set send_slow {1 .1}

    proc send {ignore arg} {

        sleep .1

        exp_send -s -- $arg

    }

}

 

 

set timeout -1

spawn scp /root/.ssh/id_rsa.pub root@x.x.x.x:/root/.ssh/authorized_keys

match_max 100000

expect -re ".*(yes/no)?.* "

send -- "yes\r"

expect -re ".*password:.* "

send -- "xxxx\r"

expect eof

QuoteReplyEditDelete

 

 

2011-04-27 10:07:54     Re: Installing Expect tool into kernel in 2009 distribution

Shyam sundar (INDIA)

Message: 100205   

 

Can any please tell if  Expect fully functional in uclinux??

QuoteReplyEditDelete

 

 

2011-04-27 11:52:55     Re: Installing Expect tool into kernel in 2009 distribution

Mike Frysinger (UNITED STATES)

Message: 100209   

 

obviously we've never tested it before

QuoteReplyEditDelete

 

 

2011-04-27 12:00:30     Re: Installing Expect tool into kernel in 2009 distribution

Mike Frysinger (UNITED STATES)

Message: 100210   

 

ive added some fork/vfork changes to trunk.  maybe it'll work.

QuoteReplyEditDelete

 

 

2011-04-28 06:38:47     Re: Installing Expect tool into kernel in 2009 distribution

Shyam sundar (INDIA)

Message: 100249   

 

Hi Mike,

 

Thanks for the update !

 

But I do get the same error when I execute !

 

fork: function not implemented

    while executing

QuoteReplyEditDelete

 

 

2011-04-28 06:40:56     Re: Installing Expect tool into kernel in 2009 distribution

Mike Frysinger (UNITED STATES)

Message: 100251   

 

that isnt possible.  it means you havent updated/rebuilt things fully.

QuoteReplyEditDelete

 

 

2011-04-28 08:06:35     Re: Installing Expect tool into kernel in 2009 distribution

Shyam sundar (INDIA)

Message: 100260   

 

This is the svn info of tcl and expect, which I am using

 

I did give the make clean command before giving the final make command

 

root@shyam-laptop:~/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user/tcl# svn info

Path: .

URL: svn://sources.blackfin.uclinux.org/uclinux-dist/trunk/user/tcl

Repository Root: svn://sources.blackfin.uclinux.org/uclinux-dist

Repository UUID: 3e2a5524-39e8-4cb9-84a9-c49da69cba3a

Revision: 10155

Node Kind: directory

Schedule: normal

Last Changed Author: vapier

Last Changed Rev: 10155

Last Changed Date: 2011-04-25 11:54:36 +0530 (Mon, 25 Apr 2011)

 

root@shyam-laptop:~/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user/tcl# cd ..

root@shyam-laptop:~/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user# cd expect

root@shyam-laptop:~/Desktop/DWAS_DEVELOPMENT/uclinux_2009R1_537/uclinuxdist-2009R1/user/expect# svn info

Path: .

URL: svn://sources.blackfin.uclinux.org/uclinux-dist/trunk/user/expect

Repository Root: svn://sources.blackfin.uclinux.org/uclinux-dist

Repository UUID: 3e2a5524-39e8-4cb9-84a9-c49da69cba3a

Revision: 10160

Node Kind: directory

Schedule: normal

Last Changed Author: vapier

Last Changed Rev: 10159

Last Changed Date: 2011-04-27 21:43:10 +0530 (Wed, 27 Apr 2011)

QuoteReplyEditDelete

 

 

2011-05-11 06:28:35     Re: Installing Expect tool into kernel in 2009 distribution

Shyam sundar (INDIA)

Message: 100573   

 

Hello world,

 

I am trying to use the Expect tool in 2010R1 branch version. I updated the expect and tcl directories from the trunk.

 

The following is the error I do get when I try to execute a expect script.

 

root:/etc/config> expect -d test_ftp_expect1.sh

expect version 5.42.1

argv[0] = expect  argv[1] = -d  argv[2] = test_ftp_expect1.sh

set argc 0

set argv0 "test_ftp_expect1.sh"

set argv ""

executing commands from command file test_ftp_expect1.sh

spawn ftp

INFO: task expect:162 blocked for more than 120 seconds.

"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.

expect        D ffa00a18     0   162    157 0x00000000

Stack info:

SP: [0x02063da4] <0x02063da4> /* kernel dynamic memory */

Memory from 0x02063da0 to 02064000

02063da0: 0205cc6c [02cba660] 0205c0c0  0205c240  0205cc40  00000001  02cba660  0017d394

02063dc0: 02063de4  ffa01dcc  02063de4  0000ae44  0205cc6c  58597aee  02062008  02062000

02063de0: 02062000  02063e64  ffa0221e  02063eb4  0017c9e0  02062000  7fffffff  00000001

02063e00: 02062000  00000002  0205cc40  0017d394  00000000  ffe6fd25  02063e48  0000b1c8

02063e20: 0205c0c0  0205cc6c  0205c0ec  ffa02068  02063eb4  7fffffff  00000001  02062000

02063e40: 000000a3  00000000  02063e74  0100f9d2  00000001  0205c0c0  0000f68c  02063eb8

02063e60: 02063eb8  02f5f7f0  00010ce0  0205cc40  00004000  02f69250  00004111  000000a3

02063e80: 00000000  00000000  02063ea8  00000000  02063f24  00000000  00000000  00000000

02063ea0: 00000000  020758a0  0004c092  02063ef4  02f5f7c4  00000000  02063e5c  02063e5c

02063ec0: 00001914  ffa000e0  000000be  02f69250  00000000  ffffe000  00000000  00000000

02063ee0: 00000000  ffffe000  00000000  00000000  00000000  00000000  ffa000ec <ffa00942>

02063f00: 0004c124  0000002a <ffa00942> ffffe000  00000000  0000fffe  0000c0a0  00000000

02063f20: 00000000  02d4c0a6  00008000  00000000  00000000  02064000  02d4c0a6  02d4c0a6

02063f40: 02f9497e  ffa01050  02003044  02fb07f1  02cb45cf  02fb07ec  02cb45ce  00000000

02063f60: 00000000  00000000  00000000  00000000  00000000  00000000  7ffff000  000000c0

02063f80: 00000137  00000000  00000000  00000000  00000000  0000005b  00001802  00000001

02063fa0: fffffffc  00000001  0000006e  02f69250  02f29608  02f5f598  02f5f7f0  02f5f82c

02063fc0: 00000001  02f69250  02ef862c  02d4c0a0  000000be  02fea85c  02feb57c  00000000

02063fe0: 00000000  0000c0a0  0000002f  00000003  00000000  00000000  000000be  00000006

Return addresses in stack:

    address : <0xffa00942> { _system_call + 0x6a }

    address : <0xffa00942> { _system_call + 0x6a }

 

 

The following is the expect script I am trying to run. This script works fine on a Ubuntu PC

 

#!/usr/bin/expect -f

 

set username lordmonk

set password shyam

set host_address 10.7.143.46

set port 1980

set src download

set dest /etc

set filename shyam

 

set timeout 18

set count 0

spawn ftp

match_max 100000

expect -re ".*ftp>*."

send -- "open $host_address $port\r"

expect {

    -re "ftp: connect: No route to host" {

                            send -- "quit\r" 

                            send_user "\r\nPath not exists\r\n"

                            exit }

 

    -re "ftp: connect: Connection refused" {

                            send -- "quit\r"

                            send_user "\r\nPeer refuses\r\n"

                            exit }

 

    -re "ftp: connect: Connection timed out" {

                            send -- "quit\r"

                            send_user "\r\nConnection time out\r\n"

                            exit }

 

    -re "ftp: connect: Network is unreachable" {

                            send -- "quit\r"

                            send_user "\r\nOur Network is not working\r\n"

                            exit }

 

    -re ".*Connected to*." {

                send -- "$username\r"

                }

    }

 

    set timeout 3

 

    expect -re ".*Password:*."

    send -- "$password\r"

    expect {

        -re "421 Login Timeout" {

                                send -- "quit\r" 

                                send_user "\r\nLogin time out\r\n"

                                exit }

        }

    expect -re ".*Using binary mode to transfer files*."

    send -- "bin\r"

    expect -re ".*ftp>*."

    send -- "get $src/$filename $dest/$filename\r"

    set timeout 10

    expect {

    -re ".*No such file or directory*." {

                                    send -- "quit\r"    

                                    send_user "\r\nFile not found\r\n"

                    exit }

    -re ".*226 Transfer complete*."  

    }

    send -- "\n"

    send -- "quit\r"

    send -- "\n"

    sleep 2

    exit

        expect eof

QuoteReplyEditDelete

 

 

2011-05-11 17:36:23     Re: Installing Expect tool into kernel in 2009 distribution

Mike Frysinger (UNITED STATES)

Message: 100591   

 

this warning:

INFO: task expect:162 blocked for more than 120 seconds.

 

indicates that the code might need a little more tweaking ... such as a vfork child waiting for info from the parent, but the parent cant notify it until the child does a vfork, and then it stays that way until the kernel warns about the parent being blocked.

QuoteReplyEditDelete

 

 

2011-05-19 01:38:26     Re: Installing Expect tool into kernel in 2009 distribution

Shyam sundar (INDIA)

Message: 100733   

 

Hello Mike,

 

Can you please tell how can this be sorted?

QuoteReplyEditDelete

 

 

2011-05-30 02:48:43     Re: Installing Expect tool into kernel in 2009 distribution

Shyam sundar (INDIA)

Message: 100928   

 

Hello world,

 

There is a directory in the path 2010R1/user/expect/patches, do I need to apply this patch before I do compile the kernel image? If no, can I please get some guidance for using the expect tool in the uclinux 2010 version?

Attachments

    Outcomes