COL788: Embedded Computing


Lab Assignment – 2


Due Date: 4th Oct, 2016. 5pm.


Objective:

  1. Compiling and running default kernel on Raspberry Pi board.

  2. Implementing your own system call, as in lab1 and test it on the board.

  3. Implement a loadable kernel module (LKM) and test it on the board.

  4. A simple producer consumer app being created and tested on the board.


Procedure:


  1. 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/

  2. Follow instructions at https://www.raspberrypi.org/documentation/linux/kernel/building.md to get the raspbian sources and tools to compile the sources.

  3. 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.

  4. Once you have the kernel built and booting, proceed with the next assignment to implement system calls.

  5. The system call implemented during lab1 should be now implemented for the new kernel and run it on the board.

  6. 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

  7. Once LKM flow is working, write your own LKM to do the following:

    1. Read a value from a device node /dev/my_in_device

    2. Write the read-value from the device node to /dev/my_out_device

    3. Take care of overflow and underflow in the process

  8. 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:

  1. 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.

  2. 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.

  3. Use serial connection to the raspberry pi board and check the boot messages.