BeagleBoard/GSoC/2021 Proposal/beagle config
Contents
- 1 Proposal for Beagle Config
- 2 Status
- 3 Proposal
- 4 About Your Project
- 4.1 Description
- 4.2 Implementation Details
- 4.3 Host
- 4.4 User (Board)
- 4.4.1 System Options
- 4.4.1.1 PRU enable/disable
- 4.4.1.2 GPIO configuration
- 4.4.1.3 Internet Sharing and Client Configurations
- 4.4.1.4 eMMC and MicroSD stats
- 4.4.1.5 Freeze Packages
- 4.4.1.6 Wireless Configurations
- 4.4.1.7 Sensor Stats and Configurations
- 4.4.1.8 Password
- 4.4.1.9 Boot / Auto login
- 4.4.1.10 User LED
- 4.4.1.11 Firmware Update
- 4.4.2 Display Options
- 4.4.3 Interfacing Options
- 4.4.1 System Options
- 4.5 Timeline
- 4.6 Misc
- 4.7 Future Work
Proposal for Beagle Config
- Student: Shreyas Atre
- Mentors: Arthur Sonzogni, Kumar Abhishek (IRC: Abhishek_ ) , Deepak Khatri (IRC: lorforlinux)
- Code: https://github.com/SAtacker/beagle-config
- Proposal : https://elinux.org/index.php?title=BeagleBoard/GSoC/2021_Proposal/beagle_config
- Wiki: [N/A]
- GSoC: Accepted https://summerofcode.withgoogle.com/projects/#6718016412188672
Status
- Pre-application phase
Proposal
- Completed all the general requirements
- Completed "Hello World" 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: 10 AM - 7 PM 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 Networking stack to configure the Proportional-Integral-Derivative (PID) Controller.
- kernel learn is a repo I had created for kernel learning purposes in which I had learned Kernel module development Basics.
- I have realized 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 a 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. This explains that using a compiled program instead can implement safe and proper security.
- Enabling the PRU and loading the firmware is much daunting and unless anybody goes through their usage, Documentations will be difficult.
- Hence I propose beagle-config', a terminal-based UI application that brings down the steep curve and enables anybody to configure 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 is difficult for the user to go back to default configurations. With beagle-config that won't be a problem anymore. Beagle-Config will store the defaults at /usr/local/share/ and user configurations in /home/user/.config/beagle-config/Backups/config.json . This ensures portability and helps in reverting to defaults in case settings are unwanted.
- 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.
Reason to choose Qt: It seems that Qt satisfies the objectives which are Good Documentations, Fewer dependencies, and as for deployment electron is easier but Qt is not much difficult. This isn't performance-critical right now but if in the future it adds some performance-critical activity then Qt would be great here.
- 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.
Comparision of a few text-based GUI
Name | Description |
---|---|
ink |
|
terminal-kit |
|
tvision |
|
blessed contrib |
|
urwid |
|
FXTUI |
|
This wasn't a detailed review but definitely, I would choose FXTUI despite its newness, I feel it has all that I need and doesn't involve dependencies while providing a DOM manip. functional style like react.
- All the configuration options are stored in the user's home directory inside /home/user/.config/beagle-config/Backups/config.json
- A restore to defaults option
Host
- Internet Connection Sharing Enabling in Linux as well as windows
- Using netsh or PowerShell scripts
- Remaining part is handled using qt-console GUI and cmdlets/PS scripts
User (Board)
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.
PRU enable/disable
This will enable hobbyists to enable/disable their PRUs (/var/lib/cloud9/common/Makefile TARGET=gpio.prux start) and 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
- Recipe Outline -
- It will essentially be a wrapper around make targets (clpru and lnkpru ,the PRU compiler and linker are already installed on the standard images.)
- The PRUs appear in the Linux file space at /sys/devices/platform/ocp/4a32600*.pruss-soc-bus/4a300000.pruss
Note: If it comes out that the addresses are not fixed I would have to traverse through the ocp node until I discover "pruss-soc-bus"
- Select .out file and copy to /sys/devices/platform/ocp/4a32600*.pruss-soc-bus/4a300000.pruss/lib/firmware/am335x-pruX-fw (X=0,1)
GPIO configuration
Enabling a GPIO pin for input/output using config-pin Example -
GPIO 18 - Enable Disable Set Value
- Recipe Outline -
- Now there's config-pin utility available by default.
- Also traversing through /sys/class/gpio is an option
Internet Sharing and Client Configurations
Enables users to share their host internet with a click Example -
Host Host A Enable Internet Advanced Set IP gateway Return to Defaults Host Name BBB Edit Country Code <Select Menu>
- Recipe Outline -
- Ask for user password
- Add routes for default gateways
- Add nameservers IP addresses
- On host side -
- If Linux then configures USB Ethernet with default IP address and iptables rules.
- If windows then use `net start SharedAccess` (Windows 7) or Powershell script
eMMC and MicroSD stats
Enables users to extend the sd card partition size if available Example -
eMMC Storage Total 52 % Free -------- Extend --------
- Recipe Outline -
- Uses fdisk, resize2fs tools while giving options to the user about partion size and available size
- Reference microSD resize
- There are boot scripts provided by rcn-ee
- Implementing resizer scripts similar to above link
Freeze Packages
apt-mark hold <package> and make a note of it in JSON
Wireless Configurations
For wireless-enabled devices like beaglebone black wireless configuring Access Point names, mDNS configurations, etc
- Recipe Outline -
- Wireless configurations using conmanctl
- Enable /etc/systemd/resolved.conf and turn MulticastDNS=yes
- The other way is by using Avahi
- Specifying the configuration file
- Configurations include host name , domain-name (default is .local)
Sensor Stats and 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
- Recipe Outline -
- I am assuming that device trees stay for long ahead
- Once again this could be done in iio class or sensors class
- The procedure is the same as cd /sys/class/sensor/thermal && cat temperature or voltage of DAC
Password
Configure passwords along with the addition of users, groups
- Recipe Outline -
- Nothing more than a simple password changing utility
- Add accounts functionality similar to a desktop using simple Linux admin tools
Boot / Auto login
We can configure whether to boot in desktop mode or using just console enabled. Add option to login automatically.
- Recipe Outline -
- Similar steps as in remove-root-password
- We have to remove the user password
User LED
Configure the USR LEDs on the board. Their frequency and events.
- Recipe Outline -
- sysfs's led class just like i can change the keyboard's brightness using echo "1" >> /sys/class/leds/asus::kbd_backlight/brightness
Firmware Update
Firmware - apt update and upgrade to update your system,
- Recipe Outline -
- Provide timely update option
- wrapper for apt update and apt upgrade
Display Options
Resolution
Enable configuration of HDMI/DVI if the board supports it
- Recipe Outline -
- Changing the xorg configuration /etc/X11/xorg.conf
- Or using xrandr example xrandr --output HDMI-0 --mode 720x480 --rate 60
Interfacing Options
SSH
Configure ssh, enable/disable, and setup password
- Recipe Outline -
- Enable ssh (if not) from /etc/ssh/sshd_config
- Password configuration using PermitRootLogin without-password or yes
- Remote auth e/d using ChallengeResponseAuthentication
- x11 forwarding using ForwardX11
Provide an easy interface to manage uboot overlays
- Recipe Outline -
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
Overlay File System
Enable or disable a read-only file system Basically, the writes put a lot of pressure on SD cards, we can disable and use it read-only when not needed.
- Recipe Outline -
- Change the root mount to read-only
- Add a couple of temporary file systems to handle logs. This will contain the option for logging size.
- Backup the old fstab
- Alternative -
- Overlay file systems have been defaulted in since Kernel 3.18
- Essentially we can create a top-level directory that can be modified while having the layers beneath to be read-only
- mount -t overlay overlay -o lowerdir=/lower,upperdir=/upper,workdir=/work /merged . Note - work should be an empty directory
- Update the init ramfs image and uEnv.txt
Update
Update Beagle-Config
- Recipe Outline -
- First way is to create a ppa reference
- Second is to make Github releases and code the application to check for a new release
About
Show strings, license, author, version name, and kernel version
Timeline
Date | Status | Details |
---|---|---|
13/04/2021 to 17/05/2021 | Application Review Period |
|
17/05/2021 to 07/06/2021 | Community Bonding |
|
14/06/2021 | Milestone #1 |
configurations |
21/06/2021 | Milestone #2 |
configurations |
28/06/2021 | Milestone #3 |
configurations |
05/07/2021 - 10/07/2021 | Milestone #4 |
|
17/07/2021 | Milestone #5 |
configurations |
24/07/2021 | Milestone #6 |
|
31/07/2021 - 03/07/2021 | Milestone #7 |
|
10/08/2021 | Milestone #8 |
|
17/08/2021 | Milestone #9 |
|
24/08/2021 | Milestone #10 |
|
31/08/2021 | Milestone #11 | Completion of GSoC |
Experience and approach
- Previously I have worked with Qt and Boost.ASIO. PID-Tuning-GUI is an application that sends data to ESP32 microcontroller which supports WiFi connectivity. Handled Application threads and Plotting of data as well as sending user input to the microcontroller.
- kernel learn is a repository 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 the best of both the worlds embedded as well as a bit in the frontend (Qt).
Contingency
- There is good documentation of FXTUI and Qt
- Plenty of examples to get me through if I am stuck.
- experience regarding Qt and DOM manipulation combined with experience in embedded and loadable kernel module 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.
Quotes
- lorforlinux: "The idea is pretty good albeit now polished. I wanted to deliver a similar terminal gui app with my project last year ... "
- jkridner: Getting a nice UI and defining what the settings are seems really useful.
Misc
- For hello_world of cross-compilation, sent a PR to the mentioned upstream #145
Future Work
- Theme options
- Webserver for beagle-config (jkridner's idea)
- Flashing functionality can be added instead of making the user download a third-party application like etcher
- An IDE within the beagle-config host