Sarath: Linux

Sarath

  • Embedded
  • Linux
  • Android
  • OpenSource

Post Top Ad

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, 7 August 2017

Disable Mouse Cursor in Touch Screen embedded Linux with X11

August 07, 2017 2


Disable Mouse Cursor in Touch Screen devices


When working with touch-screen interfaces or embedded systems you often don't want or need the mouse cursor.
 Most of the information I found about this specific topic described people either trying to use `xsetroot` or loading a cursor theme with all the cursors set to transparent. The following is, I believe, the correct solution.

Simply pass the nocursor option to the X server when you start it. There are a million ways to start X-Windows. 
I will list four variations. When using `startx` or `xinitrc` you can put these options in .xinitrc.

For my case i did ,
Edit : /etc/X11/Xserver

#!/bin/sh#XSERVER=/usr/bin/Xorg. /etc/profileARGS=" -br -pn  -nocursor"
DISPLAY=':0'exec xinit /etc/X11/Xsession -- $XSERVER $DISPLAY $ARGS $*

save the file and restart you machine.


Xorg -nocursor
X -nocursor
xinit -- -nocursor
startx -- -nocursor
Read More

Tuesday, 1 August 2017

Replacing the Linux logo with your own Logo

August 01, 2017 3

1 Create your own logo file



Create your logo in a .png format (logo.png), and run the following to convert it to a 224 colors PPM formatted image file named logo_linux_clut224.ppm :



 

2 Convert your logo file to PPM format


You needed to install netpbm and after that execute this steps:



$ sudo apt-get install netpbm





once you installed, follow below steps,



sarathkumar@Sarathkumar-RND:~/yocto_kernel_BBB/logo$ convert logo.png temp.ppm



sarathkumar@Sarathkumar-RND:~/yocto_kernel_BBB/logo$ ppmquant 224 temp.ppm > 

temp1.ppm 
ppmquant: making histogram...
ppmquant: 4251 colors found
ppmquant: choosing 224 colors...
ppmquant: mapping image to new colors...

sarathkumar@Sarathkumar-RND:~/yocto_kernel_BBB/logo$ pnmnoraw temp1.ppm > logo_linux_clut224.ppm



Steps:

convert logo.png temp.ppm
ppmquant 224 temp.ppm > temp1.ppm
pnmnoraw temp1.ppm > logo_linux_clut224.ppm 




Your own logo ready now. logo_linux_clut224.ppm is replacing exiting Linux penguin logo.


3 Replace the default logo file in the Linux source



Using the Linux source code directly

Follow the "Build Linux from source code" guide to get the Linux kernel source tree.

Copy your logo_linux_clut224.ppm file to {kernel_source}/drivers/video/logo/logo_linux_clut224.ppm overwriting the original logo.

Configure your kernel and enable the default logo instead of the your logo: Device Drivers -> Graphics support -> Bootup logo -> Standard 224-color Linux logo (Symbol: LOGO_LINUX_CLUT224)

Now you can build the kernel source and try to boot your kernel with newly compiled image with your own logo.




------------------------------------------------------------------------------------------------------------------------



If you want to create a different configuration for your own logo rather than overwriting the default one,  

follow below steps,

1.Edit : {kernel_source}/drivers/video/logo/Kconfig




config LOGO_CUSTOM_CLUT224           
        bool  "224-color Variscite Linux logo"             
        default y


/*  add above three lines before endif # LOGO of the file   */

2. Edit : {kernel_source}/drivers/video/logo/Makefile

obj-$(CONFIG_LOGO_SUPERH_CLUT224) += logo_superh_clut224.o
            obj-$(CONFIG_LOGO_CUSTOM_CLUT224) += logo_custom_clut224.o
obj-$(CONFIG_LOGO_M32R_CLUT224)+= logo_m32r_clut224.o
/*  insert the above green color line between those two lines of this file   */


3. Edit : {kernel_source}/drivers/video/logo/logo.c



#ifdef CONFIG_LOGO_SUPERH_CLUT224

/* SuperH Linux logo */

logo = &logo_superh_clut224;

#endif
 #ifdef CONFIG_LOGO_CUSTOM_CLUT224   
/* Custom Linux logo */   
logo = &logo_custom_clut224; 
#endif
#ifdef CONFIG_LOGO_M32R_CLUT224
/* M32R Linux logo */
logo = &logo_m32r_clut224;
#endif

/*  insert the above green color lines  in-between those           colour section of t, this file   */


4. Edit : {kernel_source}/include/linux/linux_logo.h

extern const struct linux_logo logo_spe_clut224;

           extern const struct linux_logo logo_custome_clut224;


/*  insert the above green color line below that         colour  lines of this file   */



5. Rename the Logo file  :

      rename the newly create logo file name from logo_linux_clut224.ppm  to   logo_custom_clut224.ppm

Configure your kernel and enable the your custom logo instead of the Linux logo: Device Drivers -> Graphics support -> Bootup logo -> Standard 224-color Linux logo (Symbol: LOGO_CUSTOM_CLUT224).




Read More

Saturday, 25 February 2017

An Introduction to Linux Basics

February 25, 2017 0

What is Linux ?

Linux is a free, open-source operating system. Linux has been under active development since 1991. It has evolved to be versatile and is used all over the world, from web servers to cellphones.
However, newcomers to Linux may find it difficult to approach the structure of an unfamiliar operating system.
This guide gently introduces key terminal skills and equips newcomers to learn more about Linux.

The Terminal

For most of the time you access a cloud server, you'll be doing it through a terminal shell. The shell allows you to execute commands on the droplet.
All administrative tasks can be accomplished through the terminal. This includes file manipulation, package installation, and user management.
The terminal is interactive. You specify commands to run. The terminal outputs the results of those commands. Executing any command is done by typing it and pressing Enter.

Linux filesystems are based on a directory tree. This means that you can create directories (or "folders") inside other directories, and files can exist in any directory.
To see what directory you are currently active in:
pwd
This stands for "print working directory", and will print the path to your current directory. The output can look similar to this:
/home/foo
This means that your current active directory is foo, which is inside home, which lives in the root directory, /.
To see other files and directories that exist in your current working directory:
ls
This will give you a list of names of files and directories. To navigate into a directory, use its name:
cd <name of directory>
This will change your new current working directory to the directory you specified. You can see this with pwd.
Additionally, you can specify .. to change to the directory one level up in your path. To get back to your original directory:
cd ..
We can also create new directories in our current working directory. For example, to create a new directory called bar:
mkdir bar
Then we can
cd
into bar if we want. We can also delete bar if we no longer find it useful:
rm -d bar
rm -d
will only delete empty directories.

File Manipulation

Files cannot be used with
cd
(it stands for "change directory").
Instead, we can view files. Say we have a file baz in our current directory:
cat baz
This will print out the entire contents of baz to the terminal.
With long files, this is impractical and unreadable. To paginate the output:
less baz
This will also print the contents of baz, but one terminal page at a time, beginning at the start of the file.
Use the spacebar to advance a page, or the arrow keys to go up and down one line at a time. Press q to quit out of less.
To create a new file called foobar:
touch foobar
This creates an empty file with the name foobar in your current working directory. The contents of this file are empty.
If we decide foobar isn't such a good name after all, we can rename foobar to fizzbuzz:
mv foobar fizzbuzz
mv
stands for "move" and it can move a file or directory from one place to another.
By specifying the original file, we can "move" it to a new location in the current working directory, thereby renaming it.
It is also possible to copy a file to a new location. If we want to bring back foobar, but keep fizzbuzz too:
cp fizzbuzz foobar
Just as you guessed,
cp
is short for "copy". By copying fizzbuzz to a new file called foobar, we have replicated the original file in a new file with a different name.
However, what good is a file if it contains nothing? To edit files, a file editor is necessary.
There are many options for file editors, all created by professionals for daily use. Such editors include vim, emacs, nano, and pico.
nano is a perfectly suitable option for beginners. It is easy and simple to use, with no bells or whistles to confuse the average user.
To edit text into foobar:
nano foobar
This will open up a space where you can immediately start typing to edit foobar.
To save the written text, press
Ctrl-X
then y. This returns you to the shell with a newly saved foobar file.
Now foobar has some text to view when using
cat
or
less
.
Finally, to delete the empty fizzbuzz:
rm fizzbuzz
Unlike directories, files are deleted whether they contain content or not.

The Filesystem Hierarchy Standard

Nearly all Linux distributions are compliant with a universal standard for filesystem directory structure.
The FHS defines clearly determined directories for different purposes.
The symbol / is used to indicate the root directory in the filesystem hierarchy defined by the FHS.
When a user logs in to the shell, they'll be brought to their own user directory in /home.
The FHS defines /home as containing the home directories for regular users. (root has its own home directory in /root, also specified by the FHS.)
Because default, common-sense locations are provided for many different kinds of files, organisation of files for different purposes is simplified.

Permissions

On a system with multiple user accounts, determining who is allowed to interact with what files is important.
Linux supports unix-style file system permissions, which restricts who can read and write certain files.
Permissions are an expansive and profound topic in 

A Culture of Learning

So far, this guide only serves to teach the basics of toddling around in a Linux environment. But finding your way around the Linux environment requires dedication and a curious mindset.
When you have a question about how to accomplish a task, there are several avenues of instruction you can turn to.
First and foremost, Google and DuckDuckGo are invaluable resources. Odds are that if you have a question, many others have already asked it and had the question answered.
Your immediate instinct should be to look for the answer through those search engines.
When your question has to do with any Linux command, the manual pages offer detailed and insightful documentation for nearly every single command.
To see the man-pages for any command:
man <command>
For instance,
man rm
displays the purpose of rm, how to use it, what options are available, examples of use, and more useful information.
Gaining the information you seek is an essential skill, which will sustain your Linux career for as long as you stay devoted to a time of learning.

Read More

Saturday, 23 March 2013

40-Basic Linux command-line . . .

March 23, 2013 0
1.  Everything in Linux is a file including the hardware and even the directories.
2. # : Denotes the super(root) user
3.  $ : Denotes the normal user
4.  /root: Denotes the super user’s directory
/home: Denotes the normal user’s directory.
5.  Switching between Terminals
§  Ctrl + Alt + F1-F6: Console login
§  Ctrl + Alt + F7: GUI login
6.  The Magic Tab: Instead of typing the whole filename if the unique pattern for a particular file is given then the remaining characters need not be typed and can be obtained automatically using the Tab button.
7.   ~(Tilde): Denotes the current user’s home directory
8.   Ctrl + Z: To stop a command that is working interactively without terminating it.
9.  Ctrl + C: To stop a command that is not responding. (Cancellation).
10.  Ctrl + D: To send the EOF( End of File) signal to a command normally when you see ‘>’.
11.  Ctrl + W: To erase the text you have entered a word at a time.
12.  Up arrow key: To redisplay the last executed command. The Down arrow key can be used to print the next command used after using the Up arrow key previously.
13.  The history command can be cleared using a simple option –c (clear).
14.  cd :   The cd command can be used trickily in the following ways:
cd : To switch to the home user
cd * : To change directory to the first file in the directory (only if the first file is a directory)
cd .. : To move back a folder
cd - : To return to the last directory you were in
15.  Files starting with a dot (.) are a hidden file.
16.   To view hidden files: ls -a
17.   ls: The ls command can be use trickily in the following ways:
ls -lR : To view a long list of all the files (which includes directories) and their subdirectories recursively .
ls *.* : To view a list of all the files with extensions only.
18.   ls -ll: Gives a long list in the following format
drwxr-xr-x 2 root root 4096 2010-04-29 05:17 bin where
drwxr-xr-x : permission where d stands for directory, rwx stands for owner privilege, r-x stands for the group privilege and r-x stands for others permission respectively.
Here r stands for read, w for write and x for executable.
2=> link count
root=>owner
root=>group
4096=> directory size
2010-04-29=>date of creation
05:17=> time of creation
bin=>directory file(in blue)

The color code of the files is as follows:
Blue: Directory file
White: Normal file
Green: Executable file
Yellow: Device file
Magenta: Picture file
Cyan: link file
Red: Compressed file
File Symbol
-(Hyphen) : Normal file
d=directory
l=link file
b=Block device file
c=character device file
19.  Using the rm command: When used without any option the rm command deletes the file or directory ( option -rf) without any warning. A simple mistake like rm / somedir instead of rm /somedir can cause major chaos and delete the entire content of the /(root) directory. Hence it is always advisable to use rm command with the -i(which prompts before removal) option. Also there is no undelete option in Linux.
20.  Copying hidden files: cp .* (copies hidden files only to a new destination)
21. dpkg -l : To get a list of all the installed packages.
23. Use of ‘ > ‘ and ‘ >> ‘ : The ‘ > ‘ symbol ( input redirector sign) can be used to add content to a file when used with the cat command. Whereas ‘ >> ‘ can be used to append to a file. If the ‘ >> ‘ symbol is not used and content is added to a file using only the ‘>’ symbol the previous content of the file is deleted and replaced with the new content.
e.g: $ touch text (creates an empty file)
$ cat >text
This is text’s text. ( Save the changes to the file using Ctrl +D)
$cat >> text
This is a new text. (Ctrl + D)
Output of the file:
This is text’s text.
This is a new text.

23.  To count the number of users logged in : who |wc –l

24.  cat:  The cat command can be used to trickly in the following way:
- To count no. of lines from a file : cat <filename> |wc -l
- To count no. of words from a file : cat <filename> |wc -w
- To count no. of characters from a file : cat <filename> |wc –c

25.  To search a term that returns a pattern: cat <filename> |grep [pattern]

26.  The ‘tr’ command: Used to translate the characters of a file.
tr ‘a-z’ ‘A-Z’ <text >text1 : The command for example is used to translate all the characters from lower case to upper case of the ‘text’ file and save the changes to a new file ‘text1′.
27.  File permission using chmod: ‘chmod’ can be used directly to change the file permission of files in a simple way by giving the permission for root, user and others in a numeric form where the numeric value are as follows:
r(read-only)=>4
w(write)=>2
x(executable)=>1
e.g. chmod 754 text will change the ownership of owner to read, write and executable, that of group to read and executable and that of others to read only of the text file.
28.  more: It is a filter for paging through text one screenful at a time.
Use it with any of the commands after the pipe symbol to increase readability.
e.g. ls -ll |more
29.  cron : Daemon to execute scheduled commands. Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates.
1 * * * * echo “hi” >/dev/tty1 displays the text “hi” after every 1 minute in tty1
.—————- minute (0 – 59)
| .————- hour (0 – 23)
| | .———- day of month (1 – 31)
| | | .——- month (1 – 12) OR jan,feb,mar,apr …
| | | | .—– day of week (0 – 7) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
* * * * * command to be executed
Source of example: Wikipedia
30.  fsck: Used for file system checking. On a non-journaling file system the fsck command can take a very long time to complete. Using it with the option -c displays a progress bar which doesn’t increase the speed but lets you know how long you still have to wait for the process to complete.
e.g. fsck -C
31.  To find the path of the command: which command
e.g. which clear
32. Setting up alias: Enables a replacement of a word with another string. It is mainly used for abbreviating a system command, or for adding default arguments to a regularly used command
e.g. alias cls=’clear’ => For buffer alias of clear
33.  The du (disk usage) command can be used with the option -h to print the space occupied in human readable form. More specifically it can be used with the summation option (-s).
e.g. du -sh /home summarizes the total disk usage by the home directory in human readable form.
34.  Two or more commands can be combined with the && operator. However the succeeding command is executed if and only if the previous one is true.
e.g. ls && date lists the contents of the directory first and then gives the system date.
35.  Surfing the net in text only mode from the terminal: elinks [URL]
e.g: elinks www.google.com
Note that the elinks package has to be installed in the system.
36.  The ps command displays a great more deal of information than the kill command does.
37.  To extract a no. of lines from a file:
e.g head -n 4 abc.c is used to extract the first 4 lines of the file abc.c
e.g tail -n 4 abc.c is used to extract the last 4 lines of the file abc.c
38.  Any changes to a file might cause loss of important data unknowingly. Hence    Linux creates a file with the same name followed by ~ (Tilde) sign without the recent changes. This comes in really handy when playing with the configuration files as some sort of a backup is created.
39.   A variable can be defined with an ‘=’ operator. Now a long block of text can be assigned to the variable and brought into use repeatedly by just typing the variable name preceded by a $ sign instead of writing the whole chunk of text again and again.
e.g ldir=/home/my/Desktop/abc
cp abcd $ldir copies the file abcd to /home/my/Desktop/abc.
40. To find all the files in your home directory modified or created today:
e.g. find ~ -type f -mtime 0

For a continuation of this topic refer to our next stone  . .
Read More