BASH like default shell - G1 Android Development

Hello, i would like to have BASH like default shell,how can i do that? I try extract bash from debian armel image and it doesnt work. And debian image doesnt solution.Thank you for answer.

Theres always ash, which ain't too bad, just type ash at a command prompt. Gives you tab completion and you can use the ball to scroll back thru history which saves much typing

Related

X-Windows on Debian from phone to phone -- how to

Here are instructions about running X-Windows of the G-1.
You need three basic packages: Android VNC Viewer: http://code.google.com/p/android-vnc-viewer/ , Tightvncserver (apt-get install tightvncserver), and icewm (apt-get install icewm).
When you get these installed (Android vnc viewer goes on the phone -- install from the browser), become su in Debian and run the command "vncserver". This will create an x-windows session and a startup file
in the /root/.vnc/ directory. Vncserver will also ask you to set up two passwrds. You will need the first password to log in, but just say no to the second password.
The next thing to do is to kill the session you just started: "vncserver -kill :1"
This is so you can edit the startup file to set it up correctly. cd to root/.vnc and run "nano xstartup".
comment out the line for xsession:
#/etc/X11/xsession
add these two lines:
icewm &
xterm
save the file (trackball "o" --this is control o), and exit nano (trackball x -- control x).
Then restart an x windows session by "vncserver" ( you should kill it after you are done with x-windows later on).
Next, go back to the phone and start Android-VNC-Viewr. You will get a log-in screen. You will need to enter your password you created and the address (localhost)and the port (5901).
Then press connect, and you are in an x-windows session, with a Debian icon in the lower seft corner of the screen. Click it and you are in business. There are instructions on running Android-VNC-Viewr
on their website.
You may want more room to install programs then you get on Saurik's image file. I created an image using his method at http://www.saurik.com/id/10.
The image is 3.7 gigabytes, and I have kde-core and LDXE installed and still have 2.4 gibytes free.
You have to add two lines to the bootdeb script after the lines loading the image. These lines are to get the image unpacked and configured. You can take them out after that.
Here they are:
busybox chroot $mnt /debootstrap/debootstrap --second-stage
echo 'deb http://ftp.de.debian.org/debian lenny main' >$mnt/etc/apt/sources.list
Thats it!
This works great! Thanks!
I did this long ago. Have you found a way to use the kayboard? I had to use a virtual one for some characters.
The keyboard works with the latest vnc-viewer, but capital letters don't work.
Great Dude
Hey i got it running, I also apt-get install LXDE. Do i need to add LXDE in vncserver like xterm and icewm?
will try this, when i get my new micro sd card thank you.
I did all the step and work great. Now im installing LXDE, do i have to add anything to run LXDE?
LXDE has a windows manager and a session manager, but it seems to take more resources than my setup. You do get a neat file manager and a nice editor (Leafpad). You also ge firefox, which runs -- but very slowly. These aps show up in the menus without changing the set-up I described.
man my 2 gig SD card has been working well for me so far but with all these new things to try I'm going to have to splurge for an 8 or a 16 soon...will be trying this within a week.
Fantastic - Slight issue tho!
Hi Guys,
Damn fine work, I have followed your instructions and it seems to be working.
Only thing is, I go into the VNC session using AndroidVNC, it brings up the ICEWM gui, perfect.
But, the cursor wont move and is there a way to make the resolution the same as the screen at 320 x 480????
Again nice work.
daftpunk6592 said:
Hi Guys,
Damn fine work, I have followed your instructions and it seems to be working.
Only thing is, I go into the VNC session using AndroidVNC, it brings up the ICEWM gui, perfect.
But, the cursor wont move and is there a way to make the resolution the same as the screen at 320 x 480????
Again nice work.
Click to expand...
Click to collapse
You need to read the user's guide on the Android-VNC-Viewer website. Click on "Menu" on the G-1 and then push 1:1 mode. Then select a mouse pointer mode.
You can set a screen geometry when you invoke vncserver from Debian: vncserver -geometry 320x480.
i cant seem to run vncserver from debian "command not found" why would this be? i did the apt-get for the other 2 packages first then installed vncserver from the browser
So if I do this to my phone, can I install something like open office or MS office?
lxde
okay thanks, sorted the issues, one final question before I play, I have IceWM working no problem, I have also installed LXDE.
How do I change xstartup to make it show LXDE when I vnc into localhost instead of iceWM?
TY in advance.
Hey have you type "SU" and then type "VNCSERVER"?
Ok i got it i did adp-get update and the tried again and it worked. there must have been some missing files or something.
Just incase someone dosnt know to make the screen readable as in its too small . hit menu and set "scaling" to 1:1 then change inputmode to touch pan , trackball mouse. now you can drag the desktop around with the touch screen and use the trackball as a mouse.
demonfriend1 said:
Hey have you type "SU" and then type "VNCSERVER"?
Click to expand...
Click to collapse
Yep I do that, but still IceWM
I think it's something specified in the /root/.vnc/xstartup file
Maybe the 'icewm &' line needs to be something else for LXDE??/
Heeeelllp!!
daftpunk6592 said:
Yep I do that, but still IceWM
I think it's something specified in the /root/.vnc/xstartup file
Maybe the 'icewm &' line needs to be something else for LXDE??/
Heeeelllp!!
Click to expand...
Click to collapse
Just replace "xterm" with "lxsession"
trouble with vnc server
when i enter in "vncserver" it brings up this...
Code:
Warning: localhost:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server localhost:1
Warning: localhost:2 is taken because of /tmp/.X2-lock
Remove this file if there is no X server localhost:2
Warning: localhost:3 is taken because of /tmp/.X3-lock
Remove this file if there is no X server localhost:3
Warning: localhost:4 is taken because of /tmp/.X4-lock
Remove this file if there is no X server localhost
Warning: localhost:5 is taken because of /tmp/.X5-lock
Remove this file if there is no X server localhost:5
it does this until localhost:10 then...
Code:
New 'X' desktop is localhost:11
starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost:11.log
ive gotten x windows to work before but now im stuck
any help is much appreciated
-thanks
You are not properly killing your xsessions when you are done. When you are finiseed with an xsession, exit from vnc-viewr, go to terminal and type "vncserver -kill :1" or whatever number you wer logged into.
Now you need to ch to /tmp/ and rm ./*lock
I think there will be similar warning messages for other temporary files for you next time also, which you will have to delete in a similar fashion.

Directories with spaces adb shell

Having a problem locating directories with spaces on my sdcard using adb shell.
Say I have to get to cd /sdcard/Misc Data
When I type the above I get bad data error or something like that.
I can go to /sdcard/music
but nothing with spaces. Is there like a %20 or something that I need use in place of the space?
In most Linux shells, you can type the whole location in quotes if there are spaces.
mount "/dev/this directory" /system
Another alternative is to use the backslash as an escape character before the space.
mount /dev/this\ directory /system
I haven't tested either with Android, but I'm assuming it'll work.
Well I guess I just don't understand that Android is basically Linux?
That means I don't need Debian since I don't program, wish I did.
Thanks man that worked perfectly.
beartard said:
In most Linux shells, you can type the whole location in quotes if there are spaces.
mount "/dev/this directory" /system
Another alternative is to use the backslash as an escape character before the space.
mount /dev/this\ directory /system
I haven't tested either with Android, but I'm assuming it'll work.
Click to expand...
Click to collapse
Yes, Android uses a Linux kernel as its base. Not sure what that has to do with Debian and programming (except for the similar kernels). But I'm sure you know better what you want to do that I do.
This is very oversimplified and non-technical, but here goes, from the bottom up:
The Linux kernel is the base. It controls all the low-level stuff like hardware, drivers, filesystems, etc.
On top of Linux sits Dalvik, a Java virtual machine.
Applications (even what we'd consider "Android OS" from a user perspective) run as separate processes in Dalvik.
Glad those terminal tips helped. If you need anything else, feel free to ask or google for "bash" or "busybox" for a bigger command and syntax reference.

Replacement for craptacular adb shell

Hey everybody. I'm on windows and adb's shell just keeps on pissing me off. Mainly, how pressing tab actually inserts a tab rather than tab completion . I'd really like to do something about this.
Here's a list of the things i've tried to get rid of this super-annoying behaviour.
-rolled a cross-compiler toolchain (glibc-based) for my phone (HTC Magic) and cross-compiled bash (in a vm). I actually made this work even with dynamic linking, and can start bash from within an instance of "adb shell". Unfortunatly, this doesn't change the tab behaviour, which appears to be baked into adb rather than a problem with the default shell.
-I thought i'd try something fancy by doing...
adb shell mkfifo /fifo
adb shell "bash > /fifo < fifo 2> /fifo"
adb forward tcp:9001 dev:/fifo
and starting putty in raw mode, connecting to localhost:9001. Unfortunatly, all is what happens is i get an echo of what i type and if i press enter a few times putty spits out ": command not found". I can't see why this shouldn't work but I suspect i'm Doing It Wrong.
-Searching the forum revealed puttycyg, which is actually really handy but unfortunatly suffers from the same tab completion problem as using adb shell in cmd.exe
How do you guys do it? Am I onto something with the adb forward thing? If so, how do I make that work?
I have also compiled bash but I have tab completion though adb. I do however use Linux as my desktop OS and am connecting through Konsole. So you could just try to install KDE for Windows. I know that I've looked for good terminal applications for windows but found none. They're all **** compared to what's available on nix.
This is my simple bashrc:
Code:
# If interactive do nothing.
[ -z "$PS1" ] && return
export HOME="/sdcard/"
PS1='[email protected]\h:\w\$ '
Also it's full of aliases for busybox. By replacing built in ls and similar you even get nice colors But still no line editing for some reason. I figure I might just need a proper libreadline or similar for that.
If anybody's interested in how I got this working, i cross-compiled socat for the droid. Required configuring with --disable-termios and manually editing config.h to set the #define for CRDLY_SHIFT and a couple other *_SHIFT macros to some values i found in Config/linux-2.6.24.h (or something similar, posting from memory here)
Once socat is on the phone, I made it pipe data from a bash shell to a unix socket it is listening on:
socat unix-listen:/dev/adbsock,fork exec:"/bin/bash -li",pty,stderr,setsid,sigint
(command shamelessly copied from http://superuser.com/questions/123790/socat-and-rich-terminals-with-ctrlc-ctrlz-ctrld-propagation ).
Then, on the pc i run adb forward tcp:9001 localfilesystem:/tmp/adbsock
And if i connect putty to localhost:9001 in raw mode (disabling line editing and local echo) I get a fairly complete bash shell that you can not only use tab completion on but even vi works
Again, posting from memory here so if anyone wants to try this and is running into problems i can dig it up from my ~/.bash_history.
Any chance you can post your socat port?
The tab completion thing is driving me insane! I don't understand why the ADB shell in *nix is proper, but the windows version sucks so much hairy donkey balls.
I've been using Ansicon so I at least get color in my shell, but ADB still mangles tab, and I don't even want to talk about what it does to Nano. Ugh!
Oh wow, this takes me back. I don't even have my android phone anymore (cancelled the contract due to terribly crap network service, and (unfortunately) the iPhone was the best phone in its price range from my new carrier).
So I don't have any files to give to you...
But, from what I can remember, to make it work, I built a cross binutils and gcc loosely following the instructions from the LFS book, compiled glibc + a few other libs socat wanted with it, and then socat itself, and then bash. I then copied the cross libc.so.6, ld-linux.so.2 (or whatever it's called on ARM) and all the libs socat wanted to /lib on the phone, and the socat and bash binaries to /bin. It's convenient that android keeps its important stuff in /system because it means you can avoid screwing around with your toolchain to make it look for a dynamic linker in some location other than /lib.
From memory socat was the only thing I had problems compiling, and thankfully I've already posted roughly what i had to do to it to make it build (because there's no way I remember lol)
Sorry I can't be more helpful!

[Q] adb shell busybox vi? Should this work?

I want to edit with busybox vi running from the phone within an adb shell.
I am running a DOS box cmd window or a cygwin rxvt shell window, both don't work, where I connect to the phone with an adb shell. Then I run busybox vi. The vi runs but the default termcap or terminfo or whatever it is doesn't seem to be right because busybox vi comes up but I can't seem to get the ESC key to take so I can switch between command and insert modes of operation. On the phone it works correctly.
I hate editing on the phone. I would much rather work on the workstation.
I've read on a wiki busybox vi page that busybox vi only supports vt102. Any ideas if this should work or what I could try?
Thanks in advance.
Same here. I spend half the morning playing with TERMs, trying to get a dos or cygwin terminal to run vi. vi runs fine in Terminal emulator, but like you, I don't wan to edit on the phone.
I found JOE (Joe's Own Editor) ported to Android. I installed it because it supposedly uses TERM=unknown. That didn't work from DOS either. But it did work from a cygwin bash shell, with TERM=linux in the adb shell. Now there is the learning curve to use JOE...
I too would be happy to hear which TERM setting will work with a DOS adb shell.
Face same situation here. Is it resolved?
If not, how you gurus work around on this basic issue?
I don't know much about VNC yet. Could it be a viable direction that worth spending effort?
Adb shell and Vi - info
I too just spent a lot of time trying to get vi to work under "adb shell". ESC was especially a problem. Ultimately, I wasn't able to get it to work correctly, but SSH seems to work fine.
There are a lot of details about what I learned on Stackoverflow (I'm a new member here, so I can't post the link, but you can search for it -- the title is "adb shell: can't use the ESCAPE KEY").
Has anyone gotten this to work correctly? Or is it simply an incomplete/buggy implementation of adb's shell?
Thanks,
Barry

[Q] [?]Terminal emulator commands

i've been searching for days and i have found very little information about how to launch .apk in terminal emulator..
i can get to browser by:
am start -a android.intent.action.VIEW h ttp://ww w.anywebsitehere.co m(<<no space between those letters)
But, how can i run other apps like mms, contacts, etc?? im not a linux professional but im extremely interested in all of the aspects of how these systems work. seriously considering going to school and making a career out of it.
any and all help is greatly appreciated.
Droid1/CM7.1/
You are not specificly launching the browser, but creating a view intent for an URL, for which the browser, but any other app that has an intent for this registered, will offer itself.
Why do you want to start apps through the command line?
thank you for responding. i figured it was something i didnt fully understand.
im curious as to how the entire system works, trying to learn how to control as much as i can in command form. having fun with the terminal emulator.
just found how to clear my dalvik
$su
#cd cache/dalvik-cache
#rm *
#exit
$exit
REBOOT
im just trying to bolster up on all commands so i can better understand how the system works, and how i can manually operate it.
Another one.
Phone
$am start tel:xxx-xxx-xxxx
Another.
Open new mms.
$am start mms: XXX
(XXX is your contact name)
Edit:
$ am start mms:XXX-XXX-XXXX
Using a phone number in your contacts will open the message theard in your mms app if you already have a conversation with that contact

Categories

Resources