Raspberry Pi: compile and run Magenta

  • Ubuntu 16.04 LTS
  • arm-linux-gnueabihf (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  • Magenta master branch, commit 0ad390c4d67102ede5ad8aeaa0f51d1f6401ab6c
  • Raspberry Pi 3 Model B

Magenta is a kernel developed by Google and used in Google’s coming soon brand new Fuchsia OS. Magenta is based on Little Kernel.

Download Magenta source code

Magenta source code can be downloaded as part of Fuchsia OS (see Fuchsia OS Getting Started) or separately (see Magenta Getting Started)

Build Magenta
# In Fuchsia repositories it's in the magenta folder
$ cd fuchsia/magenta
# Or, standalone Magenta repository
$ cd magenta
$ make magenta-rpi3-arm64
Prepare bootable SD card

To run Magenta on Raspberry Pi we need a single-partition bootable SD card with Master Boot Record (MBR) and FAT32 file system. Not all cards come in that state. See how to make one on Intel’s Make a bootable micro SD card page:

  • Run Unity Dash (desktop search utility).
  • Enter the command: disks.
  • Select the Disks app.
  • Insert the micro SD card into your computer.
  • In the left sidebar, select the micro SD card.
  • If you see multiple partitions, select a partition and click the icon to delete the partition.
  • Click the + icon to create a new partition.
  • From the Type drop-down list, select Compatible with all systems and devices (FAT). In the Name field, type magenta to make it easier to identify in the steps below.
Copy Magenta files to the SD card

See complete story on Github:

$ cd magenta
$ cp ./build-magenta-rpi3-arm64/magenta.bin /media/username/magenta/kernel8.img
$ cp ./kernel/target/rpi3/config.txt /media/username/magenta/config.txt
$ cp ./kernel/target/rpi3/cmdline.txt /media/username/magenta/
$ cp ./kernel/target/rpi3/bcm2710-rpi-3-b.dtb /media/username/magenta/
$ cp ./build-magenta-rpi3-arm64/bootcode.bin /media/username/magenta/
$ cp bootcode.bin /media/username/magenta/
$ cp start.elf /media/username/magenta/
$ ls -a /media/username/magenta/ | sort
  • Note that the ./build-magenta-rpi3-arm64/magenta.bin file is renamed to kernel8.img – this is how it is referred to in config.txt:
$ cat /media/username/config.txt
# Tells the Pi's bootloader which file contains the kernel.

The bootcode.bin and start.elf files are not part of the Magenta build process described above and can be found here and here.

Serial terminal setup

See the Raspberry Pi: serial terminal setup.

Run Magenta

Start screen/putty terminal and power up your Raspberry Pi:

...[00002.007] 01473.01497> LAN9514 - attempting to bind 
[00002.007] 01473.01497> lan9514 returned 3 endpoints 
[00002.021] 01473.02308> Initializing LAN9514... 
[00002.030] 01473.02308> LAN9514 MAC Address b8:27:eb:20:0a:4c 
[00002.045] 01473.02308> LAN9514 Initialized! bmcr=3000  bsr=7809 
[00002.052] 01041.01044> devcoord: drv='ethernet' bindable to dev='smsc-lan9514' 
[00002.062] 01227.01307> netifc: ? /dev/class/ethernet/000 
[00002.073] 01227.01307> netifc: create 128 eth buffers 
[00002.078] 01227.01307> macaddr: b8:27:eb:20:0a:4c 
[00002.078] 01227.01307> ip6addr: fe80::ba27:eb4d:fe20:a4c 
[00002.078] 01227.01307> snmaddr: ff02::1:ff20:a4c 
[00002.079] 01227.01307> netsvc: nodename='carol-grope-cozy-squat' 
[00002.079] 01227.01307> netsvc: start 
[00003.491] 01473.02308> lan9514: Link is up - 782d 
magenta$ ls -l 
d  7        0 . 
d  7        0 .. 
d  9        0 dev 
d  7        0 boot 
d  2        0 tmp 
d  2        0 data 
d  2        0 volume 
d  2        0 svc