ECE472/572 (UCLX) Assignment 7
Prepare for the lab
Answer these questions while doing this lab – they will help you understand cross-compiling and program transfer procedure.
Even though this lab may not seem as much work please do study the utilities in question in order to be prepared for the exam.
- What is the difference between a regular compiler on your system, a cross-compiler for the plain AVR32 or BeagleBone executable, and the cross-compiler that you just set up to use?
- What are their names on your system? (Provide the gcc cross-compiler file name specific to your Linux setup if asked at the exam.)
- Where are these tools located? (Provide folder name specific to your Linux setup if asked at the exam.)
- What other tools are available in the cross-compiler folder? (Just peek at the folder, you probably will not be asked this question at the exam.)
- What is the role of
.bashrc in bash shell?
- What is the name and location of the global shell configuration file equivalent to .bashrc?
- What is the use of PATH environment variable?
- What is /etc/environment configuration file, if present on your system?
- What is umask?
- What are ifconfig, ifdown,
- What are the differences between HyperTerm/putty/minicom (1), telnet (2), ssh (3), and rlogin (4)?
- What are the differences between ftp (1), sftp (2), and scp (3)?
- What is the difference between ssh (1) and
- Why it was important to assign a password to account that we want to access remotely over the network?
- In case of problems with transferring the file using network the file can be placed directly on the SD card as the last resort solution. Why typically it needs to be done as a root even if the file is to be placed in a regular user folder? (Think file ownership!)
- Why is it possible to access the embedded system through its serial port? Hint: check /etc/inittab for getty, and etc/securetty.
- What is the purpose of the file /etc/fstab ?
- In file /etc/passwd each user is assigned one number. What is the use of that number in the Linux system?
- In file /etc/group each group has zero to
several users listed at the end of the line. What does that mean?
- What is the significancce of the /home
Activity 1 (30pts.)
Cross-compiling and data transfer among Linux systems
- Write a simple "Hello World" program that prints to the standard
output text "Hello, World, my name is <insert your name here>".
- In order to enable direct access to the cross-compiler for ucLinux for
your target uC Linux board type the following line after opening a console window:
- Go to the folder that you have just added to the path and find out the
name for the compiler. In order to make it permanent, edit the file
/home/userid/.bashrc. You do not need to use
export in the .bashrc
This file is used to configure every
new terminal window that runs bash shell. If you run a different shell
then find out what needs to be modified in your case.
- Compile the program on the development platform (Ubuntu) to run on your
target board that runs ucLinux. Name the output file hw7_yourname.ucl_bin
- Use HyperTerminal to access the embedded board. You may log in as root
for now. However, we will create a regular user account to run tests.
- Run ifconfig or /sbin/ifconfig
- Write down the ip_address that is assigned to your board. It should be something like 192.168.*.*.
Note that IP addresses in the lab are not assigned on permanent basis and might change over time, especially if the board is powered off for extended period of time.
- Check if the directory /home/
exists. If not, add it:
- Edit /etc/fstab/
- look for the names of SD card aprtitions the way they are
visible from the uC Linux.
- They may not look like /dev/sdx
- They may look like /dev/mmcblkxpy
- In BeagleBone you can see one or two disks, one of them will
have three partitions.
- You should see one disk with three partitions. USe the third
and last partition of that disk.
- Add a line to fstab that looks like the line that defines the
mount point for / except that:
- it uses the partition above /dev/mmcblkxpy
as the source
- and the /home/ as the
- make it read-write in case the original partition is
- Save the file. sync, reboot, and login again.
- Create a new user called uclinux and a
new group called uclinux. If you are not logged in as root use
sudo in front of each command.
- Set the password for the new user to "ee00"without ""s. Some systems would not allow you to use SSH or SCP with the destination system password than is blank.
- Make sure that the user has its password set. If not, run
- Known issue: Make sure that the user's home directory
exists. Some buildroot systems do not have the home directory
included in the build. If so, manual set up is required.
- Check if the /home directory
ls -lF /
- If not run:
- Check if the user's home directory exists:
ls -lF /home
- If not run:
chown uclinux /home/uclinux
chgrp uclinux /home/uclinux
- Keep the HyperTerminal running until you verify that you can connect using
ssh as described below. If you cannot connect to it using
ssh because either DHCP or
dropbear on the embedded board did not start, then keep using the HyperTerminal to perform the steps described below.
Known issue: If you have not applied the patch sent by
email after Lab 6 was completed then make sure that the Ethernet cable is
connected to the board while the board is booting.
- Test if you can access the board over the network instead.
- Read manual entry for ssh command.
- ssh ip_address -l uclinux
- uname -a
- Keep it running. You will need it in order to test if your compiled program runs.
- Copy your program to the uC Linux environment. Investigate various possible ways to do so..
- Read manual entry for scp command.
- Read manual entry for scp command.
- Use scp to copy the compiled program.
- If the computer that runs Ubuntu is connected directly to the computer lab network
- Since your Ubuntu runs inside a virtual machine the only practical way is to run
scp on Ubuntu and copy the file onto the board.
- If you are running Ubuntu directly then you can test your skills further by running
scp inside the
ssh terminal and pull the file from your Ubuntu instead.
- If the computer is your laptop that is connected through wireless network
- Use a third party Unix system such as
personlapages.bradley.edu and access it using
scp both from ucLinux and from your laptop regardless whether you run Linux directly or on the virtual machine.
- If you connected your laptop (illegally?) to the lab computer network, or if you are using your own setup at home - you can use it the same way as the lab computer except you will not be able to see the Internet outside of the lab.
- scp hw7_yourname.ucl_bin uclinux@ip_address:
- Use SSH or HyperTerminal to verify that you received the file on the microcontroller board and run it. You did not specify the destination folder, e.g.
/var/tmp. Where did you find the copied program? Who was it's owner?
- As a last resort put the SD card in the reader and place the binary file directly into the file system. You have to be root to do that, and the instructor will see that the file is owned by root.
- In certain cases you may be able to copy the file as a regular user. After booting ucLinux is the file still owned by the user with the same name?
- Test your program on the embedded board by executing the following instructions on the embedded board either through
PuTTY or minicom, or
- uname -a
- ls -al hw7*
- Capture the screenshot of the terminal on your local computer and submit as a proof of doing this lab.
Submit the screenshot in the corresponding assignment drop box on Sakai.