Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 132 additions & 6 deletions Development.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Elegoo Centauri Carbon 1 - Yocto Firmware Build
# Elegoo Centauri Carbon - Yocto Firmware Build

This repository contains a Yocto Project-based firmware build system for the Elegoo Centauri Carbon 1 3D printer. The mainboard of this printer is powered by an Allwinner r528 SoC.
This repository contains a Yocto Project-based firmware build system for the Elegoo Centauri Carbon 3D printer family. The mainboard of these printers is powered by an Allwinner R528 SoC.

_**Unsure about what COSMOS is? [Check the FAQ to learn more](./FAQ.md)**_

## Prerequisites

Before starting the build process, you need to install the required dependencies on your host system (Ubuntu/Debian is assumed):
Expand All @@ -16,6 +17,67 @@ sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential \
bmap-tools sunxi-tools
```

## Build Configuration Options

### Machine Selection (CC1 vs CC2)

The build supports different machine configurations for the Centauri Carbon variants:

| Machine | Description |
|---------|-------------|
| `elegoo-centauri-carbon1` | Original Centauri Carbon 1 (default) |
| `elegoo-centauri-carbon2` | Centauri Carbon 2 |

The default in `build/conf/local.conf` is set to CC1:
```bash
MACHINE ?= "elegoo-centauri-carbon1"
```

To build for CC2, specify the machine on the command line:
```bash
MACHINE=elegoo-centauri-carbon2 bitbake opencentauri-image-usb
```

### Image Type Selection (USB vs eMMC)

Choose the appropriate image type based on your target boot media:

| Image Recipe | Target Media | Use Case |
|--------------|--------------|----------|
| `opencentauri-image-usb` | USB drive | Development, testing, or running from USB |
| `opencentauri-image-mmc` | Internal eMMC | Production installation on printer internal storage |

#### USB Image (`opencentauri-image-usb`)
- Boots from USB drive
- Read-write root filesystem
- Suitable for development and testing
- Larger partition layout for USB storage

**Important U-Boot Configuration for USB Builds:**
When building the USB image, the MMC environment storage options must be removed from the U-Boot defconfig for your target machine. These settings cause U-Boot to store its environment on the internal eMMC, which conflicts with USB boot.

For **CC1**, edit:
- `meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon1/elegoo_centauri_carbon_defconfig`

For **CC2**, edit:
- `meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon2/elegoo_centauri_carbon_defconfig`

Remove (or ensure absent) these configuration options:
```
CONFIG_ENV_IS_IN_MMC=y
CONFIG_ENV_OFFSET=0x1A66000
CONFIG_ENV_OFFSET_REDUND=0x1AA5000
CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
```

This is required for proper USB boot functionality.

#### eMMC Image (`opencentauri-image-mmc`)
- Installs to internal eMMC storage
- Read-only SquashFS root with overlay filesystem for `/etc` on `/data` partition
- Optimized for production use
- Includes A/B boot partition scheme for safe updates via swupdate

## How to Build

1. **Initialize the build environment:**
Expand All @@ -24,25 +86,59 @@ sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential \
source poky/oe-init-build-env build
```

2. **Run BitBake:**
Once the environment is set up, you can start the build process for the target image. The primary image recipe for this project is `opencentauri-image`.
2. **Configure your target (if needed):**
Ensure `MACHINE` is set correctly in `build/conf/local.conf`:
```bash
# For CC1 or CC2
MACHINE ?= "elegoo-centauri-carbon1"
```

3. **Run BitBake:**
Choose the appropriate image recipe for your target:

**For USB booting:**
```bash
bitbake opencentauri-image-usb
```

**For eMMC/internal storage:**
```bash
bitbake opencentauri-image
bitbake opencentauri-image-mmc
```

*Note: The first build will take a significant amount of time as it downloads and compiles all necessary packages from source.*

## Build Outputs

After a successful build, the output files are located in:

```
tmp/deploy/images/elegoo-centauri-carbon1/
```

### USB Image Outputs
- `opencentauri-image-usb-elegoo-centauri-carbon1.rootfs.wic.gz` - Compressed disk image for USB drives

Comment on lines +106 to +121
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Build Outputs section hard-codes the deploy path and artifact names for elegoo-centauri-carbon1. When building for CC2, Yocto deploys under tmp/deploy/images/elegoo-centauri-carbon2/ and the image filenames will be CC2-specific. Update this section to refer to ${MACHINE} (or provide both CC1/CC2 examples) to avoid misleading CC2 developers.

Copilot uses AI. Check for mistakes.
### eMMC Image Outputs
- `opencentauri-image-mmc-elegoo-centauri-carbon1.rootfs.wic.gz` - Full disk image for eMMC
- `bootA.img` - Extracted boot partition image (for swupdate)
- `bootlogos.img` - Extracted boot logos partition image (for swupdate)
- `rootfs.squashfs` - SquashFS root filesystem

## Disk Space Requirements

Building a complete Yocto image requires a substantial amount of disk space. Based on current build sizes, you should expect the project directory (including downloaded sources, build artifacts, and caches) to use approximately **38GB to 40GB** of disk space. Please ensure you have adequate free space before starting the build.

## Running on the Centauri Carbon 1

### USB Boot Method (Development)

Note that the current install requires having a serial UART connected to the CC1 motherboard, as well as a FEL USB cable attached. This will prevent the toolhead from being plugged in!

1. **Install built firmware image to a USB drive.**
*(Warning: This is a destructive operation! Replace `sdX` with your actual USB drive device like `sdb`, `sdc`, etc.)*
```bash
sudo bmaptool copy tmp/deploy/images/elegoo-centauri-carbon1/opencentauri-image-elegoo-centauri-carbon1.rootfs.wic.gz /dev/sdX
sudo bmaptool copy tmp/deploy/images/elegoo-centauri-carbon1/opencentauri-image-usb-elegoo-centauri-carbon1.rootfs.wic.gz /dev/sdX
```

2. **Boot into FEL Mode.**
Expand Down Expand Up @@ -76,10 +172,40 @@ Note that the current install requires having a serial UART connected to the CC1
5. **Access the Printer Interface.**
Find the printer's IP address by running `ip a`. Access the Mainsail interface by visiting the printer's IP address via HTTP (port 80) in your web browser!

### eMMC Install Method (Production)

For installing to internal eMMC storage, use the swupdate-based installation:

1. Build the `opencentauri-upgrade` target. This recipe depends on `opencentauri-image-mmc` and produces the SWUpdate bundle:
```bash
bitbake opencentauri-upgrade
```
2. Locate the generated `.swu` file in `tmp/deploy/images/elegoo-centauri-carbon1/` (e.g. `opencentauri-upgrade-elegoo-centauri-carbon1.swu`).
3. Copy the `.swu` file to a FAT32-formatted USB drive in the `install_opencentauri` folder, renaming it to `update.swu`.
4. Insert the USB drive into the printer
5. Import the `IMPORT_ME_DO_NOT_PRINT` file via the printer screen as you would for stock OpenCentauri

## Configuration and Services

- **Klipper Configuration:** In the current build, the Klipper `printer.cfg` is located in `/etc/klipper/config/printer.cfg`.
- **Services:** Everything is running as an `init.d` service. You can restart Klipper by running:
```bash
service klipper restart
```

## Troubleshooting Build Issues

### Clean Build
If you encounter build issues, try cleaning the specific package:
```bash
bitbake -c cleansstate <package-name>
bitbake <image-target>
```

### Full Reset
For a complete clean build (removes all build artifacts):
```bash
rm -rf tmp/
source poky/oe-init-build-env build
bitbake <image-target>
```
4 changes: 2 additions & 2 deletions meta-opencentauri/conf/machine/elegoo-centauri-carbon1.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ require conf/machine/include/sun8i.inc

DEFAULTTUNE = "cortexa7thf-neon-vfpv4"

KERNEL_DEVICETREE = "allwinner/elegoo-centauri-carbon1.dtb"
KERNEL_DEVICETREE = "allwinner/elegoo-centauri-carbon.dtb"
KERNEL_IMAGETYPE = "zImage"
UBOOT_ENTRYPOINT = "0x43000000"
SERIAL_CONSOLES = "115200;ttyS0"

UBOOT_MACHINE = "elegoo_centauri_carbon1_defconfig"
UBOOT_MACHINE = "elegoo_centauri_carbon_defconfig"
14 changes: 14 additions & 0 deletions meta-opencentauri/conf/machine/elegoo-centauri-carbon2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#@TYPE: Machine
#@NAME: Elegoo Centauri Carbon 2
#@DESCRIPTION: Machine configuration for the Elegoo Centauri Carbon 2, based on the Allwinner R528 CPU

require conf/machine/include/sun8i.inc

DEFAULTTUNE = "cortexa7thf-neon-vfpv4"

KERNEL_DEVICETREE = "allwinner/elegoo-centauri-carbon.dtb"
KERNEL_IMAGETYPE = "zImage"
UBOOT_ENTRYPOINT = "0x43000000"
SERIAL_CONSOLES = "115200;ttyS2"

UBOOT_MACHINE = "elegoo_centauri_carbon_defconfig"
4 changes: 2 additions & 2 deletions meta-opencentauri/images/files/sw-description
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ software =
},
{
name = "bootcmd_mainline";
value = "run setargs_mainline; fatload mmc 0:${boot_part} 43000000 zImage; fatload mmc 0:${boot_part} 43800000 elegoo-centauri-carbon1.dtb; bootz 43000000 - 43800000";
value = "run setargs_mainline; fatload mmc 0:${boot_part} 43000000 zImage; fatload mmc 0:${boot_part} 43800000 elegoo-centauri-carbon.dtb; bootz 43000000 - 43800000";
},
{
name = "bootcmd";
Expand Down Expand Up @@ -152,7 +152,7 @@ software =
},
{
name = "bootcmd_mainline";
value = "run setargs_mainline; fatload mmc 0:${boot_part} 43000000 zImage; fatload mmc 0:${boot_part} 43800000 elegoo-centauri-carbon1.dtb; bootz 43000000 - 43800000";
value = "run setargs_mainline; fatload mmc 0:${boot_part} 43000000 zImage; fatload mmc 0:${boot_part} 43800000 elegoo-centauri-carbon.dtb; bootz 43000000 - 43800000";
},
{
name = "bootcmd";
Expand Down
5 changes: 4 additions & 1 deletion meta-opencentauri/images/opencentauri-image-base.bb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ CORE_IMAGE_EXTRA_INSTALL += "\
libgpiod \
libgpiod-tools \
kernel-modules \
rtw88 \
wpa-supplicant \
iw \
kalico \
Expand Down Expand Up @@ -43,6 +42,10 @@ CORE_IMAGE_EXTRA_INSTALL += "\
v4l-utils \
"

CORE_IMAGE_EXTRA_INSTALL:append:elegoo-centauri-carbon1 = " \
rtw88 \
"

INITRAMFS_IMAGE = "core-image-tiny-initramfs"
INITRAMFS_FSTYPES = "cpio.gz"
INITRAMFS_IMAGE_BUNDLE = "1"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 618c5a97497dd5934dc5e8a5b6861bdaa6af5916 Mon Sep 17 00:00:00 2001
From: James Turton <james.turton@gmx.com>
Date: Mon, 16 Feb 2026 21:36:45 +0100
Subject: [PATCH] Add elegoo-centauri-carbon1.dts
Subject: [PATCH] Add elegoo-centauri-carbon.dts

Signed-off-by: James Turton <james.turton@gmx.com>
Upstream-Status: Pending [Not submitted to upstream yet]
Expand All @@ -17,7 +17,7 @@ index 04b9863b5d5..b28ed796445 100644
sun8i-v3-sl631-imx179.dtb \
sun8i-v3s-licheepi-zero.dtb
dtb-$(CONFIG_MACH_SUN8I_R528) += \
+ elegoo-centauri-carbon1.dtb \
+ elegoo-centauri-carbon.dtb \
sun8i-t113s-mangopi-mq-r-t113.dtb
dtb-$(CONFIG_MACH_SUN50I_H5) += \
sun50i-h5-bananapi-m2-plus.dtb \
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ systemAB_next=A
boot_part=4
mmc_root=/dev/mmcblk0p5
setargs_mainline=setenv bootargs console=ttyS0,115200 earlycon=uart8250,mmio32,0x02500000 root=${mmc_root} rootwait
bootcmd_mainline=run setargs_mainline; fatload mmc 0:${boot_part} 43000000 zImage; fatload mmc 0:${boot_part} 43800000 elegoo-centauri-carbon1.dtb; bootz 43000000 - 43800000
bootcmd_mainline=run setargs_mainline; fatload mmc 0:${boot_part} 43000000 zImage; fatload mmc 0:${boot_part} 43800000 elegoo-centauri-carbon.dtb; bootz 43000000 - 43800000
bootcmd=if test x${swu_mode} = xmainline; then run bootcmd_mainline; else run bootcmd_stock; fi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CONFIG_ARM=y
CONFIG_ARCH_SUNXI=y
CONFIG_DEFAULT_DEVICE_TREE="elegoo-centauri-carbon1"
CONFIG_DEFAULT_DEVICE_TREE="elegoo-centauri-carbon"
CONFIG_SPL=y
CONFIG_MACH_SUN8I_R528=y
CONFIG_DRAM_CLK=792
Expand Down Expand Up @@ -28,7 +28,7 @@ CONFIG_CMD_USB=y
# CONFIG_USE_BOOTARGS=y
# CONFIG_BOOTARGS="console=ttyS0,115200 earlycon=uart8250,mmio32,0x02500000 root=/dev/sda2 rootwait"
# CONFIG_USE_BOOTCOMMAND=y
# CONFIG_BOOTCOMMAND="fatload usb 0:1 43000000 zImage; fatload usb 0:1 43800000 elegoo-centauri-carbon1.dtb; bootz 43000000 - 43800000"
# CONFIG_BOOTCOMMAND="fatload usb 0:1 43000000 zImage; fatload usb 0:1 43800000 elegoo-centauri-carbon.dtb; bootz 43000000 - 43800000"

# Display / splash screen
CONFIG_VIDEO=y
Expand All @@ -52,7 +52,7 @@ CONFIG_SPL_LOG_MAX_LEVEL=7
CONFIG_SPL_LOG_CONSOLE=y
CONFIG_SPL_STACK_R_ADDR=0x47e00000

CONFIG_ENV_SOURCE_FILE="elegoo-centauri-carbon1"
CONFIG_ENV_SOURCE_FILE="elegoo-centauri-carbon"
CONFIG_ENV_SIZE=0x20000
CONFIG_ENV_OFFSET=0x1A66000
CONFIG_ENV_OFFSET_REDUND=0x1AA5000
Expand Down
Loading
Loading