Skip to content

rcore-os/tgosimages

Repository files navigation

TGOS Images Repository

English | 中文

Introduction

This repository contains build scripts, patches, and helper tools for generating TGOS-related images. It covers:

  • Platform-specific Linux and ArceOS builds
  • Common OS builders under scripts/os/
  • Rootfs generation under scripts/rootfs/
  • Packaging and release helpers
  • Local image distribution with http_server.py

The repository is now organized by responsibility instead of placing every script directly under scripts/.

Repository Layout

Path Purpose
build.sh Top-level entry point for OS, rootfs, and release tasks
run.sh Quick QEMU boot helper for generated QEMU Linux images
scripts/platform/ Platform entry scripts such as Phytium Pi, QEMU, Orange Pi, etc.
scripts/os/ Common OS builders such as ArceOS, Zephyr, FreeRTOS, and RT-Thread
scripts/rootfs/ Rootfs builders for BusyBox, Alpine, and Debian
scripts/tools/ Packaging / release helpers and other utilities
scripts/lib/ Shared shell helpers
patches/ Patches applied to upstream projects during builds
IMAGES/ Final build artifacts
build/ Download caches, source trees, and temporary build output
release/ Packaged archives generated by release scripts

Script Map

Platform Scripts

These scripts are the main entry points for platform-oriented builds. They usually clone upstream sources, apply patches, invoke vendor or upstream build systems, and copy results into IMAGES/.

Script Main responsibility
scripts/platform/phytiumpi.sh Build Phytium Pi guest images
scripts/platform/roc-rk3568-pc.sh Build ROC-RK3568-PC guest images
scripts/platform/evm3588.sh Build EVM3588 guest images
scripts/platform/tac-e400-plc.sh Build TAC-E400-PLC guest images
scripts/platform/orangepi-5-plus.sh Build Orange Pi 5 Plus guest images
scripts/platform/rdk-s100p.sh Build RDK-S100P guest images
scripts/platform/bst-a1000.sh Build BST-A1000 guest images
scripts/platform/qemu.sh Build QEMU guest images and invoke rootfs generation when needed

Common OS Builders

These scripts provide reusable build flows and are called either directly or by platform scripts.

Script Main responsibility
scripts/os/arceos.sh Common ArceOS builder
scripts/os/zephyr.sh Common Zephyr builder
scripts/os/freertos.sh Common FreeRTOS builder
scripts/os/rtthread.sh Common RT-Thread builder

Rootfs Builders

These scripts generate filesystem contents or filesystem images.

Script Main responsibility Typical output
scripts/rootfs/busybox.sh Build a minimal BusyBox-based rootfs busybox-initramfs-<arch>.cpio.gz, busybox-rootfs-<arch>.img
scripts/rootfs/alpine.sh Download Alpine minirootfs and pack an ext4 image alpine-rootfs-<arch>.img
scripts/rootfs/debian.sh Use Docker + debootstrap to build a Debian rootfs image debian-rootfs-<arch>.img

Supported Targets

Platform OS Targets

build.sh os <target> supports the following platform targets:

  • phytiumpi
  • roc-rk3568-pc
  • evm3588
  • tac-e400-plc
  • orangepi-5-plus
  • rdk-s100p
  • bst-a1000
  • qemu
  • qemu-aarch64
  • qemu-riscv64
  • qemu-x86_64
  • qemu-loongarch64

For QEMU:

  • qemu runs qemu-aarch64, qemu-x86_64, qemu-riscv64, and qemu-loongarch64 sequentially
  • qemu-aarch64, qemu-riscv64, qemu-x86_64, and qemu-loongarch64 are thin wrappers over scripts/platform/qemu.sh

scripts/platform/qemu.sh currently supports:

  • aarch64
  • riscv64
  • x86_64
  • loongarch64

Rootfs Targets

build.sh rootfs <target> currently supports:

  • busybox
  • alpine

scripts/rootfs/debian.sh is available directly and currently supports:

  • aarch64
  • riscv64
  • x86_64
  • loongarch64

scripts/rootfs/alpine.sh currently supports:

  • aarch64
  • loongarch64
  • riscv64
  • x86_64

Note: loongarch64 is a valid Debian target in the script, but Debian trixie does not currently provide loong64 packages in the main archive. Use an appropriate suite such as sid / unstable when building that variant.

Build Prerequisites

Before building, make sure the host has enough disk space, network access to the required upstream repositories or intranet SDK services, and the needed toolchains.

On Ubuntu 24.04 or a similar distribution, a practical baseline is:

sudo apt update
sudo apt install \
  flex bison libelf-dev libssl-dev \
  gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
  gcc-riscv64-linux-gnu g++-riscv64-linux-gnu \
  bc fakeroot coreutils cpio gzip rsync file \
  debootstrap binfmt-support debian-archive-keyring eatmydata \
  e2fsprogs docker.io \
  python3 python3-venv curl git openssh-client libmpc-dev libgmp-dev \
  lz4 chrpath gawk texinfo diffstat expect cmake

Some platform builds require:

  • Access to private repositories
  • Access to the intranet SDK host 10.3.10.194
  • Additional vendor SDK dependencies
  • Administrator privileges or passwordless sudo

Quick Start

Unified Entry Point

build.sh is the main entry point.

./build.sh help

# Platform-oriented OS builds
./build.sh platform phytiumpi
./build.sh platform qemu all
./build.sh platform qemu-aarch64 linux
./build.sh platform qemu all --rootfs busybox,alpine,debian

# Rootfs builds
./build.sh rootfs busybox aarch64 --out_dir IMAGES/rootfs
./build.sh rootfs alpine riscv64 --out_dir IMAGES/rootfs/alpine-riscv64.img

# Release packaging
./build.sh release pack

Direct Script Usage

Use platform scripts for fine-grained control:

scripts/platform/phytiumpi.sh all
scripts/platform/qemu.sh aarch64 linux
scripts/platform/qemu.sh riscv64 all
scripts/platform/evm3588.sh arceos

Use rootfs scripts directly when you only need filesystem images:

scripts/rootfs/busybox.sh aarch64 --out_dir IMAGES/rootfs
scripts/rootfs/alpine.sh x86_64 --img-size 2G
scripts/rootfs/debian.sh riscv64 --debian trixie --out_dir IMAGES/rootfs
scripts/rootfs/debian.sh loongarch64 --debian unstable --out_dir IMAGES/rootfs

Rootfs Notes

BusyBox

  • Generates both initramfs and ext4 rootfs images
  • Used by scripts/platform/qemu.sh for QEMU Linux and ArceOS flows
  • Currently supports aarch64, loongarch64, riscv64, and x86_64

Alpine

  • Downloads official Alpine minirootfs
  • Verifies the downloaded archive with SHA256
  • Generates an ext4 rootfs image
  • Currently supports aarch64, loongarch64, riscv64, and x86_64

Debian

  • Uses Docker plus debootstrap
  • Generates an ext4 rootfs image
  • Defaults to Debian trixie
  • Supports aarch64, riscv64, x86_64, and loongarch64

Output Layout

Artifacts are collected under IMAGES/. Common locations include:

Path Contents
IMAGES/qemu-<arch>/linux QEMU Linux kernel artifacts for the given architecture
IMAGES/qemu-<arch>/arceos QEMU ArceOS binaries for the given architecture
IMAGES/rootfs Standalone rootfs images generated directly by rootfs scripts
IMAGES/<platform>/linux Linux artifacts for a hardware platform
IMAGES/<platform>/arceos ArceOS artifacts for a hardware platform

Typical QEMU Linux files:

  • Image for aarch64 / riscv64
  • bzImage for x86_64
  • vmlinuz.efi and vmlinux.elf for loongarch64
  • linux-qemu as the generic QEMU Linux entry name; for loongarch64, this is the ELF image copied from vmlinux.elf
  • BusyBox rootfs artifacts such as busybox-initramfs-<arch>.cpio.gz and busybox-rootfs-<arch>.img

QEMU Validation

Use run.sh for quick local QEMU validation:

./run.sh aarch64 ramfs
./run.sh riscv64 rootfs
./run.sh x86_64 rootfs

QEMU platform build outputs now live under IMAGES/qemu-<arch>/. For LoongArch64, the platform archive qemu-loongarch64.tar.xz contains both linux/vmlinuz.efi and linux/vmlinux.elf; linux/linux-qemu is the generic entry name used by the QEMU platform flow and points at vmlinux.elf. Rootfs images are published separately, including initramfs-loongarch64-busybox.cpio.gz.tar.xz, rootfs-loongarch64-busybox.img.tar.xz, and rootfs-loongarch64-alpine.img.tar.xz by default.

Packaging and Release

Package Artifacts

./build.sh release pack

# Or call the script directly
scripts/tools/pack.sh --in_dir IMAGES --out_dir release

Publish to GitHub Release

--pack IMAGES,release means packaging artifacts from IMAGES/ first, then publishing the files generated under release/.

./build.sh release github \
  --pack IMAGES,release \
  --token <GITHUB_TOKEN> \
  --repo rcore-os/tgosimages \
  --tag v0.0.10

# Or call the script directly
scripts/tools/github.sh \
  --pack IMAGES,release \
  --token <GITHUB_TOKEN> \
  --repo rcore-os/tgosimages \
  --tag v0.0.10

Local Distribution

http_server.py serves files from IMAGES/ using Python's standard library.

python3 http_server.py start
python3 http_server.py status
python3 http_server.py restart -p 9000 -b 127.0.0.1
python3 http_server.py stop

When exposing the server on a shared network, restrict access with firewalls or a reverse proxy.

Contributing

Contributions are welcome for:

  • New platform scripts
  • Improvements to build flows
  • Rootfs generation updates
  • Documentation fixes

Before sending a pull request, please keep script style consistent and document how to reproduce your result.

License

This project is licensed under the MIT License. See LICENSE for details.

About

tgosimages

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors