Running the Simplest "Hello Liunx" Program on Embedded Linux

I had long wanted to study Linux in a long time ago, but the time was limited and the Linux threshold was rather high and it was not easy to get started. Recently, due to the embedded Linux used in the tunnel project (Linux on the Arm CPU), and the hardware-providing units have high programming fees for Linux and take a long time, hesitates to decide to start learning Linux in depth and learning process. Finish the scheduled task.

I did not expect that running the simplest "Hello Liunx" program on embedded Linux took a lot of hard work, but the effort was satisfactory. After a few days of hard work, it was finally successful. I'll say my process below. I have a reference for later people.

To run the program in embedded Linux, you need to solve the following problems:

1, need a Arm-based gcc cross compiler;

2. It is required that Windows interact with Linux on the VPC in order to exchange files;

3. The embedded Linux system needs to interact with the Linux or Windows system on the VPC to interact with files.

The first problem, which is relatively easy to solve, is the cross-2.95.3.tar.bz2 installation package for direct and intermediate vendors. This is a cross-editor based on the ARM platform. Simply extract to any directory.

The second question, which was somewhat thorny, investigated certain information and finally found a feasible solution.

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

2. After the VM is running, type: smbmount //ip address or computer name/shared folder name on the Linux command line.

3, Ok, the connection is successful.

The third question, originally thought very easily, but did not think it is the most difficult, the middle manufacturer's approach is as follows:

Development using the NFS directory mounted on the target board

Host: NFS server

1, modify the configuration file etc/exports, such as

/nfs/rootfs 192.168.0.X(rw,sync,no_root_squash) //Specifically omitted

2, configured to be readable for all users, chmod 644 /etc/exports

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

4, check the firewall, do not shield the corresponding port

Target board: kernel needs to 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

According to the above step by step, the target board prompts RPC what kind of error, online search information, use Servers command to open the service, unfortunately, the target board does not support the Servers directive.

Finally found that the target board supports FTP server, the total number found a life-saving straw, but unfortunately, the user password is unknown, asked the middle vendor, the user and password is still wrong, and finally made n calls, telling you can add new users on the target board, Then log in to FTP.

The horror is that useradd is not taught in the book. Then the file on the target board's bin is checked. The adduser command was originally used to add the user. However, the FTP client on Linux is not good, Windows does not work, but had a FlashFXP software, you can also.

Write the following program in the virtual machine's Liunx system:

#include

Int main(int argc,char **argv)

{

Printf("hello linux/n");

}

Writing a 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 Make command at the command line to generate tt file

Copy the tt file to the target board through the FTP client.

Start directly input [root @ ()] $ tt no response, check the data and found that this is the case (below), why? For the time being do not know!

[Root @ ()] $ ./tt, unexpectedly there is an error message, the prompt is as follows: -sh:./tt: Permission denied

The information on the Internet indicates that the authority is not enough. You need to run the following command: chmode 777 tt

After the operation, I was told that without this command, it was found that the original was chmod (it seems that the name of the instruction was modified by the middle manufacturer).

After running chmod 777 tt, go to run ./tt ^^#$^#$@&# OK --- successful!

Postscript: linux usage habits and windows are very different, Linux networking needs to activate the network card to work, run the file need. / XXX format, and have permission to the user to perform similar problems, for a linux rookie, It was a blocker one after another, but by now it was close to the threshold. For me, the road behind is still very long and the difficulties have only just begun...

Refrigerators and Freezers

tcl , https://www.tclgroupss.com

Posted on