Standalone BMC
Contents
1 Description
This article will explain how to add a home-made BMC (A single board computer that runs Parabola) to a desktop computer running GNU/Linux to control it remotely.
The following functionalities are available through SSH:
- power on/off
- virtual serial console
- network
2 How does it work
Most ARM single board computers have:
- some GPIOs
- USB OTG or USB device port
- Some network interface like an Ethernet interface
The GPIOs are just pins that can be controlled in software: Most of them can be set to 0 (0 volt) or one (something like 3.3 volt or some other voltage depending on the single board computer). They can be used to control the power and reset buttons of the desktop computer (by adding something called a relay).
The USB device port can be used to emulate many USB peripherals such as an hard disk, a network interface, a serial interface, etc. This can be used to communicate with the desktop computer.
Many ARM single board computers also have a free software bootloader, so it's better to check if the board you want to buy is is not fatally flawed.
3 USB OTG
This configuration script enables:
- Ethernet over USB
- Two serial port over USB
#!/bin/sh set -x set -e gadget="/sys/kernel/config/usb_gadget/otg" mkdir -p ${gadget} echo 0x0525 > ${gadget}/idVendor echo 0xa4a7 > ${gadget}/idProduct mkdir -p ${gadget}/configs/otg.1/ # Serial: ttyGS0 mkdir -p ${gadget}/functions/acm.usb0 if [ ! -e ${gadget}/configs/otg.1/acm.usb0 ] ; then ln -s ${gadget}/functions/acm.usb0 ${gadget}/configs/otg.1/acm.usb0 fi # Serial: ttyGS1 mkdir -p ${gadget}/functions/acm.usb1 if [ ! -e ${gadget}/configs/otg.1/acm.usb1 ] ; then ln -s ${gadget}/functions/acm.usb1 ${gadget}/configs/otg.1/acm.usb1 fi # Ethernet mkdir -p ${gadget}/functions/ecm.usb0 if [ ! -e ${gadget}/configs/otg.1/ecm.usb0 ] ; then ln -s ${gadget}/functions/ecm.usb0 ${gadget}/configs/otg.1/ecm.usb0 fi if [ "$(cat ${gadget}/UDC)" != "" ] ; then echo > ${gadget}/UDC fi echo "$(ls /sys/class/udc/)" > ${gadget}/UDC
You can copy it to /usr/local/bin/usb-otg.sh and enable it with the following systemd service:
[Unit] Description=USB OTG settings [Service] Type=oneshot RemainAfterExit=yes ExecStart=/usr/local/bin/usb-otg.sh [Install] WantedBy=default.target
4 Usage
Here the user would ssh into the single board computer and run some scripts to power on/off the desktop computer, get a console, setup network, etc