Home Tech The way to get began with FUZIX on Raspberry Pi Pico

The way to get began with FUZIX on Raspberry Pi Pico

9


FUZIX is an old-school Unix clone that used to be to begin with written for the 8-bit Zilog Z80 processor and launched by way of Alan Cox in 2014. At one time one of the vital lively Linux builders, Cox stepped back from kernel building in 2013. Whilst the preliminary announcement has been misplaced within the mists as a result of he made it at the now defunct Google+, Cox jokingly really useful the gadget for the ones eager for the great previous days when the entire supply code nonetheless fitted on a unmarried floppy disk.

FUZIX operating on Raspberry Pi Pico.

Since then FUZIX has been ported to different architectures similar to 6502, 68000, and the MSP430. Previous within the week David Given — who wrote each the MSP430 and ESP8266 ports — went forward and ported it to Raspberry Pi Pico and RP2040.

So you’ll now run Unix on a $Four microcontroller.

Construction FUZIX from supply

FUZIX is a “correct” Unix with a serial console on Pico’s UART0 and SD card beef up, the use of the cardboard each for the filesystem and for change area. Whilst there’s a binary image to be had, it’s simple sufficient to construct from supply.

If you happen to don’t have already got the Raspberry Pi Pico toolchain arrange and dealing you must move forward and arrange the C/C++ SDK.

Afterwards you wish to have take hold of the the Pico port from GitHub.

$ git clone https://github.com/davidgiven/FUZIX.git
$ cd FUZIX
$ git checkout rpipico

Then alternate listing to the platform port

$ cd Kernel/platform-rpipico/

and edit the primary line of the Makefile to set the trail on your pico-sdk.

So as an example in case you’re construction issues on a Raspberry Pi and also you’ve run the pico_setup.sh script, or adopted the directions in our Getting Started information, you’d level the PICO_SDK_PATH to

export PICO_SDK_PATH = /house/pi/pico/pico-sdk

After that you’ll move forward and construct each the FUZIX UF2 record and the foundation filesystem.

$ make global -j
$ ./update-flash.sh

If the whole thing is going neatly you’ll have a UF2 record in construct/fuzix.uf2 and a filesystem.img symbol record for your present operating listing.

You’ll now load the UF2 record onto your Pico within the commonplace means.

Cross take hold of your Raspberry Pi Pico board and a micro USB cable. Plug the cable into your Raspberry Pi or pc, then press and grasp the BOOTSEL button to your Pico when you plug the opposite finish of the micro USB cable into the board. Then unlock the button after the board is plugged in.

A disk quantity known as RPI-RP2 must pop up to your desktop. Double-click to open it, after which drag and drop the UF2 record into it.

The quantity will robotically unmount, and your Pico is now operating Unix. Sadly it gained’t be a lot use and not using a filesystem.

Construction a bootable SD card

The filesystem.img symbol record we constructed previous isn’t a bootable symbol. Not like the Raspberry Pi OS pictures you could be used to, you’ll’t simply use one thing like Raspberry Pi Imager to write down it to an SD card. We’re going to need to get our arms somewhat dirtier than that.

The next directions are for construction your record gadget on a Raspberry Pi, or some other identical Linux platform. Similar gear are to be had on each MS Home windows and Apple macOS, however the precise main points will vary.

Cross take hold of a microSD card. Because the walls we’re going to position onto it are most effective going to soak up 34MB it doesn’t in reality topic what length you’ve were given at hand. I used to be the use of a 4GB card, as that used to be the smallest I may to find, but it surely’s now not that necessary.

Now plug the cardboard into a USB card reader after which into your Raspberry Pi or notebook computer. We’re going to need to construct the partition desk that FUZIX is anticipating, which is composed of 2 walls: the primary a 2MB change partition, and the second one a 32MB root partition into which we will be able to replica the foundation filesystem, our filesystem.img record.

Raspberry Pi 4 with USB card reader
Raspberry Pi Four with USB card reader.

After plugging your card into the reader you’ll to find it from the command line the use of the lsblk command. If you happen to’ve have a clean unformatted card it’s going to be visual as /dev/sda.

$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    1  3.7G  Zero disk 
mmcblk0     179:0    0 14.9G  Zero disk 
├─mmcblk0p1 179:1    0  256M  Zero section /boot
└─mmcblk0p2 179:2    0 14.6G  Zero section /
$

But when the cardboard is already formatted you could as a substitute see one thing like this

$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    1  3.7G  Zero disk 
└─sda1        8:1    1  3.7G  Zero section /media/pi/USB
mmcblk0     179:0    0 14.9G  Zero disk 
├─mmcblk0p1 179:1    0  256M  Zero section /boot
└─mmcblk0p2 179:2    0 14.6G  Zero section /
$

which is a FAT-formatted card with a MBR named “USB”, which your Raspberry Pi has robotically fastened below /media/pi/USB.

In case your card has fastened, simply move forward and unmount it as follows:

$ umount /dev/sda1

Then having a look the use of lsblk you must see

$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    1  3.7G  Zero disk 
└─sda1        8:1    1  3.7G  Zero section 
mmcblk0     179:0    0 14.9G  Zero disk 
├─mmcblk0p1 179:1    0  256M  Zero section /boot
└─mmcblk0p2 179:2    0 14.6G  Zero section /
$

at which level we will be able to delete the present partition desk by way of zeroing out the primary a part of the cardboard and deleting the “get started of disk” constructions.

$ sudo dd if=/dev/0 of=/dev/sda bs=512 depend=1

If you happen to run lsblk once more afterwards you’ll see that the sda1 partition has been deleted.

Subsequent we’ll use fdisk to create a brand new partition desk. Sort the next

$ sudo fdisk /dev/sda

to position you on the fdisk advised. Then sort “o” to create a brand new DOS disklabel

Command (m for assist): o
Created a brand new DOS disklabel with disk identifier 0x6e8481a2.

adopted by way of “n” to create a brand new partition:

Command (m for assist): n
Partition sort
   p   number one (Zero number one, Zero prolonged, Four loose)
   e   prolonged (container for logical walls)
Make a choice (default p): p
Partition quantity (1-4, default 1): 1
First sector (2048-7744511, default 2048): 2048
Closing sector, +/-sectors or +/-size{Ok,M,G,T,P} (2048-7744511, default 7744511): +2M 
Created a brand new partition 1 of sort 'Linux' and of length 2 MiB.

Relying at the preliminary state of your disk you’ll be caused that the partition “incorporates a vfat signature” and requested whether or not you need to take away the signature. If requested, simply sort “Y” to verify.

Subsequent, we’ll set the sort for this partition to “7F

Command (m for assist): t
Decided on partition 1
Hex code (sort L to checklist all codes): 7F
Modified form of partition 'Linux' to 'unknown'.

to create the 2MB change partition that FUZIX is anticipating. From right here we wish to create a 2nd 32MB partition to carry our root record gadget:

Command (m for assist): n
Partition sort
   p   number one (1 number one, Zero prolonged, Three loose)
   e   prolonged (container for logical walls)
Make a choice (default p): p
Partition quantity (2-4, default 2): 2
First sector (6144-7744511, default 6144): 6144
Closing sector, +/-sectors or +/-size{Ok,M,G,T,P} (6144-7744511, default 7744511): +32M

Created a brand new partition 2 of sort 'Linux' and of length 32 MiB.

Afterwards in case you sort “p” on the fdisk advised you must see one thing like this:

Command (m for assist): p
Disk /dev/sda: 3.7 GiB, 3965190144 bytes, 7744512 sectors
Disk fashion: STORAGE DEVICE  
Gadgets: sectors of one * 512 = 512 bytes
Sector length (logical/bodily): 512 bytes / 512 bytes
I/O length (minimal/optimum): 512 bytes / 512 bytes
Disklabel sort: dos
Disk identifier: 0xe121b9a3

Instrument     Boot Get started   Finish Sectors Dimension Identity Sort
/dev/sda1        2048  6143    4096   2M 7f unknown
/dev/sda2        6144 71679   65536  32M 83 Linux

If you happen to do, you’ll sort “w” to write down and save the partition desk.

In any case, we will be able to replica our root record gadget into our 2nd 32MB partition:

$ sudo dd if=filesystem.img of=/dev/sda2
65535+Zero information in
65535+Zero information out
33553920 bytes (34 MB, 32 MiB) copied, 14.1064 s, 2.Four MB/s
$

You’ll now eject the SD card from the USB card reader, as it’s time to cord up our breadboard.

Wiring issues up at the breadboard

If you happen to’re growing on a Raspberry Pi, and also you haven’t prior to now used UART serial — which isn’t like the “commonplace” USB serial — you must move learn Segment 4.five of our Getting Started information.

FUZIX wiring diagram
Connecting a Raspberry Pi to a Pico and SD card.

Right here I’m the use of Adafruit’s MicroSD Card Breakout, and wiring the UART serial connection without delay to to the Raspberry Pi’s serial port the use of the GPIO headers.

Then again, in case you’re growing on a pc you’ll use one thing just like the SparkFun FTDI Basic Breakout to attach the serial UART on your pc. Once more, see our Getting Started information for main points: Segment 9.1.Four in case you’re on Apple macOS, or Segment 9.2.five in case you’re on MS Home windows.

Connecting a pc to a Pico and SD card.

Both means, the mapping between the pins to your Raspberry Pi Pico and the SD card breakout is similar, and must be as follows:

Pico RP2040 SD Card
3V3 (OUT) +3.3V
Pin 16 GP12 (SPI1 RX) DO (MISO)
Pin 17 GP13 (SPI1 CSn) CS
Pin 18 GND GND
Pin 19 GP14 (SPI1 SCK) SCK
Pin 20 GP15 (SPI1 TX) DI (MOSI)
Mapping between bodily pin quantity, RP2040 pin, and SD Card breakout.

If you’ve stressed issues up, pop your formatted microSD card into the breadboarded SD card breakout, and plug your Raspberry Pi Pico into USB energy. FUZIX will boot robotically.

Connecting to FUZIX

If you happen to’re connecting the use of a Raspberry Pi, the very first thing you’ll wish to do is allow UART serial communications the use of raspi-config.

$ sudo raspi-config

Cross to Interfacing Choices → Serial. Make a choice “No” when requested “Do you want a login shell to be obtainable over serial?” and “Sure” when requested “Do you want the serial port {hardware} to be enabled?”

Enabling a serial UART using raspi-config on the Raspberry Pi.
Enabling a serial UART the use of raspi-config on Raspberry Pi.

Leaving raspi-config you must select “Sure” and reboot your Raspberry Pi to allow the serial port. Extra details about connecting by means of UART can also be present in Segment 4.five of our Getting Started information.

You’ll then connect with FUZIX the use of minicom:

$ sudo apt set up minicom
$ minicom -b 115200 -o -D /dev/serial0

However, in case you are operating on a pc from macOS or MS Home windows you’ll use minicom, display, or your standard Terminal program. If you happen to’re not sure what to make use of, there are a selection of choices: as an example, a excellent possibility is CoolTerm, which is cross-platform and works on Linux, macOS, and Home windows.

After connecting to the serial port you must see one thing like this:

FUZIX in Serial
Hooked up to FUZIX the use of Serial on Apple macOS.

If you happen to don’t see the rest, simply unplug and replug your Pico to reset it and get started FUZIX operating once more.

In any case, move forward and input the right kind date and time, and whilst you get to the login advised you’ll login as “root” and not using a password.

Welcome to FUZIX!

Wrapping up

Whilst there are nonetheless a couple of problems, the port of FUZIX to Pico has been merged to the upstream repository, this means that it’s now an respectable a part of the working gadget.

Beef up for growing for Pico can also be discovered at the Raspberry Pi boards. There could also be an (unofficial) Discord server the place a large number of other folks lively within the new group appear to be placing out. Comments at the documentation must be posted as an Factor to the pico-feedback repository on GitHub, or without delay to the related repository it issues.

The entire documentation, in conjunction with quite a lot of different assist and hyperlinks, can also be discovered at the Getting Began web page. If you happen to lose observe of the place this is sooner or later, you’ll at all times to find it out of your Pico: to get admission to the web page, simply press and grasp the BOOTSEL button to your Pico, plug it into your pc or Raspberry Pi, then unlock the button. Cross forward and open the RPI-RP2 quantity, after which click on at the INDEX.HTM record.

That can at all times take you to the Getting Began web page.



Source link