Cross Compiling and Running an Application on an Embedded Linux System

  • Next Post
  • Previous Post

Cross Compiling and Running an Application on an Embedded Linux System

1 – Install Ubuntu(14.04)

2 – NFS Server Installation and Configuration
NFS (Network File System) is a distributed file system that allows a cilent computer to access files over a network. Ubuntu machine will be used as the host while the client will be the embedded system.

2.1 – NFS Server Installation
On the host machine we will need nfs-server-kernel package. To install this package from terminal:

sudo apt-get update
sudo apt-get install nfs-kernel-server

2.2 – Setting up share directories

mkdir /home/username/nfstest

Where “username” is the user folder name we are using. This folder will be used to share files between the host and the client machines.

2.3 – Configuring NFS Exports on the host and starting the service

Open /etc/exports file with a text editor of your choice with root priviliges.

add the line /home/username/nfstest *(rw,sync,no_root_squash,no_subtree_check)

The first path is the share folder on the host. * client ip address, in this case any client can access the folder. The strings inside paranthesis denote the options. In this case:

rw-> Client machine is allowed to both read and write
sync-> NFS writes to disk before replying
no_subtree_check-> Prevent subtree checking
no_root_squash -> Allows the client to access with root priviliges.

Then we create the NFS table with:
sudo exportfs -a
And start the NFS service with:
sudo service nfs-kernel-server start

To check if the NFS server is running properly:
rpcinfo -p | grep nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
2.4 – Mounting

On the client we create a mount point with:

sudo mkdir -p /home/username/nfstest  or any folder name we wist to sync with NFS folder.

To mount:
sudo mount -o tcp,nolock <host-ip>:/home/username/nfstest /home/username/nfstest

To check NFS shares that have been mounted:
mount -t nfs

2.5 – Testing NFS Access

Create a file on the host with:
sudo touch /home/username/nfstest/test_file

The test_file should be accessible from the client machine

2.6 – Unmounting

sudo umount /home/username/nfstest
3 – Cross-Compiler Installation and Example Program

On the host machine:
apt-get install gcc-arm-linux-gnueabi

Create a file and write a hello world C program. Cross compile the program with:
gcc-arm-linux-gnueabi-gcc filename.c -o filename

Put the resulting executable file inside the NFS folder we have created in the previous steps. The program should be runnable on the client system.

August 27, 2015 / Uncategorized / Tags: , , ,

Share the Post

About the Author

Comments

No comment yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Next Post
  • Previous Post