Skip to content

Beryllium OS, a unix-like operating system for CircuitPython powered microcontrollers. (Formerly known as ljinux)

License

Notifications You must be signed in to change notification settings

beryllium-org/OS

Repository files navigation

Ljinux

A "linux" written in python, for CircuitPython powered microcontrollers.
Code style: black

Important note:
Do not take this project seriously.
This is not a real os / linux distribution, but here we are.

We also now have a discord server! If you need help, feel free to hop on for some support.

Anyways, since you are still reading let's start with the basics.

Depends on circuitpython 7.
At the moment the supported microcontrollers are:
- Raspberry Pi Pico
- Waveshare RP2040-Zero
But it can probably run on many more.
The only real limiting factor should be ram, as about 150k are needed for the system to even function.
If you have gotten it running on an unsupported board, feel free to pr a configuration file.


You can optionally attach a SSD1306 display for output, a ds1302 RTC
      (make sure to set fixrtc to false from config file)
      for persistent time or a w5500 networking breakout board for networking.

For the missing hardware the functions will be automatically deactivated. (The hardware will also be deactivated in case of missing libraries.)
It expects to find a /LjinuxRoot folder which uses as it's root. It can be on the built in fs, or an sd card.
More info in Configuration.

It's structure:

It's shell which is named based, is equivelant to gnu bash.
Python can also be used with the pexec command.
You can execute commands over serial to it, or by feeding them from a Init.lja file.
The Init.lja has to be at /LjinuxRoot/boot/ of the board's internal storage or on the /boot/ of the attached sd card.

Installation to a fresh board:


Note: Automatic Windows install not supported at the moment. Linux & MacOS only.

  1. Install CircuitPython 7.X.X onto the board
    Raspberry Pi Pico uf2 file can be found here & detailed instructions regarding CircuitPython can be found here.
  2. Clone (or download this project) and from within it run make install.
  3. Install the optional libraries for the hardware you want to connect to it. Details in Configuration.
    If you plan on using the board standalone, you don't need put any extra libraries in.
  4. After these steps, eject the board and fully disconnect it from the pc. (It is important to power cycle it.)
    When it's plugged back in, it should run automatically and you can connect to it via serial. (You can use putty on windows, or gnu/screen on gnu/linux)
    An automated connection script exists in the form of make connection
    IMPORTANT NOTE: To make the pi appear as a usb device, run the command devmode

Configuration

Each board has it's own different pin configuration. You can see the defaults and modify them from the board's respecive config file.

Libraries needed for optional hardware:
For the SSD1306 display: adafruit_ssd1306 adafruit_framebuf
Sdcard: adafruit_sdcard adafruit_bus_device
The sdcard has to be formatted as Fat32 / Fat16 or equivelant.
Ethernet: adafruit_wiznet5k adafruit_wsgi adafruit_requests adafruit_bus_device

The neccessary libraries can be found here
Download the zip (The 7.x-mpy variant), extract it & copy the libraries you want onto /lib of the board.

Connection

For an automated way on Linux/MacOS, run make connection. Manual way below.

To connect to the board it's recommended to use Putty for Windows and GNU/Screen for Linux/MacOS.
For Putty, select connection type to be Serial, select the port to be COMX where X is the number of the serial port allocated by the board and set the speed/baudrate to 115200. (You can find which com port is allocated from within the Device Manager, it usually is COM3 or COM4)

For GNU/Screen, if you are on linux, you need to be in the dialout user group and to connect, run: screen /dev/ttyACM0 115200
If you are on a Mac instead, run: ls /dev/tty.usb* to find the device name, and connect to it by running: screen /dev/tty.usb<Device name here> 115200
Example: screen /dev/tty.usbmodem12210 115200

To disconnect, press Ctrl + A, K and confirm with y.
To be added to the dialout group, run sudo usermod -a -G dialout <your username here>

Contributors:

-> bill88t - @bill88t#4044
-> Marios - @mariospapaz#2188
-> mdaadoun - @mdaadoun#4475

Build instructions for Linux / Macos:

In order to build & upload a kernel binary different than the one provided to the board, enable developer mode from within ljinux and then from within the "source" folder of the project, run make. To update all the board files (commands, kernel, etc.) run make install
The binary will be automatically uploaded to the board and be used upon the next reload/reboot of the device.

A complete Ljinux manual can also be found at:

https://github.com/bill88t/ljinux/blob/main/Manual.txt

More stuff will be added later as the project spirals into chaos.