GSoC23: Writing a Hello World Driver for BeaglePlay

Hello everyone. I will go over setting up BeaglePlay for Driver Development in this post. I will write a simple “Hello World” driver once BeaglePlay is set up to demonstrate this. Check out my previous post for more information about my project.

Setup BeaglePlay

Update board with the latest software

  1. Download the flasher image from distros page.
  2. Flash this image onto an SD Card. I used balenaEtcher for this.
  3. Insert SD Card and boot the board. The lights will start flashing in the following order: 0-1-2-3-2-1-0 in a loop. This signifies that image is being flashed into eMMC.
  4. The board will power down once the flashing is over. Remove the SD Card now.

Setup Networking

  1. Connect the Board to Linux Host using USB.
  2. SSH into the board. The default credentials are as follows:
    • username: debian
    • password: temppwd
    • hostname: beagleplay.local
  3. Connect to WiFi using wpa_cli:
    1. Run wpa_cli.
    $ wpa_cli
    1. Use scan and scan_results to see available networks.
    > scan
    > scan_results
    bssid / frequency / signal level / flags / ssid
    00:00:00:00:00:00 2462 -49 [WPA2-PSK-CCMP][ESS] MYSSID
    11:11:11:11:11:11 2437 -64 [WPA2-PSK-CCMP][ESS] ANOTHERSSID
    1. To associate with MYSSID, add the network, set the credentials, and enable it:
    > add_network
    > set_network 0 ssid "MYSSID"
    > set_network 0 psk "passphrase"
    > enable_network 0
    <2>CTRL-EVENT-CONNECTED - Connection to 00:00:00:00:00:00 completed (reauth) [id=0 id_str=]
    1. If the SSID does not have password authentication, you must explicitly configure the network as keyless by replacing the command set_network 0 psk "passphrase" with set_network 0 key_mgmt NONE.
    2. Finally, save this network in the configuration file and quit wpa_cli:
    > save_config
    > quit

Now it should be possible to ssh into BeaglePlay without being connected using USB.

Copy SSH key

Since we have to ssh into the BeaglePlay so many times, it is better to use ssh key instead of password.

  1. Check if the ssh key is present:
ls -al ~/.ssh
  1. Generate new ssh key if not present.
  2. Copy public key to BeaglePlay:
ssh-copy-id [email protected]

You should now be able to ssh into BeaglePlay without a password.

Build Kernel

While building the kernel module on BeaglePlay is possible, I prefer using my Linux host device for development. As such, I needed to have the BeaglePlay kernel source on my host.

  1. Download the [beagle kernel] source using git:
git clone && cd linux
  1. Check out the branch corresponding to BeaglePlay’s Kernel. In my case, BeaglePlay was running 5.10.168
git checkout v5.10.168-ti-arm64-r103
  1. Copy the config from BeaglePlay.
scp [email protected]:/boot/config-5.10.168-ti-arm64-r103 ./.config
  1. Download dependencies. I am listing the fedora linux dependencies here:
sudo dnf install bison flex gcc-aarch64-linux-gnu -y
  1. Generate config from the previous one:
make ARCH=arm64 CROSS_COMPILE=/usr/bin/aarch64-linux-gnu- oldconfig
  1. Build the kernel
make ARCH=arm64 CROSS_COMPILE=/usr/bin/aarch64-linux-gnu- -j${nproc}
  1. Generate compiler_commands.json to use LSP:
python scripts/clang-tools/

Build Kernel Module

Now we will build a simple “Hello World” module for our BeaglePlay Kernel.

  1. Create a new directory for our project:
mkdir hello-world
  1. Write a Makefile:
obj-m += hello-world.o

KDIR ?= /lib/modules/$(shell uname -r)/build

	make -C $(KDIR) M=$(PWD) modules

	make -C $(KDIR) M=$(PWD) clean
  1. Write hello-world.c:
#include <linux/init.h>
#include <linux/module.h>
#include <linux/printk.h>

static int __init bcf_greybus_init(void) {
  pr_info("Hello World 1.\n");
  return 0;

static void __exit bcf_greybus_exit(void) { pr_info("Goodbye World 1.\n"); }


MODULE_AUTHOR("Ayush Singh [email protected]>");
MODULE_DESCRIPTION("A simple Hello World Driver");
  1. Build the Module:
make KDIR=${PATH_TO_BEAGLE_KERNEL} ARCH=arm64 CROSS_COMPILE=/usr/bin/aarch64-linux-gnu- -j12

Run on BeaglePlay

  1. Copy the module to BeaglePlay:
scp hello-world.ko [email protected]:~/
  1. Install Module in BeaglePlay:
sudo insmod hello-world.ko
  1. Remove Module:
sudo rmmod hello_world
  1. Check out the Kernel logs using dmesg:
dmesg -H


The Kernel module I am writing for GSoC 23 can be found here. You can follow my GSoC23-related blog posts using this feed.

Consider supporting me if you like my work.