Build Micropython firmware for ESP8266 on FreeBSD host + Ubuntu guest

Posted on April 01, 2018 in software

Tested with:

How to:

  • Install and configure vm-bhyve: Quickstart

  • Create a vm for micropython

    vm iso http://releases.ubuntu.com/16.04.4/ubuntu-16.04.4-server-amd64.iso
    
    vm create -t ubuntu micropython
    vm configure micropython
    
        loader="grub"
        guest="linux"
        cpu=1
        memory=2048M
        network0_type="virtio-net"
        network0_switch="public"
        disk0_type="virtio-blk"
        disk0_name="disk0.img"
    
    vm install micropython ubuntu-16.04.4-server-amd64.iso
    vm console micropython
    
  • Finish Ubuntu installation inside console.

    • Choose guided non-lvm partitioning.
    • Optionally enable openssh server.
  • Reboot guest, login

    sudo apt-get update
    
    sudo apt-get install -y make unrar autoconf automake \
      libtool gcc g++ gperf flex bison texinfo gawk \
      ncurses-dev libexpat-dev python-dev python python-serial \
      sed git unzip bash help2man wget bzip2 libtool-bin
    
    git clone --recursive https://github.com/pfalcon/esp-open-sdk
    
    cd esp-open-sdk
    
    make
    
    echo "export PATH=/home/$USER/esp-open-sdk/xtensa-lx106-elf/bin:$PATH" >> ~/.bash_profile
    
    exit
    
  • Logout from guest, login

    git clone --recursive https://github.com/micropython/micropython.git
    
    cd micropython/ports/esp8266
    
    make
    
  • The firmware will be available as build/firmware-combined.bin.