Embedded Linux programming, my first hard journey

Source: Internet
Author: User
Tags ftp client
Embedded Linux programming, my first difficult trip-Linux general technology-Linux programming and kernel information. The following is a detailed description. In fact, I wanted to learn more about Linux from a very early time, but the time was limited, and the Linux threshold was very high, not very easy to get started. Recently, because embedded Linux (Linux on Arm CPU) is used in the tunneling project, and the hardware units are charged a lot for Linux programming, and it takes a long time, so I am hesitant, I decided to start to study Linux in depth and complete the scheduled tasks during the learning process.

I didn't think that running the simplest "Hello Liunx" program on Embedded Linux took a lot of trouble. However, after a few days of hard work, I finally succeeded, next, let me explain my journey and give it a reference for later users.

To run programs in Embedded Linux, you need to solve the following problems:
1. An Arm-based gcc cross compiler is required;

2. Interaction between Windows and Linux on VPC is required to exchange files;

3. the embedded Linux system must interact with the Linux or Windows System on the VPC to facilitate file interaction;

The first question is to compare and easily solve the problem. The central manufacturer and the central manufacturer have to come to the cross-2.95.3.tar.bz2 installation package, which is a cross editor based on the Arm platform. Directly decompress the package to any directory.

The second problem is tricky. I checked some information and finally found a feasible solution.

1. Create a shared folder in Windows XP, such as "share"

2. After the VM is running, run the following command in Linux: smbmount // ip address or computer name/Shared Folder name mount point.

3. OK. The connection is successful.

The third question is that it is easy to think about, but not the most difficult. The intermediate vendor's approach is as follows:

Development with NFS Directory mounted to the target board

HOST: NFS server
1. modify the configuration file etc/exports, as shown in figure
/Nfs/rootfs 192.168.0.X (rw, sync, no_root_squash) //

2. configure it to read all users, chmod 644/etc/exports

3. Let the NFS server reload etc/exports,/etc/init. d/nfs reload

4. Check the firewall and do not block the corresponding port
Target Board: the kernel must support NFS

1. Enable:

File Systems à

Network File Systems à

NFS file system support

Provide NFSv3 client support

After the configuration, recompile the kernel.

2. After the target board is started, mount? T nfs 192.168.0.Y:/nfs/rootfs/mnt? O nolock
As shown in the previous step, the target board prompts RPC errors and the like. It is a pity that the target board does not support the Servers command to access the Internet and use the Servers command to start the service.

Finally, I found that the target board supports FTP servers. The total number of FTP servers found a life-saving path. Unfortunately, the user password was unknown. I asked the intermediate manufacturer, the user and password were still incorrect, and finally made n calls, you can add new users to the target board and then log on to FTP.

It is terrible that there was no useradd in the books. Later, I checked the file on the target board bin. It turned out to be the adduser command. I can log on to it. However, the FTP client on linux is not easy to use, and Windows does not work either. I had to launch a FlashFXP software.

Write the following program in the Liunx System of the virtual machine:
# Include
Int main (int argc, char ** argv)
{
Printf ("hello linux \ n ");
}

Compile Makefile
All: tt
Tt: test. c
/Usr/local/arm/2.95.3/bin/arm-linux-gcc-o tt test. c
Clean:
-Rm-rf tt

Run the Make command on the command line to generate the tt File

Copy the tt file to the target board through the FTP client. Start directly entering [root @ ()] $ tt without response. Check the information and find that the original is like this (as shown below). Why? I don't know yet!

[Root @ ()] $./tt, an error message is displayed, with the following message:-sh:./tt: Permission denied.

If the permission is insufficient, run the following command: chmode 777 tt.

After running the command, I was told that it was chmod (it seems that the command name has been changed by the Intermediate manufacturer ).

After chmod 777 tt is run, run./tt ^ # $ ^ #$ @ & # OK --- succeeded!

Note: The usage habits of linux are quite different from those of windows. To run a file, you must activate the NIC for linux networking. the/XXX format can only be executed by users with permissions. Similar to a small problem, for a linux cainiao, It is a obstacle after another, but now it is close to the threshold, for me, there is still a long way to go and the difficulty is just getting started.

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.