ECE472/572 (UCLX) Assignment 10
Prepare for the lab - direct questions
Answer these questions while doing this lab – they will help you understand the procedure and better prepare for the tests.
- Look around and find on your hard drive the header files for the include files <linux/xxxx.h> Hint: look for a directory under
- Look into
man rtc and explain if ioctl RTC_RD_TIME command and read from "file" do the same thing. If not, then what does read return?
- Check the real time clock device file name both on your Ubuntu Linux and on ucLinux. Hint:
ls -l /dev/rt* . Pay attention to capital o and to zero.
- What is the difference between open and fopen?
- What does ioctl do?
- What does lsusb do?
- What is UDEV? What is
EUDEV? What does udevadm command do? Why
a tool like this became necessary?
- What is the file /etc/group? What groups do you see predefined inside?
- Observe the group ownership of devices like /dev/ttyS*, /dev/ttyUSB*,
/dev/input/, /dev/video*, /dev/audio*, /dev/rtc, and others. What groups do you see? Which devices are accessible only by root? (Make a note of your findings for the sake of possible question at the exam.)
- Optional experiments: If you have access to the needed resources observe:
- What happens when you connect more than one USB-based mouse to the system? (Touchpad might count as the first mouse.) Watch for /dev/mouse* and /dev/mice
- What happens when you connect more than one USB-to-serial converter?
Prepare for the lab - indirect questions
- A set of questions about partition tables and partitions:
- What is the maximum number of partition tables that can be located on one disk?
- What is the maximum number of partition entries that are stored directly in one partition table?
- Disregard practical limitations of disk capacity and data processing time, what is the maximum number of partitions on one disk?
- Are there any emerging standards (not yet fully adopted) that can cause that there are two sets of correct answers to this group of questions?
- Windows "format d: /s" or Linux mkfs -t ext2" - are they perform high level disk formatting, or low level disk formatting?
- Consider: GRUB, LILO, SYSLINUX, NTLDR: which ones can load only an operating system which ones can load only another
boot loader, which ones can do both?
- Is legacy floppy disk boot record a master or volume boot record?
- What is the maximum file name or path name in number of characters on the following file systems: FAT-12, FAT-32, NTFS, ext2,3,4?
- What is the maximum file name or path name in number of characters in case of CDROM/DVD file systems: ISO, Joliet, UDF?
Activity 1 (20pts.)
- Find and inspect the Linux rtc device. Run
ls -l /dev/rt*
- Capture the screen that shows who can access the device and to what capacity.
- Change the access restrictions and add another alias for the
udevadm info -a -p /sys/class/rtc/rtc0 and observe its output
- Edit/create the content of the file
/etc/udev/rules.d/10-local.rules and add the
SUBSYSTEM=="rtc" KERNEL=="rtc0" SYMLINK="clock" MODE="0666" GROUP="uclinux"
sudo udevadm control --reload-rules
sudo udevadm trigger
ls -l /dev/rt* /dev/cl*
- Capture the view of the output of the
ls command above.
- Refer to the example program that illustrates use of direct read and
write as well as ioctl in order to access features of the RTC device.
Write a short program that accesses
or its equivalent and prints the current time of the hardware clock.
- Use the following loose program
outline. Please note that we will read the clock state not
by reading from the device file (like we did in case of
joystick) but instead by executing ioctl with parameter
RTC_RD_TIME and the pointer to a variable of type
- Capture the view of the output of the program you wrote.
- Pack together using tar-gz or tar-bz the three screen captures
and the source code of the program.
The activity for BB and RPI was tested by Madison Straubhaar, class of 2017.
Cross-compile your program and transfer it to the board.
Test your program by running it on the board. Use
- Provide a typescript or alternatively a series
screen capture starting with running running uname -a followed ls -alF
/sys/class/gpio as well as the contents of each of the activated pin
- Inspect the GPIO access description
provided on ARMhf Web site.
- Test you ability to set up and control the digital IO pins on the board
of your choice. Use
sudo only if absolutely necessary.
case you cannot find the location of GPIO drivers for your board - redo Lab
6 correctly and put it on your SD card. Pay attention to the correct
settings of make linux-menuconfig.
- Inspect what needs to be
done to set up one of the on-board LED pins as an output and control it.
Use shell commands like
echo "text" > /device_nae_with_path
- inspect the results of each step using
ls -l /path_as_needed
- In case the pin of your choice was already set up, remove the
settings so that the pin is no longer available.
Document as needed.
- Activate the gpio pin as an output pin.
Verify using appropriate
ls -l commands.
Write down what you did. Document as needed.
- Verify that you can control the LED by sending subsequently "0" and
"1" several times and observing the LED behavior.
- In the regular Linux box:
- Write a short program in C that toggles one of the board LEDs once per second.
- UseUse open the file for writing, write to the file, close the file
sequence instead of each echo redirection
- Use open the file for reading, read a line from the file, and
close the file sequence instead of each cat
if absolutely necessary.
Pack together using tar-gz or tar-bz the screen captures
or typescript(s) and the
code of the program.
Details for BeagleBone
The LEDs on the BBB are on GPIrootOs 53,54,55,56 pin numbers.
The S2/boot button is on GPIO 72 pin number.
(pressed value is 0, released value is 1.)
Details for RaspberryPi
First, disable the predefined actions on the two LEDs (until the next system
echo none > /sys/class/leds/led0/trigger
echo none >
The GREEN LED is on GPIO47.
The RED LED is on GPIO35.
The USB high
power mode LED is on GPI38.
Raspberry Pi3B design disabled direct access
to these LEDs using low-level GPIO. Instead, you have to use the predefined devices
located at /sys/class/leds/.
Drop the file with the information collected during the exercise as instructed
in the corresponding assignment drop box on Sakai.