🍇 BerryCore Development

Building Ports & Software for QNX Extended Userland

Getting Started with BerryCore Development

What is BerryCore Development?

BerryCore development involves porting, compiling, and building software for the QNX Extended Userland on BlackBerry 10 devices. Using the ARM-based GCC9 toolchain and Term49 terminal environment, developers can create native QNX applications, port Unix software, and expand the capabilities of BB10 devices.

Why Develop for BerryCore?

  • Keep BB10 Alive: Extend the life and capabilities of BlackBerry 10 devices
  • Native QNX Development: Build true native applications for the QNX platform
  • Port Modern Software: Bring contemporary Unix/Linux tools to BB10
  • Community Impact: Contribute to the growing BerryCore ecosystem
  • Unique Platform: Develop for a secure, real-time embedded OS

Prerequisites

  • ✅ BlackBerry 10 device (Passport, Classic, Z30, Z10, Q10)
  • ✅ BerryCore installed and configured
  • ✅ Term49 terminal application
  • ✅ Basic knowledge of C/C++ and Unix/Linux
  • ✅ SSH access to your device (recommended)
  • ✅ Linux or macOS development machine (for cross-compilation)

Setting Up Your Development Environment

1. Install BerryCore

First, ensure you have BerryCore installed on your BB10 device. Download the latest release from GitHub and follow the installation guide.

# On your BB10 device in Term49
cd /accounts/1000/shared/misc

# Download BerryCore v0.72
wget https://github.com/sw7ft/BerryCore/releases/download/v0.72/berrycore.zip
wget https://github.com/sw7ft/BerryCore/releases/download/v0.72/install.sh

# Extract and install
unzip berrycore.zip
chmod +x install.sh
./install.sh

2. Source the Environment

Every time you start a new Term49 session, source the BerryCore environment to access all tools and binaries.

# Source BerryCore environment
source /accounts/1000/shared/misc/berrycore/env.sh

# Or use the quick alias (if configured)
source ~/bc/env.sh

3. Verify Installation

# Check GCC version
gcc --version

# Check available tools
which git python3 nano

# Verify environment variables
echo $PATH
echo $LD_LIBRARY_PATH

Understanding the GCC9 Toolchain

BerryCore uses the arm-blackberry-qnx8eabi-gcc toolchain (GCC 9.3.0) for compiling software. This is a specialized cross-compiler configured for QNX's ARM architecture.

Toolchain Location

# Toolchain is typically located at:
~/bbndk/gcc9/bb10-gcc9/

# Environment setup script:
source ~/bbndk/gcc9/bb10-gcc9/env.sh

Key Compiler Commands

  • arm-blackberry-qnx8eabi-gcc - C compiler
  • arm-blackberry-qnx8eabi-g++ - C++ compiler
  • arm-blackberry-qnx8eabi-ar - Archive utility
  • arm-blackberry-qnx8eabi-ld - Linker
  • arm-blackberry-qnx8eabi-strip - Binary stripper

Basic Compilation Example

# Simple hello world
cat > hello.c << 'EOF'
#include <stdio.h>
int main() {
    printf("Hello from BerryCore!\n");
    return 0;
}
EOF

# Compile
arm-blackberry-qnx8eabi-gcc -o hello hello.c

# Run
./hello

Building Ports for BerryCore

Porting software to BerryCore involves adapting Unix/Linux applications to run on the QNX platform. Most software that uses standard POSIX APIs can be ported with minimal modifications.

Typical Port Workflow

  1. Download Source: Obtain the source code of the software you want to port
  2. Configure: Run configure script with QNX-specific flags
  3. Patch Issues: Fix QNX-specific compatibility issues
  4. Compile: Build using the GCC9 toolchain
  5. Test: Verify functionality on your BB10 device
  6. Package: Create deployment package for BerryCore

Example: Porting Nano Text Editor

# Download nano source
wget https://www.nano-editor.org/dist/v5/nano-5.9.tar.gz
tar -xzf nano-5.9.tar.gz
cd nano-5.9

# Configure for QNX
./configure \
  --host=arm-blackberry-qnx8eabi \
  --prefix=/accounts/1000/shared/misc \
  --disable-nls

# Build
make -j4

# Install
make install

Common Configuration Flags

  • --host=arm-blackberry-qnx8eabi - Specify target architecture
  • --prefix=/accounts/1000/shared/misc - Installation directory
  • --disable-nls - Disable internationalization (often problematic)
  • --enable-static - Build static libraries (recommended)
  • --disable-shared - Skip shared libraries if needed

Developing with Term49

Term49 is the terminal application that provides a Unix-like shell environment on BB10. It's your primary interface for development work on the device.

SSH Access (Recommended)

For serious development work, SSH access is highly recommended. It allows you to use your desktop's keyboard, clipboard, and terminal tools while developing on the device.

# On your desktop
ssh -p 2022 root@192.168.1.108

# Or if you've set up key-based auth
ssh qnx-passport

On-Device Development

You can also develop directly on the device using Term49. BerryCore includes text editors like nano and vi.

💡 Pro Tip

Use tmux (available in BerryCore v0.72+) to manage multiple terminal sessions on your device. This allows you to have one pane for editing, another for compiling, and another for testing.

Complete Porting Guide

Common QNX Compatibility Issues

1. Missing Linux Headers

QNX doesn't include all Linux headers. You may need to create dummy headers or use alternative functions.

// Common missing headers:
// - sys/sysinfo.h
// - sys/epoll.h
// - linux/limits.h

// Solution: Use QNX equivalents or create stubs

2. Threading Issues

QNX's threading model differs slightly from Linux. Disable threaded operations if they cause issues.

# Common configure flags:
--disable-threads
--disable-threaded-dns

3. C++ Template Warnings

GCC 9.3.0 on QNX produces many template warnings. Use this flag to suppress them:

CXXFLAGS="-Wno-ignored-attributes"

Successful Port Examples

  • Nano 5.9: Text editor with full terminal capabilities
  • tmux 3.3a: Terminal multiplexer with QNX fixes
  • Dillo Browser: Lightweight graphical web browser
  • OpenSSL 1.1.1w: Cryptography library
  • Python 3.11: Full Python interpreter
  • Git: Version control system

Creating BerryCore Packages

Once you've successfully ported software, package it for easy distribution to other BerryCore users.

Package Structure

myapp-qnx8-deploy/
├── bin/ # Executables
├── lib/ # Libraries (if needed)
├── share/ # Data files
├── README.md # Installation instructions
└── install.sh # Optional installation script

Creating the Package

# Create package directory
mkdir myapp-qnx8-deploy
cd myapp-qnx8-deploy

# Copy binaries
mkdir bin
cp /path/to/compiled/myapp bin/

# Strip binaries to reduce size
arm-blackberry-qnx8eabi-strip bin/myapp

# Create archive
cd ..
tar -czf myapp-qnx8-deploy.tar.gz myapp-qnx8-deploy/

Share Your Port

Submit your port to the BerryCore community:

  • Create a GitHub repository with your port
  • Submit a pull request to qnx-packages repository
  • Share on the BerryCore Telegram community
  • Document any QNX-specific patches or modifications

Development Best Practices

✅ Do

  • ✓ Test thoroughly on actual BB10 hardware
  • ✓ Use static linking when possible
  • ✓ Strip binaries to reduce size
  • ✓ Document QNX-specific modifications
  • ✓ Check for memory leaks
  • ✓ Use appropriate install prefix
  • ✓ Include README with dependencies
  • ✓ Share your work with community

❌ Don't

  • ✗ Assume Linux-specific features
  • ✗ Hardcode absolute paths
  • ✗ Ignore compiler warnings
  • ✗ Use outdated toolchain versions
  • ✗ Forget to test on target device
  • ✗ Include unnecessary dependencies
  • ✗ Skip documentation
  • ✗ Use root permissions unnecessarily

🎯 Key Takeaways

  • • Always source the BerryCore environment before development
  • • Use the correct configure flags for QNX cross-compilation
  • • Test early and often on actual hardware
  • • Contribute back to the community when you succeed
  • • Document your porting process for future reference

Developer Resources