Skip to content
gtxaspec edited this page May 17, 2024 · 61 revisions

Buildroot

Thingino is an external tree of the Buildroot tool. So the best possible documentation is available here.

Thingino uses a slightly modified version of Buildroot, allowing to create better symlinks for truly relocatable toolchain.

Thingino uses its own Makefile to do most of the pre-build configuration. It then passes the build command to Buildroot.

Buildroot's native make directives are accessible from firmware using the br- prefix, e.g. make br-help will show help output from the Buildroot Makefile, while make help will only show help from the Thingino Makefile.

Bulding a Package

Prefixed Buildroot make directives to work with a package at different stages:

  • br-[pkgname] - Build and install [pkgname] and all its dependencies
  • br-[pkgname]-source - Only download the source files for [pkgname]
  • br-[pkgname]-extract - Extract [pkgname] sources
  • br-[pkgname]-patch - Apply patches to [pkgname]
  • br-[pkgname]-depends - Build [pkgname]'s dependencies
  • br-[pkgname]-configure - Build [pkgname] up to the configure step
  • br-[pkgname]-build - Build [pkgname] up to the build step
  • br-[pkgname]-dirclean - Remove [pkgname] build directory
  • br-[pkgname]-reconfigure - Restart the build from the configure step
  • br-[pkgname]-rebuild - Restart the build from the build step
  • br-[pkgname]-reinstall - Restart the build from the install step
  • br-[pkgname]-show-info - Generate info about [pkgname], as a JSON blurb
  • br-[pkgname]-show-depends - List packages on which [pkgname] depends
  • br-[pkgname]-show-rdepends - List packages which have [pkgname] as a dependency
  • br-[pkgname]-show-recursive-depends - Recursively list packages on which [pkgname] depends
  • br-[pkgname]-show-recursive-rdepends - Recursively list packages which have [pkgname] as a dependency
  • br-[pkgname]-graph-depends - Generate a graph of [pkgname]'s dependencies
  • br-[pkgname]-graph-rdepends - Generate a graph of [pkgname]'s reverse dependencies
  • br-menuconfig - Run Buildroot menuconfig
  • br-savedefconfig - Save board defconfig
  • br-busybox-menuconfig - Run BusyBox menuconfig
  • br-linux-menuconfig - Run Linux kernel menuconfig
  • br-linux-savedefconfig - Run Linux kernel savedefconfig
  • br-linux-update-defconfig - Save the Linux configuration to the path specified by BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE
  • br-list-defconfigs - List all defconfigs (pre-configured minimal systems)
  • br-source - Download all sources needed for offline-build
  • br-external-deps - List external packages used
  • br-legal-info - Generate info about license compliance
  • br-show-info - Generate info about packages, as a JSON blurb
  • br-pkg-stats - Generate info about packages as JSON and HTML
  • br-printvars - Dump internal variables selected with VARS=...
  • br-make V=0|1 - 0 => quiet build (default), 1 => verbose build

Thingino adds a few shortcut directives of its own:

  • bootstrap - Install prerequisites
  • clean - Remove target directory and .config file for the given board
  • distclean - Remove all building files for the given board
  • rebuild-[pkgname] - Combine dirclean and rebuild
  • pack_full - Download a corresponding bootloader and create a full firmware file
  • pack_update - Create a firmware update file without a bootloader
  • update_ota IP=192.168.1.10 - Upload and install firmware update, leave bootloader and most settings
  • upgrade_ota IP=192.168.1.10 - Upload and install full firmware including bootloader

Toolchains

Available Toolchains for XBurst Development

These toolchains are designed to support various Ingenic SoC targets and leverage different versions of GCC (GNU Compiler Collection) and libc implementations (GNU and musl).

Toolchain Overview

The following toolchains are available for development:

  • GNU GCC Toolchains for XBurst1:
    • toolchain_xburst1_gnu_gcc12
    • toolchain_xburst1_gnu_gcc13
  • Musl GCC Toolchains for XBurst1:
    • toolchain_xburst1_musl_gcc12
    • toolchain_xburst1_musl_gcc13
  • Musl GCC Toolchains for XBurst2:
    • toolchain_xburst2_musl_gcc12
    • toolchain_xburst2_musl_gcc13

Target SoCs

  • XBurst1 Targets:
    • T10/T20/T21/T23/T30/T31 SoCs
  • XBurst2 Targets:
    • A1/T40/T41 SoCs

GCC Versions

The toolchains are based on two versions of the GCC compiler:

  • GCC 12
  • GCC 13

These versions ensure compatibility with a wide range of software, offering developers the flexibility to choose a toolchain that best suits their project's requirements.

Choosing a Toolchain

When selecting a toolchain for your project, consider the following:

  • Target Architecture: Ensure the toolchain supports your SoC (XBurst1 vs. XBurst2).
  • Libc Implementation: Decide between GNU libc and musl libc based on your project's needs. Musl libc is designed for static linking and simplicity, while GNU libc offers extensive features and dynamic linking support.
  • Musl is the default recommended toolchain for Thingino development.
  • GCC Version: Newer versions of GCC may offer better optimizations and more features. However, compatibility with your codebase should be verified.

Getting Started

Up to date Toolchains releases are always available on the releases page. Toolchains are updated weekly.


Container Development

Are you looking to start development with Thingino but worried about cluttering your system with additional software? An efficient solution is to utilize containers for development! This approach gives you a fully operational Debian system contained within a virtual environment, already set up for your development needs.

Docker


Docker image for developing Thingino firmware in a standardized and reproducible environment across different machines.

git clone https://github.com/themactep/docker-worker.git ~/docker-worker
cd ~/docker-worker
./run.sh thingino

LXC


LXC serves as a lightweight alternative to Docker and is quite straightforward to use, especially if you're accustomed to Debian-based systems.

Getting Started with LXC

Set Up Your Development Environment:
We've made installation easy with a prepared setup script, which automates the creation and configuration of a new container specifically for Thingino development. This script will prompt you to install LXC (if not installed), the platform we'll use to create and manage our isolated development environments. Once LXC is installed, you can prepare your Thingino development environment.

Download and execute the setup script by entering these commands in your terminal (ensure you're in the directory where you wish to download the script):

git clone https://github.com/gtxaspec/thingino-lxc && cd thingino-lxc
sudo bash setup_thingino_lxc.sh

Full source code to the installer is available here: thingino-lxc

This script will automatically generate an LXC container named 'thingino-development' and install all the necessary tools and software required for Thingino development, including various thingino related repositories.

The script will automatically attach to the container after installation, dropping you to the command prompt. You are now ready to start developing!

Accessing Your Development Environment

Whenever you're ready to start working, accessing your dedicated Thingino environment is simple:

1. Open Your Terminal:
Launch your terminal to begin.

2. Attach to Your Container:
Enter the following command to access your development environment:

attach-thingino

By running this command, you'll be placed directly into your Thingino development workspace inside the container, where you can code, build, and test within an isolated and dedicated environment.

Exiting the Container

To finish your session and return to your host system's command line, type exit and press Enter. This command logs you out from the 'dev' user. If you're still inside the container, typing exit again will disconnect you from it.

Remember, your LXC container retains its state between sessions, allowing you to pick up right where you left off by reattaching using the same command.

Installation Demonstration Video:

output.mp4

Benefits of Using Containers for Development

  • Isolation: Keeps your primary operating system clean and unaffected.
  • Reproducible: Simplifies the process of replicating or deleting the development environment.
  • Efficiency: Containers typically use resources more sparingly than full virtual machines.

Now, you're all set to enjoy hassle-free development with Thingino in a clean, organized environment!

  1. Wiki Home
  2. About the Project
    1. Contributions
    2. Features
    3. Project Philosophy
    4. Releases
  3. Getting Started
    1. FAQ
    2. Glossary
    3. Hardware Identification
    4. Image Builder
    5. USB Boot Mode
    6. Ingenic USB Cloner
      1. OTG Booting
    7. PPSTRONG
    8. Installation: General
    9. Installation: No Tools Methods
    10. Resources and Links
    11. Support Community
    12. Troubleshooting
    13. UART Connection
    14. Updating Firmware
    15. Unbricking
    16. Web UI
  4. Supported Cameras
    1. Cameras
    2. 360 AP1PA3
    3. AliExpress LTIA‐37FJZ (Vanhua Z55 module)
    4. AOQEE C1
    5. Aosu C5L
    6. Cinnado
      1. Cinnado D1 2K
      2. Cinnado D1 3K
    7. Dekco DC5L
    8. Eufy
      1. Eufy E210 Outdoor Cam
      2. Eufy E220
    9. Galayou/Wansview
      1. Galayou G2
      2. Galayou G7
      3. Wansview W6
      4. Wansview W7/Galayou Y4
    10. Hualai (Wyze/Atom/Neos/Personal)
      1. Dafang Upgrading for Wyze v2
      2. NEOS conversion
      3. Personal Cam Pan and Cam 2
      4. Wyze Cam Pan V1
      5. Wyze Doorbell (V1)
        1. Chime Reverse Engineering
        2. Flashing VDB1 over UART (YMODEM)
        3. MQTT Control and Monitoring
      6. Wyze v2/Neos SmartCam/ATOM Cam 1
      7. Wyze v3
      8. Wyze Accessories
    11. iFlytek XFP301‐M
    12. Jienuo JN-107-AR-E-WIFI
    13. Jooan A6M
    14. LaView L2
    15. LongPlus X07
    16. LSC 3215672
    17. Sannce I21AG
    18. Sonoff Cam‐S2 and B1P
    19. TP-Link Tapo C100/C110/C111
    20. Wuuk Y0510
    21. Xiaomi
      1. Xiaomi Mijia1080p (SXJ02ZM)
      2. Xiaomi MJSXJ03HL
      3. Xiaomi Outdoor Camera AW200 (MJSXJ05HL)
  5. Configuration
    1. Administration
    2. Automation
      1. Configuring camera using runonce.sh script
    3. Cron jobs
    4. General
    5. LED Indicators
    6. Lighting
    7. Media Streaming Endpoints
    8. Network Storage
    9. Networking
      1. DHCP: Timezone
      2. Wireless Networking
      3. USB Direct w CDC (NCM)
      4. USB Ethernet Networking
      5. Remote Access
      6. VPN
        1. Tailscale
        2. Wireguard
        3. Zerotier
      7. Wi-Fi
        1. Self Hosted AP
        2. Tips and Tricks
      8. WWAN (Cellular)
    10. Night Mode
    11. ONVIF
    12. OSD (On-screen Display)
    13. Plugins
      1. Motion Guard
      2. Yandex Disk
    14. SSH Access Keys
    15. Wi-Fi Access
    16. Provisioning
    17. Streamer Bitrate Control
    18. Video Rotation
  6. Integration
    1. Home Assistant
    2. Frigate
    3. Ingenic A1/$15 NVR
    4. LightNVR
    5. Mobile Apps
    6. MQTT Integration
    7. Virtual Webcam on Linux
    8. Mainsail (Klipper)
  7. Development
    1. Booting
      1. Boot: MMC SD
      2. Boot: NFS
    2. CH341A Programmer
    3. RTSP Players
    4. Flash Chips
    5. go2rtc
    6. Porting Guide
    7. Ingenic Platform Capability Matrix
    8. Ingenic Image Processor
    9. ISP Reserved Memory (RMEM)
    10. Debugging
    11. Software
      1. Building From Sources
      2. Buildroot
      3. Toolchain
      4. Choice of JSON library
    12. SSL and TLS Web UI in thingino
    13. Tech Info
      1. Hardware
      2. PWM Info
      3. Supported Hardware
      4. T23 GPIOs
      5. T31 GPIOs
    14. U-Boot Cheatsheet
    15. Zeratul/Atlas/Tassadar
    16. Resources

Clone this wiki locally