Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

First Bitstream Build

Complete guide to building and booting Linux on Microwatt with the VCU-118 FPGA.

Prerequisites: This guide assumes you are using the official PowerCommons WSL images and have followed all instructions in the Development Environment section.


Overview

Build and boot Linux on VCU-118 in four steps:

  1. Build Buildroot (cross-compiler + userspace)
  2. Build Linux kernel (with Microwatt patches)
  3. Build FPGA bitstream (Microwatt + DDR4 + QSPI)
  4. Flash and boot

Clone Repositories

cd ~/projects

# Microwatt with VCU-118 support
git clone https://codeberg.org/PowerCommons/microwatt.git
cd microwatt
git checkout xilinx-vcu-118-dram
cd ..

# Linux kernel (upstream v6.12)
git clone --depth=1 --branch v6.12 \
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux

# PowerCommons kernel patches
git clone https://codeberg.org/PowerCommons/linux-powercommons.git

# Buildroot for userspace
git clone https://github.com/shenki/buildroot -b microwatt buildroot-microwatt

Step 1: Build Buildroot

Build the cross-compiler and root filesystem:

cd ~/projects/buildroot-microwatt
make ppc64le_microwatt_defconfig
make -j$(nproc)

Build time: ~30 minutes

Output:

  • Cross-compiler: output/host/bin/powerpc64le-buildroot-linux-gnu-gcc
  • Root filesystem: output/images/rootfs.cpio

Step 2: Build Linux Kernel

Apply PowerCommons Patches

cd ~/projects/linux
git am ~/projects/linux-powercommons/patches/microwatt-vcu118/*.patch

This applies the RCU fix and device tree updates needed for Microwatt on VCU-118. See the Microwatt Kernel RCU Fix blog post for details on why this is needed.

Configure Kernel

make ARCH=powerpc microwatt_defconfig

Set Initramfs Path

Edit .config and set the path to your rootfs.cpio:

CONFIG_INITRAMFS_SOURCE="/home/powercommons/projects/buildroot-microwatt/output/images/rootfs.cpio"

Build Kernel

export PATH="/home/powercommons/projects/buildroot-microwatt/output/host/bin:$PATH"
make ARCH=powerpc CROSS_COMPILE=powerpc64le-buildroot-linux-gnu- -j$(nproc) zImage

Build time: ~5 minutes

Output: arch/powerpc/boot/dtbImage.microwatt.elf


Step 3: Build FPGA Bitstream

Generate LiteDRAM Core

cd ~/projects/microwatt/litedram/gen-src
python3 generate.py xilinx-vcu-118

Build Bitstream

cd ~/projects/microwatt
fusesoc library add microwatt .
fusesoc run --target=xilinx-vcu-118 microwatt --no_bram --spi_flash_offset=33554432

Parameters:

  • --no_bram: Boot from external flash instead of internal BRAM
  • --spi_flash_offset=33554432: Linux kernel location at 32MB offset

Build time: ~45 minutes

Output: build/microwatt_0/xilinx-vcu-118-vivado/microwatt_0.bit


Step 4: Flash and Boot

Program Bitstream

openFPGALoader -b vcu118 --write-flash ~/projects/microwatt/build/microwatt_0/xilinx-vcu-118-vivado/microwatt_0.bit

Program Linux Kernel (at 32MB offset)

openFPGALoader -b vcu118 --write-flash -o 0x2000000 ~/projects/linux/arch/powerpc/boot/dtbImage.microwatt.elf

Connect Serial Console

tio /dev/ttyUSB0 -b 115200

Power Cycle

Power cycle the VCU-118 board. You should see:

Welcome to Microwatt !

 Soc signature: f00daa5500010001
  Soc features: UART DRAM SPIFLASH
          DRAM: 2047 MB
           CLK: 125 MHz
  SPI FLASH ID: 20bb21 Micron 1G [quad IO mode]

LiteDRAM built from LiteX f55ea7075
Initializing SDRAM @0x40000000...
Memtest OK

Trying flash...
Booting from DRAM at 1700000

[... Linux boot messages ...]

Welcome to Buildroot
microwatt login:

Login with root (no password).


Troubleshooting

ProblemSolution
SPI FLASH ID: 000000Check STARTUPE3 DO/DI wiring. See QSPI blog post
Kernel crashes in rcu_process_callbacksApply the PowerCommons patches. See RCU fix blog post
“Can’t open blockdev”Set CONFIG_INITRAMFS_SOURCE to your rootfs.cpio path
DDR4 training failsCheck clock stability and reset sequencing