TIPS: The beginning of Linux

Source: Internet
Author: User
Tags gz file gdb debugger

Recently, it was a bit of a dream to start learning Linux for a long time! When I first went to school, I didn't listen to the Linux class seriously. I was not interested. I was boring. Later I graduated and found that there were a lot of Linux talents needed in the society, so I started to think about how to learn Linux. Unfortunately, I don't have time. This is really a good time for the company to do a project without manpower, so I caught it! Well, after hesitating, I decided to keep my eyes on it. Don't repeat the stupid process of the student age. ◎ _ ◎!
In the past two days, we plan to clarify the basic commands of Linux and use them skillfully. Then we will start shell programming, GCC and GDB development, and finally design MiniGUI and arm. I don't know how much time it will take, but it is good to learn new things every day. The following is what I learned over the past two days:
[Datetime] 2006-08-09
[Title] completes a basic Linux Embedded Open Process
1.generate the inner image file uimageand the file system file SC _ramdisk.gz
2. Configure the kernel
3. Enable the TFTP service and provide the network port connection between the Development Board and PC.
4. Write the boot script uboot
5.download uimageand SC _ramdisk.gz to the Development Board through the network port
6. Set a mount point on the PC.
7. debug your ownProgram

[Title] Linux commands learned today
[Cmd] echo $ Lang
[DESC] view language packs
[Cmd] grep
[DESC] searches for the lines matching the command line in the given file and prints them out.
[Cmd] useradd
[DESC] Add a user
[Cmd] passwd
Desc: Set the user password.
[Cmd] Su
[DESC] switch users
[Cmd] ls | more
[DESC] combined list and pipeline commands | more is used to display content by PAGE
[Cmd] Mount
[DESC] mount point
[Cmd] mkdir
[DESC] create a directory
[Cmd] switchdesk
[DESC] switch Desktop

[Title] content to be learned in Flaw Detection
1. Familiar with Linux commands, file operations, software compression and packaging, file system, remote control, shell scripts
2. GCC compiler, gdb debugger, kernel, connection process, Interface Programming
3. Arm architecture and system guidance process
4. Write the driver

[Datetime] 2006-08-10
[Title] Samba Server
Today, I encountered a problem: how can windows not connect to the Linux server? I think there may be something wrong with the Samba server, so I started to study the configuration of the Samba server.
The Samba server has a configuration file named smb. conf under/etc/samba/, which defines several sections [Global] [home].... In the global section, several important fields are the NT domain name or working group name provided by workgroup; Server String provides the specified service information, which is usually the samba service; hosts allow allows you to log on to the host list of Linux-Samba using IP information. After modifying these fields, restart the Samba server (the samba execution file is/etc/rc. d/init. d directory. The command for restarting the server is $. /SMB stop; $. /SMB start. Then a new user password (# smbpasswd-a user) is reset ). The result of restarting the server is still ineffective. Windows still cannot connect to the server. At last, I tried to use Telnet to log on, but Telnet could not log on either. Using the ifconfig command, I found that the inet ADDR field is not an IP address, so I went to X Windows to view the NIC settings. It turns out that the NIC was not enabled. Enable the NIC.

[Title] use of VI Editor
When using the VI editor, you can find that you cannot modify the content of an existing file in the Windows operating mode, if the file is in read-only status, You need to press the Insert key on the keyboard to enter the editing status. If you modify the file, the VI editor requires that you save the file before exiting (save command: W, exit command: Q). You can also use (: WQ ). In VI, the ESC key is used to switch from edit mode to command mode.

[Title] File build command tar
In linuxlinux, A. tar.tar.gz file is often used. A. tar.gz file is a structure file. A. tar file is a compressed file. Linux provides the following command parameters for operations on the .tar file:
Create a structure file: The file content is displayed when tar CV is created.
Tar CVF [object] [Source]
View tar file content: Tar TF view structure file list
Tar tvf view detailed file information
Tar tzf viewing compressed file information
Decompress the tar.gz file: Tar xzf [dir]. You can use the-C option to specify the directory location.

[Title] Linux Programming
In Linux, if you use C or C ++ for programming, the GCC compiler and gdb debugger provide you with powerful programming control capabilities. At present, I have only learned a little about these two tools. I am going to study these two tools after familiarizing myself with most Linux commands.
GCC settings:
-O generates an executable file and performs some optimization.
-G is used to generate debugging settings. To debug GDB, this item must be added.
Note: note the order of the two parameters.-o-g is optimized before debugging information is added, which may be inconvenient for debugging. -G-o adds debugging information before optimization, but if you want to debug it, we recommend that you only use-g for compilation.
GDB settings:
-Q: no license information is displayed.
-D: display the executable program directory
[Error | .. /sysdeps/i386/ELT/start. s; there is no file or directory] the cause of this error is that the-O written in the above note is in front of-G or does not use-g for compilation. The solution is to re-compile with-G.
The basic commands commonly used in GDB are listed below:
[Cmd] File
[DESC] load the executable file to be debugged
[Cmd] Kill
[DESC] terminate the program being debugged
[Cmd] list [M, N]
Desc: List executable files Source code In the preceding example, m and n are the row numbers of the start and end rows with the first error. If M is not included, n is the same as that of the last 10 rows.Code .
[Cmd] Next
[DESC] executes a line of source code, but does not enter the function.
[Cmd] Step
[DESC] executes a line of source code and enters the function.
[Cmd] Run
[DESC] run the program currently debugged
[Cmd] Quit
[DESC] Terminate GDB
[Cmd] Watch variable
[DESC] monitors the value of a variable.
[Cmd] Break [linenum | funcname] [If expr]
[DESC] sets a code breakpoint, which can be a row number or function name, or a conditional expression.
[Cmd] Make
[DESC] an executable file can be generated without exiting.
[Cmd] print
Desc: print the value of a variable.
[Cmd] Delete
[DESC] deletes a breakpoint.
[Cmd] disable
Desc: Disable breakpoints.
[Cmd] continue
[DESC] information after the breakpoint is resumed
[Cmd] Shell
[DESC] use shell commands in GDB
You still need to work hard!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.