ChebbiOS

Integration and Execution of Microsoft SEAL in Linux ARM (QEMU)

#qemu#arm#microsoft-seal#buildroot#embedded-linux#rootfs-overlay

1. Objective

The objective of this phase was to:

  • Integrate the cross-compiled sealexamples ARM binary into the Buildroot-generated Linux filesystem.
  • Boot Linux ARM via QEMU.
  • Execute Microsoft SEAL inside the emulated Cortex-A7 environment.

Integration Overview

graph TD
    subgraph Host[Host Machine]
        direction TB
        SealBin(Cross-Compiled<br>SEAL Binary)
        Overlay(RootFS Overlay<br>/usr/bin)
        Buildroot[Buildroot Build System]
        Images(zImage & rootfs.cpio)
        QEMU[QEMU Emulator]
    end

    subgraph Guest[Emulated Cortex-A7]
        Running[Running Application]
    end

    SealBin -->|1. Copy to| Overlay
    Overlay -->|2. Inject into| Buildroot
    Buildroot -->|3. Makes| Images
    Images -->|4. Load into| QEMU
    QEMU -->|5. Boots & Runs| Running

    style Host fill:#e1f5fe,stroke:#01579b
    style Guest fill:#fff3e0,stroke:#e65100,stroke-dasharray: 5 5
    style Running fill:#ffe0b2,stroke:#f57c00

2. Problem Context

The sealexamples binary was successfully cross-compiled for ARM:

file sealexamples

Output: ELF 32-bit LSB executable, ARM, EABI5

However, when booting Linux ARM, the binary was not visible because:

  1. The Linux ARM system runs entirely from the generated root filesystem.
  2. It does not have access to the host filesystem or Docker volume.

Therefore, the binary must be integrated into the Buildroot root filesystem.

3. Solution: Buildroot Root Filesystem Overlay

3.1 Create Root Filesystem Overlay

Inside the Buildroot directory:

mkdir -p buildroot/rootfs_overlay/usr/bin

3.2 Copy the ARM Binary into the Overlay

cp seal/SEAL/build-arm/bin/sealexamples \
   buildroot/rootfs_overlay/usr/bin/

chmod 755 buildroot/rootfs_overlay/usr/bin/sealexamples

This ensures:

  • Correct file location
  • Proper execution permissions

3.3 Configure Buildroot to Use the Overlay

In make menuconfig:

  • System configurationRoot filesystem overlay directories

Set: /workspace/buildroot/rootfs_overlay

3.4 Rebuild Buildroot

make -j$(nproc)

This regenerates:

  • zImage
  • rootfs.ext2

The overlay is automatically injected into the final root filesystem.

4. QEMU Boot Configuration

The final working QEMU launch configuration:

qemu-system-arm \
  -M virt \
  -cpu cortex-a7 \
  -m 512M \
  -nographic \
  -kernel zImage \
  -drive file=rootfs.ext2,if=none,format=raw,id=hd0 \
  -device virtio-blk-device,drive=hd0 \
  -append "console=ttyAMA0 root=/dev/vda rw"

This configuration ensures:

  • Cortex-A7 emulation
  • virt machine compatibility
  • virtio block device root filesystem
  • Serial console output

5. Verification Inside Linux ARM

After boot:

ls /usr/bin | grep seal

Output: sealexamples

Execution:

sealexamples
# or
/usr/bin/sealexamples

The program executes successfully inside Linux ARM.

6. Final Result

The following pipeline is now fully validated:

  1. Cross-compilation of Microsoft SEAL for ARM (hard-float).
  2. Integration of the binary into Buildroot root filesystem.
  3. Generation of Linux kernel and rootfs on the server.
  4. Emulation of Cortex-A7 using QEMU.
  5. Execution of Microsoft SEAL inside the ARM environment.

7. Key Technical Learnings

  • The Linux guest cannot access host filesystem directly.
  • Buildroot rootfs overlays are the correct integration mechanism.
  • Machine/CPU compatibility in QEMU must be respected (virt + cortex-a7).
  • Using glibc ensures compatibility with complex C++ libraries like SEAL.

8. Status

  • ✔ Microsoft SEAL runs successfully on an emulated ARM Cortex-A7 system.
  • ✔ The entire process is reproducible via Docker.
  • ✔ The environment is suitable for further benchmarking and experimentation.
Previous Part
QEMU Cortex-A7 Setup
<a href="/blog/seal-integration-arm-issues" class="flex items-center gap-4 p-6 rounded-lg border border-white/10 bg-white/5 hover:border-blue-500/50 transition-all group decoration-auto text-right md:flex-row-reverse">
    <div class="bg-blue-600/20 p-3 rounded-full group-hover:bg-blue-600/30 text-blue-400 group-hover:text-blue-300 transition-colors">
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>
    </div>
    <div class="text-left md:text-right">
        <div class="text-sm text-gray-400 mb-1">Next Part</div>
        <div class="text-lg font-bold text-white group-hover:text-blue-400 transition-colors">Difficulties & Resolutions</div>
    </div>
</a>