COL788: Embedded Computing
Lab Assignment – 2
Due Date: 4th Oct, 2016. 5pm.
Objective:
Compiling and running default kernel on Raspberry Pi board.
Implementing your own system call, as in lab1 and test it on the board.
Implement a loadable kernel module (LKM) and test it on the board.
A simple producer consumer app being created and tested on the board.
Procedure:
Firstly download an existing image of raspbian and check it to be working on the board to ensure that all components are in order. You can download the raspbian lite image, or the full image, as per your preference. https://www.raspberrypi.org/downloads/raspbian/
Follow instructions at https://www.raspberrypi.org/documentation/linux/kernel/building.md to get the raspbian sources and tools to compile the sources.
Copy the built kernel on the SD Card and check the board to boot properly, to ensure that the build flow is proper. Proceed with below steps only if all the above are complete successfully.
Once you have the kernel built and booting, proceed with the next assignment to implement system calls.
The system call implemented during lab1 should be now implemented for the new kernel and run it on the board.
Once system call building is completed, we will learn about Loadable Kernel Modules (LKM). Implement a basic LKM for hello world as given at https://github.com/notro/rpi-source/wiki/Examples-on-how-to-build-various-modules
Once LKM flow is working, write your own LKM to do the following:
Read a value from a device node /dev/my_in_device
Write the read-value from the device node to /dev/my_out_device
Take care of overflow and underflow in the process
Using the LKM from previous step, write a user app to test the above LKM. The user app should produce different data to the my_in_device and monitor and verify the data over the my_out_device.
Tips and Tricks:
How to check if raspberry pi is booting properly:
Connect it over LAN and run IP-scan. If you see your raspberry pi, do an ssh to that IP address. Default username: pi, password: raspberry.
If you have HDMI cable, you can connect it to a monitor and keyboard and check the boot has happened or not. Then you can get IP address from there itself.
Use serial connection to the raspberry pi board and check the boot messages.