BeagleBoard/GSoC/2021 Proposal/beagle config

= Proposal for Beagle Config =


 * Student: Shreyas Atre
 * Mentors: Kumar Abhishek (IRC: Abhishek_ )
 * Code: [N/A]
 * Proposal : https://elinux.org/index.php?title=BeagleBoard/GSoC/2021_Proposal/beagle_config
 * Wiki: [N/A]
 * GSoC: [N/A]

= Status =
 * Pre-application phase

= Proposal =
 * Completed all the general requirements
 * Completed "Hello Wolrd" of cross compilation mentioned in the requirements list.
 * Sent a PR to the mentioned upstream #145

About You

 * IRC : satacker (@satacker:matrix.org)
 * Github: https://github.com/SAtacker/
 * School: Veermata Jijabai Technological Institute (VJTI)
 * Country: India
 * Primary language : English, Hindi, Marathi
 * Typical work hours : 10AM - 7PM Indian Standard Time
 * Experience :
 * PID-Tuning-GUI is my Graphing Qt application as well as for sending data to esp32 microcontroller using Boost.ASIO as Netowrking stack in order to configure the Proportional-Integral-Derivative (PID) Controller.
 * kernel learn is a repo I had created for kernel learning purpose in which I had learned Kernel module development Basics.
 * I have realised the beauty of embedded systems after working on esp32 dev board and reading Exploring Linux with Beaglebone by Derek Molloy while in Society of Robotics and Automation as a core team member.
 * This is the first time i am participating in GSoC

= About Your Project =


 * Project name: Beagle Config

Description

 * As we all know, nearly all of the user operations in Linux can be done using shell commands , scripts and Linux Userspace Api for advanced users. But all that being said for an average user and sometimes in production these steps can be repetitive and time consuming. For example- Simply sharing network i.e. editing iptables and enabling forwarding on the host pc is an uphill task without a script provided. However running scripts could be dangerous.
 * Enabling the PRU and loading the firmware is much daunting and unless anybody goes through their usage Documentations it will be difficult.
 * Hence I propose beagle-config which is a terminal based UI application that brings down the steep curve and enables anybody to config their beagle device as they wish. Also a host side application to enable ICS
 * Not only does it makes beagle devices more friendly but provides an edge to beagle devices over other similar platforms.
 * Also while configuring sometimes if the script has hard coded values it makes difficult for the user to go back to default configurations. With beagle-config that won't be a problem anymore
 * Goal : Beagle-Config aims to provide the functionality to make the most common low level configuration changes in beagle devices easily and providing a terminal UI to do the same as well as a host side application for ICS

Implementation Details

 * Beagle-Config consists of a host side application developed with cross platform framework Qt.
 * Beagle-Config on user (board) side which will use bash, C/C++ as back end for low level access to linux's userspace api and FTXUI for frontend.
 * All the configuration options are stored in user's home directory inside ~/beagleconf.json
 * A restore to defaults option

Host

 * Internet Connection Sharing Enabling nn linux as well as windows
 * console for SSH within the application

System Options
The system options sub menu allows you to make configuration changes to various parts of the boot, login and networking process, along with some other system level changes.

This will enable hobbyists to enable / disable their PRUs (/var/lib/cloud9/common/Makefile TARGET=gpio.prux start) if they want to test their PRU code in c or in simppru (Checks and asks if they want to install). Example - PRU Conf PRU 1 Enable Disable PRU 2 Enable Disable Enabling a GPIO pin for input/output using config-pin Example - GPIO 18 - Enable Disable Set Value For beaglebone blue motor driver, servo driver configurations
 * PRU enable/disable
 * GPIO configuration

Enables users to share their host internet within a click Example - Host Host A                       Enable Internet Advanced Set IP gateway Return to Defaults Host Name          BBB Edit Country Code      
 * Internet Sharing and Client Configurations

Enables users to extend the sd card partition size if available Example - eMMC Storage       Total 52 % Free Extend
 * eMMC stats

apt-mark hold and make a note of it in json
 * Freeze Packages

For wireless enabled devices like beaglebone black wireless configuring Access Point names, mDNS configurations, etc
 * Wireless Configurations

If beagle bone has onboard sensors then enabling them, viewing stats For ex. on Beaglebone Blue 9-axis IMU, barometer,thermometer, and a balancing LiPo charger are present
 * Sensor Stats and Configurations

Configure passwords along with addition of users, groups
 * Password

We can configure whether to boot in desktop mode or using just console enabled. Add option to login automatically.
 * Boot / Auto login

Configure the USR Leds on the board. Their frequency and events.
 * User LED

Firmware - apt update and upgrade to update your system,
 * Firmware Update

Display Options
Enable configuration of HDMI/DVI if the board supports it
 * Resolution

Interfacing Options
Performs apt install bb-cape-overlays If a beagle board and its associated cape needs a configuration, this can be configured here easily.
 * Cape Configurations

Enable any standard camera interface and additional configurations
 * Camera

Configure ssh, enable / disable and setup password
 * SSH

Enable/disable SPI and I2C interfaces and automatic loading of the SPI / I2C kernel modules if there are any existing.
 * SPI and I2C

U-Boot /boot/uEnv.txt configuration in /boot/uEnv.txt: enable_uboot_overlays=1 To Disable eMMC: disable_uboot_overlay_emmc To Disable HDMI VIDEO & AUDIO: disable_uboot_overlay_video disable_uboot_overlay_audio disable_uboot_overlay_wireless disable_uboot_overlay_adc
 * Provide an easy interface to manage uboot overlays

Enable or disable a read-only file system
 * Overlay File System

Select your local time zone, starting with the region, e.g. India, then selecting a city, e.g. Mumbai. Type a letter to skip down the list to that point in the alphabet.
 * Timezone

Configures Keyboard layout
 * Keyboard

Update Beagle-Config
 * Update

Show strings, license, author, version name and kernel version
 * About

Experience and approach

 * Previously I have worked with Qt and Boost.ASIO . PID-Tuning-GUI is an application that sends data to ESP32 micro controller which supports WiFi connectivity. Handled Application threads and Plotting of data as well as sending user input to microcontroller.
 * kernel learn is a repo I had created for kernel learning purpose in which I had learned several Kernel development Basics.
 * I have played with pocketbeagle for a month and learned a lot about u-boot, device trees and Loadable Kernel Modules.
 * This gives me best of both the worlds embedded as well as a bit in frontend (Qt).

Contingency

 * There is a good documentation of FXTUI and Qt
 * Plenty of examples to get me through if I am stuck.
 * Past experience regarding Qt and DOM manipulation combined with experience in embedded and loadable kernel modules development will pay off in this duration.

Benefit

 * Having a seamless one click experience to configure is enjoyed by any user, be it production or a robotics team.
 * Provides a configuration file to the users. Remembers defaults and helps in accidental modification to low level configurations.

Misc

 * For hello_world of cross compilation, sent a PR to the mentioned upstream #145

Future Work

 * Theme options
 * Flashing functionality can be added instead of making the user download a third part application like etcher
 * An IDE within the beagle-config host