github

bill88t / ljinux

  • пятница, 18 марта 2022 г. в 00:30:36
https://github.com/bill88t/ljinux


A "linux" in python, for the rpi pico!



Ljinux

A "linux" written in python, for the Raspberry Pi Pico.

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

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

It runs on the rpi pico, circuitpython 7.
You can optionally attach a SSD1306 display for output, a ds1302 RTC (make sure to set fixrtc to false from config.json) 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.)
More info in Configuration.
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 details at 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 pico's internal storage or on the /boot/ of the attached sd card.

Installation to a fresh pi pico:


Install CircuitPython 7.X.X onto the pico (uf2 file can be found here & detailed instructions regarding CircuitPython can be found here), and unzip this entire repo (or a release), except for the "source" folder onto the CIRCUITPY drive.
This is also a good time to install the libraries for the hardware you wish to connect to it. Details in Configuration.
Then eject it and fully disconnect it from the pc. (It is important to power cycle the pi.)
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)
IMPORTANT NOTE: To make the pi appear as a usb device, run the command devmode.

Configuration

GPIO PINS:
For the SSD1306 display: GP17(scl), GP16(sda) - libraries needed: adafruit_ssd1306 adafruit_framebuf
For the ds1302 RTC: GP6(clk), GP7(data), GP8(ce) - libraries needed: ds1302
Left button GP19 - Right Button GP18 - Enter Button GP20
Piezo buzzer: GP15
Sdcard: GP2(clk),GP3(mosi),GP4(miso), GP5(cs) - libraries needed: adafruit_sdcard adafruit_bus_device
Ethernet: GP10(clk), GP13(cs), GP11(mosi), GP12(miso) - libraries needed: 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 pico.

Contributors:

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

Build instructions for linux:

In order to build & upload a binary different than the one provided to the pico, enable developer mode on the pico and from within the "source" folder, run make.
The binary will be automatically uploaded to the pico and be used upon the next reload/reboot of the device.
In order for it to complete successfully you need to have the pico mounted to /media/$(shell whoami)/LJINUX/.

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.