Running Linux on the RP2040
This project uses CNLohr's mini-rv32ima RISC-V emulator core to run Linux on a Raspberry Pi Pico, using SPI PSRAM chips as system memory. The Linux kernel and root filesystem are stored on an SD card.
This project overvolts and overclocks the RP2040! Use at own risk!
The configuration and pin mapping can be modified in the rv32_config.h file.
The SD card operates in SPI mode, with the following default pinout:
The RAM chips are connected with the following default pinout:
The VGA display is connected as follows:
The PS/2 keyboard data pin is connected to GPIO26 and the clock pin to GPIO27. 5V to 3.3V level shifting must be used between the PS/2 keyboard and the RP2040!
The system console can also be exposed over USB-CDC or UART. By default, the VGA and USB consoles are active. This can be changed from the config file.
The SD card needs to be formatted as FAT16 or FAT32. Prebuilt Linux kernel and filesystem images are provided in this repository. They must be placed in the root of the SD card. If you want to build the image yourself, you need to run make
in the linux
folder. This will clone the buildroot source tree, apply the necessary config files and build the kernel and root filesystem image.
On powerup, the board waits for the BOOTSEL button to be pressed. After it has been pressed, the Linux kernel will be copied into RAM. In a few seconds, kernel messages will start streaming on the console. The boot process takes around 30 seconds. The Linux image includes a fork of the c4 compiler/interpreter, the duktape JavaScript interpreter and the Lua interpreter, as well as a variety of Linux utilities and the coremark benchmark.
VGA console:
Serial (USB or UART) console: