Build Firmware

with confidence!

Zack YL Shih

Agenda

  • Current
  • Solution
  • Near Feature

MAR-2000 (before 2015)

  • "Hand made"
    • documents
  • Semi-automatic script
    • missing parts
  • Install Debian packages
    • (on machine)
    • kversion
    • MAR-2000.deb
    • ...
download_source() {
  git clone ssh://swrd@$GIT_REPO/home/gitroot/$REPO_USERLAND $UTAG
  (
    cd $UTAG
    if [ "$UBRANCH" != "master" ]; then
      git checkout -b $UBRANCH origin/$UBRANCH
    fi
    git checkout $UTAG

    # clone kernel
    git clone ssh://root@$GIT_REPO/home/gitroot/kernel/$REPO_KERNEL $KERNEL_VER
    (
      cd $KERNEL_VER
      git checkout -b $KBRANCH origin/$KBRANCH
      git checkout $KTAG
    )

    # clone debianfs
    git clone ssh://root@$GIT_REPO/home/gitroot/debian debian
    (
      cd debian
      git checkout -b $DBRANCH origin/$DBRANCH
      git checkout $DTAG
    )
  )
}

PM/PC: Give me ABC firmware~~~

TS: Problem on version 1.0.1 firmware~~~

RD: How to build XYZ firmware~~~

Technical debt

The debt can be thought of as work that needs to be done before a particular job can be considered complete or proper.

If the debt is not repaid, then it will keep on accumulating interest, making it hard to implement changes later on. Unaddressed technical debt increases software entropy.

Continuous Integration

  • "Hand made"
    • documents
  • Semi-automatic script
    • missing parts
  • Install Debian packages
    • (on machine)
    • kversion
    • MAR-2000.deb
    • ...

Source Code

  • Gitlab (Git + Web-based GUI)
  • Tags
    • MAR2000V1.0.2_B3.0 mar2000 release firmware (Support DNAT)
    • MAR2000V1.0_B3.0 mar2000 I-test release firmware
  • stdlinux_userland
    • kernel
    • debian
    • packages
      • mirf
      • web

Jenkins

Web

MAR-2000 (MIRF)

Firmware

Job List

Hook

Trigger with Parameters

One Click! Build Firmware

Feature work

  • Integration Test
  • Auto Deploy
  • ...

One
More
Thing

Install Debian Package

ARM

  1. Get a machine
  2. Insert CF card (root file system inside)
  3. Chroot & Install Debian packages
  4. Reject CF card & Packing

Without Emulator

With Emulator

  1. Put qemu-arm-static
  2. Chroot & Do anything you want
  3. Remove qemu-arm-static

Can't be automated easily.

All instructions can be written in scripts and source control via git

Code Snippet

chroot $CHTROOT_HOME /bin/dash -c "dpkg -i /mirf.deb"
chroot $CHTROOT_HOME /bin/dash -c "dpkg -i /mar2000-kversion_1.0.0-1_armel.deb"
chroot $CHTROOT_HOME /bin/dash /clean-rootfs
rm $CHTROOT_HOME/*.deb
rm $CHTROOT_HOME/clean-*

# post process
## restore bash
mv $CHTROOT_HOME/bin/bash.bak $CHTROOT_HOME/bin/bash
mv $CHTROOT_HOME/bin/sh.bak $CHTROOT_HOME/bin/sh

## delete qemu-arm-static
rm $CHTROOT_HOME/usr/bin/qemu-arm-static

QEMU

  • qemu-static-arm
  • binfmt_misc

No more steps on bare machine

APP

Kernel

binfmt_misc

qemu-static-arm

Build Firmware

By YuLun Shih

Build Firmware

  • 975