FORUMS
Remove All Ads from XDA

[TUTORIAL] Everything about ADB - A reference for everyone

5,530 posts
Thanks Meter: 2,296
 
By Droidzone, Inactive Recognized Developer on 30th August 2011, 06:26 PM
Post Reply Email Thread
31st August 2011, 07:55 AM |#11  
Droidzone's Avatar
OP Inactive Recognized Developer
Flag Kochi
Thanks Meter: 2,296
 
Donate to Me
More
Quote:
Originally Posted by coolexe

Nice tutorial bro. shoud be on dev section...???

Thanks bro.. I thought that might scare away newbies, plus since I havent done any actual development..
The Following 2 Users Say Thank You to Droidzone For This Useful Post: [ View ] Gift Droidzone Ad-Free
31st August 2011, 08:02 AM |#12  
coolexe's Avatar
Retired Recognized Developer
Thanks Meter: 5,438
 
Donate to Me
More
Quote:
Originally Posted by Droidzone

Thanks bro.. I thought that might scare away newbies, plus since I havent done any actual development..

Hi,

there is lots of thread in dev. section which doesn't belong to development...anyway nice tutorial for noobs...if possible add QtADB tool...

EDIT: Added to my threads
The Following User Says Thank You to coolexe For This Useful Post: [ View ] Gift coolexe Ad-Free
31st August 2011, 08:09 AM |#13  
Droidzone's Avatar
OP Inactive Recognized Developer
Flag Kochi
Thanks Meter: 2,296
 
Donate to Me
More
Will add a GUI section. Good tip.. It's a very useful tool
The Following 2 Users Say Thank You to Droidzone For This Useful Post: [ View ] Gift Droidzone Ad-Free
2nd September 2011, 05:54 PM |#14  
Junior Member
Thanks Meter: 5
 
More
Hi there.

Well this is a nice tut for android newbies like me

can you also add a basic symlinking tut? (especially how to symlink a folder to an already existing symlink )

thanks!
3rd September 2011, 12:24 AM |#15  
Droidzone's Avatar
OP Inactive Recognized Developer
Flag Kochi
Thanks Meter: 2,296
 
Donate to Me
More
Quote:
Originally Posted by jesseuy

Hi there.

Well this is a nice tut for android newbies like me

can you also add a basic symlinking tut? (especially how to symlink a folder to an already existing symlink )

thanks!


Does this answer your query?

From http://uw714doc.sco.com/en/SDK_syspr...lic_Links.html


Code:
Creating symbolic links

 To create a symbolic link, the new system call symlink(2)  is used and the owner must have write permission in the directory where the link will reside. The file is created with the user's user-id and group-id but these are subsequently ignored. The mode of the file is created as 0777. 
CAUTION: No checking is done when a symbolic link is created. There is nothing to stop a user from creating a symbolic link that refers to itself or to an ancestor of itself or several links that loop around among themselves. Therefore, when evaluating a pathname, it is important to put a limit on the number of symbolic links that may be encountered in case the evaluation encounters a loop. The variable MAXSYMLINKS is used to force the error ELOOP after MAXSYMLINKS symbolic links have been encountered. The value of MAXSYMLINKS should be at least 20.   
 To create a symbolic link, the ln command is used with the -s option (see ln(1)). If the -s option is not used and a user tries to create a link to a file on another file system, a symbolic link will not be created and the command will fail. 
 The syntax for creating symbolic links is as follows:  
   ln -s sourcefile1 [ sourcefile2 ... ] target  With two arguments: 
  • sourcefile1 may be any pathname and need not exist.
  • target may be an existing directory or a non-existent file.
  • If target is an existing directory, a file is created in directory target whose name is the last component of sourcefile1 (`basename sourcefile1`). This file is a symbolic link that references sourcefile1.
  • If target does not exist, a file with name target is created and it is a symbolic link that references sourcefile1.
  • If target already exists and is not a directory, an error is returned.
  • sourcefile1 and target may reside on different file systems.
With more than two arguments:
  • For each sourcefile, a file is created in target whose name is sourcefile or its last component (`basename sourcefile`) and is a symbolic link to sourcefile.
  • If target is not an existing directory, an error is returned.
  • Each sourcefile and target may reside on different file systems.
Examples The following examples show how symbolic links may be created. ln -s /usr/src/uts/sys /usr/include/sys In this example /usr/include is an existing directory. But file sys does not exist so it will be created as a symbolic link that refers to /usr/src/uts/sys. The result is that when file /usr/include/sys/x is accessed, the file /usr/src/uts/sys/x will actually be accessed. This kind of symbolic link may be used when files exist in the directory /usr/src/uts/sys but programs often refer to files in /usr/include/sys. Rather than creating corresponding files in /usr/include/sys that are hard links to files in /usr/src/uts/sys, one symbolic link can be used to link the two directories. In this example /usr/include/sys becomes a symbolic link that links the former /usr/include/sys directory to the /usr/src/uts/sys directory. ln -s /etc/group . In this example the target is a directory (the current directory), so a file called group (`basename /etc/group`) is created in the current directory that is a symbolic link to /etc/group. ln -s /fs1/jan/abc /var/spool/abc In this example we imagine that /fs1/jan/abc does not exist at the time the command is issued. Nevertheless, the file /var/spool/abc is created as a symbolic link to /fs1/jan/abc. Later, /fs1/jan/abc may be created as a directory, regular file, or any other file type. The following example illustrates the use of more than two arguments: ln -s /etc/group /etc/passwd . The user would like to have the group and passwd files in the current directory but cannot use hard links because /etc is a different file system. When more than two arguments are used, the last argument must be a directory; here it is the current directory. Two files, group and passwd, are created in the current directory, each a symbolic link to the associated file in /etc. Removing symbolic links Normally, when accessing a symbolic link, one follows the link and actually accesses the referenced file. However, this is not the case when one attempts to remove a symbolic link. When the rm(1) command is executed and the argument is a symbolic link, it is the symbolic link that is removed; the referenced file is not touched. Accessing symbolic links Suppose abc is a symbolic link to file def. When a user accesses the symbolic link abc, it is the file permissions (ownership and access) of file def that are actually used; the permissions of abc are always ignored. If file def is not accessible (that is, either it does not exist or it exists but is not accessible to the user because of access permissions) and a user tries to access the symbolic link abc, the error message will refer to abc, not file def. Copying symbolic links This section describes the behavior of the cp(1) command when one or more arguments are symbolic links. With the cp(1) command, if any argument is a symbolic link, that link is followed. Suppose the command line is cp sym file3 where sym is a symbolic link that references a regular file test1 and file3 is a regular file. After execution of the command, file3 gets overwritten with the contents of the file test1. If the last argument is a symbolic link that references a directory, then files are copied to that directory. Suppose the command line is cp file1 sym symd where file1 is a regular file, sym is a symbolic link that references a regular file test1, and symd is a symbolic link that references a directory DIR. After execution of the command, there will be two new files, DIR/file1 and DIR/sym that have the same contents as file1 and test1. Linking symbolic links This section describes the behavior of the ln(1) command when one or more arguments are symbolic links. To understand the difference in behavior between this and the cp(1) command, it is useful to think of a copy operation as dealing with the contents of a file while the link operation deals with the name of a file. Let us look at the case where the source argument to ln is a symbolic link. If the -s option is specified to ln, the command calls the symlink system call (see symlink(2)). symlink does not follow the symbolic link specified by the source argument and creates a symbolic link to it. If -s is not specified, ln invokes the link(2) system call. link follows the symbolic link specified by the source argument and creates a hard link to the file referenced by the symbolic link. For the target argument, ln invokes a stat system call (see stat(2)). If stat indicates that the target argument is a directory, the files are linked in that directory. Otherwise, if the target argument is an existing file, it is overwritten. This means that if the second argument is a symbolic link to a directory, it is followed, but if it is a symbolic link to a regular file, the symbolic link is overwritten. For example, if the command line is ln sym file1 where sym is a symbolic link that references a regular file foo, and file1 is a regular file, file1 is overwritten and hard-linked to foo. Thus a hard link to a regular file has been created. If the command is ln -s sym file1 where the files are the same as in first example, file1 is overwritten and becomes a symbolic link to sym. If the command is ln file1 sym where the files are the same as in the first example, sym is overwritten and hard-linked to file1. When the last argument is a directory as in ln file1 sym symd where symd is a symbolic link to a directory DIR, and file1 and sym are the same as in the first example, the file DIR/file1 is hard-linked to file1 and DIR/sym is hard-linked to foo. Moving symbolic links This section describes the behavior of the mv(1) command. Like the ln(1) command, mv(1) deals with file names rather than file contents. With two arguments, a user invokes the mv(1) command to rename a file. Therefore, one would not want to follow the first argument if it is a symbolic link because it is the name of the file that is to be changed rather than the file contents. Suppose that sym is a symbolic link to /etc/passwd and abc is a regular file. If the command mv sym abc is executed, the file sym is renamed abc and is still a symbolic link to /etc/passwd. If abc existed (as a regular file or a symbolic link to a regular file) before the command was executed, it is overwritten. Suppose the command is mv sym1 file1 symd where sym1 is a symbolic link to a regular file foo, file1 is a regular file, and symd is a symbolic link that references a directory DIR. When the command is executed, the files sym1 and file1 are moved from the current directory to the DIR directory so that there are two new files, DIR/sym1, which is still a symbolic link to foo, and DIR/file1. In UnixWare, the mv(1) command uses the rename(2) system call. If the first argument to rename(2) is a symbolic link, rename(2) does not follow it; instead it renames the symbolic link itself. In System V prior to Release 4, a file was moved using the link(2) system call followed by the unlink(2) system call. Since link(2) and unlink(2) do not follow symbolic links, the result of those two operations is the same as the result of a call to rename(2).
3rd September 2011, 04:48 AM |#16  
Junior Member
Thanks Meter: 5
 
More
Thanks for adding the tut. Will be reading and will definitely try it out.

Thanks again!

Sent from my HTC Desire using XDA App
The Following User Says Thank You to jesseuy For This Useful Post: [ View ] Gift jesseuy Ad-Free
11th September 2011, 09:53 AM |#17  
Junior Member
Flag Colombo, Sri Lanka
Thanks Meter: 5
 
More
Thanks a lot for the tutorial. Basic stuff nicly explained. i tried the push method via adb to push a font into system/fonts directory still it says read only permission

Quote:

C:\Users\Mayu>adb shell
# mount
mount
rootfs / rootfs ro 0 0
tmpfs /dev tmpfs rw,mode=755 0 0
devpts /dev/pts devpts rw,mode=600 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
none /acct cgroup rw,cpuacct 0 0
tmpfs /mnt/asec tmpfs rw,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,cpu 0 0
/dev/block/mtdblock0 /system yaffs2 rw 0 0
/dev/block/mtdblock1 /data yaffs2 rw,nosuid,nodev 0 0
/dev/block/mtdblock2 /cache yaffs2 rw,nosuid,nodev 0 0
/dev/block/vold/179:0 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,n
id=1015,fmask=0702,dmask=0702,allow_utime=0020,cod epage=cp437,io
1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:0 /mnt/secure/asec vfat rw,dirsync,nosuid,no
000,gid=1015,fmask=0702,dmask=0702,allow_utime=002 0,codepage=cp4
8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /mnt/sdcard/.android_secure tmpfs ro,size=0k,mode=000 0 0

error mesg
Quote:

C:\Users\Mayu>adb push E:\soft\Android\Indic\DroidSansFallback.ttf \system\fonts

failed to copy 'E:\soft\Android\Indic\DroidSansFallback.ttf' to '\system\fonts':
Read-only file system

PS: pull works like charm. please guide me if u hav time. Thanks.
11th September 2011, 06:56 PM |#18  
Droidzone's Avatar
OP Inactive Recognized Developer
Flag Kochi
Thanks Meter: 2,296
 
Donate to Me
More
Quote:
Originally Posted by DroidMayu

Thanks a lot for the tutorial. Basic stuff nicly explained. i tried the push method via adb to push a font into system/fonts directory still it says read only permission



error mesg


PS: pull works like charm. please guide me if u hav time. Thanks.

Yup, on an s on system, even though system can be mounted as rewrite, writing isn't allowed. You have to execute the commands in recovery mode

Sent from my HTC Desire using XDA App
The Following User Says Thank You to Droidzone For This Useful Post: [ View ] Gift Droidzone Ad-Free
15th September 2011, 10:13 PM |#19  
Senior Member
Flag London
Thanks Meter: 76
 
More
Great tutorial! Thanks for that, definitely noob friendly...

Have a question about the following,

DATAOPTS:
(no option) - don't touch the data partition
-w - wipe the data partition
-d - flash the data partition

I have the Samsung Galaxy S I9000 (not sure if that makes a difference) and if my screen breaks or i have some sort of hardware problem. After flashing the stock rom back on do i use the above commands to wipe the evidence of any programs that suggest the device was previously rooted. If so which one wipe or flash?

Thanks
31st October 2011, 01:06 PM |#20  
puncha1580's Avatar
Senior Member
Flag Mumbai
Thanks Meter: 121
 
More
Wink Thank You!!!
Hey Droidzone,

I'm really in awe of you, and need to thank you for the amazing work you're doing here - at XDA.

I just can't find the thank you button on the forums.(I could be blind !!!)

Thanks a zillion!!!
23rd November 2011, 10:53 PM |#21  
OzBoy08's Avatar
Senior Member
Flag Melbourne
Thanks Meter: 15
 
More
I have found this tutorial very helpful. It has enabled me to play around with adb on a basic level without the fear of anything going wrong. Well done and many thanks.
Post Reply Subscribe to Thread

Tags
adb, android, desire, tutorial

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes