Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Update #105

Merged
merged 8 commits into from
Dec 1, 2023
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/raspOVOS-gui.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build raspOVOS-gui
name: Build raspOVOS-mark2
on:
workflow_dispatch:

Expand All @@ -13,14 +13,14 @@ jobs:
id: build
with:
# Final image name.
image-name: raspOVOS-gui-dev
image-name: raspOVOS-mark2-dev

# List of stage name to execute in given order. Relative and absolute paths to
# custom stage directories are allowed here. Note that by default pi-gen exports
# images in stage2 (lite), stage4 and stage5. You probably want to hook in custom
# stages before one of the exported stages. Otherwise, the action will make sure
# any custom stage will include an image export directive.
stage-list: stage0 stage1 stage2 ./stage-prep ./stage-core ./stage-phal ./stage-audio ./stage-skills ./stage-hivemind ./stage-ggwave ./stage-gui ./stage-finalize
stage-list: stage0 stage1 stage2 ./stage-prep ./stage-splash ./stage-core ./stage-hivemind ./stage-skills ./stage-phal ./stage-audio ./stage-speech ./stage-listener ./stage-ggwave ./stage-gui ./stage-finalize

# Host name of the image.
hostname: raspOvos
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/raspOVOS-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
id: build
with:
# Final image name.
image-name: raspOVOS-headless-dev
image-name: rasp-ovos-headless-dev

# List of stage name to execute in given order. Relative and absolute paths to
# custom stage directories are allowed here. Note that by default pi-gen exports
# images in stage2 (lite), stage4 and stage5. You probably want to hook in custom
# stages before one of the exported stages. Otherwise, the action will make sure
# any custom stage will include an image export directive.
stage-list: stage0 stage1 stage2 ./stage-prep ./stage-core ./stage-phal ./stage-audio ./stage-skills ./stage-hivemind ./stage-ggwave ./stage-finalize
stage-list: stage0 stage1 stage2 ./stage-prep ./stage-splash ./stage-core ./stage-hivemind ./stage-skills ./stage-audio ./stage-speech ./stage-listener ./stage-ggwave ./stage-phal ./stage-finalize

# Host name of the image.
hostname: raspOvos
Expand Down
135 changes: 135 additions & 0 deletions .github/workflows/raspOVOS-mark2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Build raspOVOS-mark2
on:
workflow_dispatch:

jobs:
pi-gen-ovos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- uses: usimd/pi-gen-action@v1
id: build
with:
# Final image name.
image-name: raspOVOS-mark2-dev

# List of stage name to execute in given order. Relative and absolute paths to
# custom stage directories are allowed here. Note that by default pi-gen exports
# images in stage2 (lite), stage4 and stage5. You probably want to hook in custom
# stages before one of the exported stages. Otherwise, the action will make sure
# any custom stage will include an image export directive.
stage-list: stage0 stage1 stage2 ./stage-prep ./stage-splash ./stage-core ./stage-hivemind ./stage-skills ./stage-phal ./stage-audio ./stage-speech ./stage-listener ./stage-ggwave ./stage-gui ./stage-mark2 ./stage-finalize

# Host name of the image.
hostname: raspOvos

# Default keyboard keymap.
keyboard-keymap: us

# Default keyboard layout.
keyboard-layout: English (US)

# Default locale of the system image.
locale: en_US.UTF-8

# Default wifi country
wpa-country: US

# Default timezone
timezone: America/Denver

# Name of the initial user account.
username: ovos

# Password of the intial user account, locked if empty.
password: 'ovos'

# Compression to apply on final image (either "none", "zip", "xz" or "gz").
compression: zip

# Compression level to be used. From 0 to 9 (refer to the tool man page for more
# information on this. Usually 0 is no compression but very fast, up to 9 with the
# best compression but very slow).
compression-level: 6

# Disable the renaming of the first user during the first boot. This make it so
# 'username' stays activated. 'username' must be set for this to work. Please be
# aware of the implied security risk of defining a default username and password
# for your devices.
disable-first-boot-user-rename: 1

# Additional options to include in PIGEN_DOCKER_OPTS
docker-opts: ''

# Set whether a NOOBS image should be built as well. If enabled, the output
# directory containing the NOOBS files will be saved as output variable
# 'image-noobs-path'.
enable-noobs: false

# Enable SSH access to Pi.
enable-ssh: 1

# If this feature is enabled, the action will configure pi-gen to not export any
# stage as image but the last one defined in property 'stage-list'. This is
# helpful when building a single image flavor (in contrast to building a
# lite/server and full-blown desktop image), since it speeds up the build process
# significantly.
export-last-stage-only: true

# Comma or whitespace separated list of additional packages to install on host
# before running pi-gen. Use this list to add any packages your custom stages may
# require. Note that this is not affecting the final image. In order to add
# additional packages, you need to add a respective 'XX-packages' file in your
# custom stage.
extra-host-dependencies: ''

# Comma or whitespace separated list of additional modules to load on host before
# running pi-gen. If your custom stage requires additional software or kernel
# modules to be loaded, add them here. Note that this is not meant to configure
# modules to be loaded in the target image.
extra-host-modules: ''

# Token to use for checking out pi-gen repo.
github-token: ${{ github.token }}

# Path where selected pi-gen ref will be checked out to. If the path does not yet
# exist, it will be created (including its parents).
pi-gen-dir: pi-gen

# GitHub repository to fetch pi-gen from, must be a fork from RPi-Distro/pi-gen.

pi-gen-repository: RPi-Distro/pi-gen

# Release version of pi-gen to use. This can both be a branch or tag name known in
# the pi-gen repository.
pi-gen-version: arm64

# The release version to build images against. Valid values are jessie, stretch,
# buster, bullseye, and testing.
release: bookworm

# Setting to `1` will prevent pi-gen from dropping the "capabilities" feature.
# Generating the root filesystem with capabilities enabled and running it from a
# filesystem that does not support capabilities (like NFS) can cause issues. Only
# enable this if you understand what it is.
setfcap: ''

# Use qcow2 images to reduce space and runtime requirements.
use-qcow2: 1

# Print all output from pi-gen.
verbose-output: true

- name: copy file via ssh password
uses: appleboy/scp-action@master
with:
host: ovosimages.ziggyai.online
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.SSH_PORT }}
source: "${{ steps.build.outputs.image-path }}"
target: "raspbian/development"
strip_components: 4

206 changes: 206 additions & 0 deletions BUILD_LOCAL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
# Build raspOVOS locally

It is possible to build this image locally for development purposes or for fun.

## Understanding this repository

This repository contains several directories with the `stage-` prefix. Each one is executed in the order specified in a config file. [example here](#)

A few of the stages are needed for an OVOS image. Once a `headless` image is built, other stages can be added for other usage such as a GUI system, or Mark2 device.

## Needed for Headless Image

### stage-prep

This is where all of the system setup happens.

- Adds an apt repository for `mimic`
- Configures locale
- Installs essential packages with apt
- Patches `cmdline.txt` for zram
- Sets up automounting of USB media
- Adds `system` and `user` systemd preset files
- Disables WiFi powersave
- Sets up rules for NetworkManager
- Creates `.bashrc`, `.bash_profile`, and other `.<filename>` files in the users home directory

### stage-splash

**Optional**

Add a little pizazz and give it a splash screen

### stage-core

This is where [ovos-core](https://github.com/OpenVoiceOS/ovos-core) and [ovos-messagebus](https://github.com/OpenVoiceOS/ovos-messagebus) are installed.

This also creates the `ovos.service`, `ovos-skills.service` and `ovos-messagebus.service`

### stage-hivemind

**Optional**

This is here so you can make your device a [HiveMind listener](https://github.com/JarbasHiveMind/HiveMind-core).

The service `hivemind-listener.service` is created, but disabled by default.

On a running image, issue the command `systemctl --user enable hivemind-listener.service` and `systemctl --user start hivemind-listener.service` to start it automatically on boot.

### stage-skills

Duh!! Install the skills here. The service was created in `stage-core`, but skills are installed here. This is just a MINIMAL set of skills to get your OVOS assistant up and running. More can be installed on a running system.

**At this point, with `hivemind-listener.service` enabled, you can skip to the last step, [stage-finalize](#), and have a working HiveMind master**

### stage-audio

This stage is where pulseaudio, or eventually pipewire is installed and configured.

There is a `hardware` section here that has a service for autodetection of HAT's, including `respeakers` and the `sj201` *(implemented later)*. This section is a **WIP** and any feedback would be great.

### stage-speech

[ovos-audio](https://github.com/OpenVoiceOS/ovos-audio) is installed and configured.

TTS engines are installed and configured.

### stage-listener

This is where [ovos-dinkum-listener](https://github.com/OpenVoiceOS/ovos-dinkum-listener) is installed and configured.

You can also configure your microphone and VAD plugins here.

### stage-ggwave

**Optional**

This is installed after `stage-audio` because it depends on sound to work.

For more informaton on how to use the [ovos-audio-transformer-plugin-ggwave](https://github.com/OpenVoiceOS/ovos-audio-transformer-plugin-ggwave).

### stage-phal

[ovos_PHAL](https://github.com/OpenVoiceOS/ovos-PHAL) (Plugin based Hardware Abstraction Layer) is where OVOS interacts with the device hardware.

**From here you can skip to [stage-finalize](stage-finalize) and have a complete `raspOVOS headless` system which will even run on a RPi3b**

## Optional and a WIP for now

### stage-shareport

Apple AirPlay support

### stage-spotify

Premium Spotify support

## Needed for GUI Image

### stage-gui

This stage adds all of the components to have a working OVOS GUI device. **You must have at least a RPi4 2G for this to run**

[ovos-shell](#) and [ovos-gui](#) are installed and configured here.

The `/boot/firmware/config.txt` is modified to allow a GUI

**Skip to [stage-finalize](stage-finalize) to build a simple raspOVOS-GUI image**

## Optional Special Stages

### stage-mark1

**WIP**

Special configuration to support the Mycroft Mark1 device

### stage-mark2

**WIP**

Special configuration to support the Mycroft Mark2 device

## And the Final Stage

### stage-finalize

This is where the final things happen.

- system links to log files
- enabling systemd service files
- naming the image

# Pi-gen

In order to build an image, we use the official image builder of raspbianOS...[pi-gen](https://github.com/RPi-Distro/pi-gen).

pi-gen is organized into branches depending on the version you would like to build.

- master
- The default branch - 32b `bookworm`
- arm64
- The branch we normally use - 64b `bookworm`
- bullseye
- 32b `bullseye`
- bullseye-arm64
- 64b `bullseye`

For specific information on using pi-gen, consult the [README](https://github.com/RPi-Distro/pi-gen/blob/master/README.md)file.

# Building an Image

From this point, we will assume you are working from your `home` directory

`cd ~`

Clone the required repositories

`git clone https://github.com/OpenVoiceOS/raspbian-ovos`

`git clone https://github.com/RPi-Distro/pi-gen`

Copy the `raspbian-ovos-config.example` file to make the required changes to it.

`cp raspbian-ovos/raspbian-ovos-config.example ./raspbian-ovos-config`

Edit the file

`nano ./raspbian-ovos-config`

Change all references to `<FULL/PATH/TO/CLONED/REPO>` to where you cloned the `raspbian-ovos` repository. For this example it would be `/home/<USER>/raspbian-ovos/`

The example file is configured for a headless image. Add the stages from above for a GUI or other image.

You can also change the name of the image and other configuration settings, such as the default locale.

After making your changes, save and exit

`Ctl-o`

`Ctl-x`

Move into the pi-gen directory.

`cd pi-gen`

Switch to the `arm64` branch of `pi-gen`

`git checkout arm64`

To actually build an image, you need root privileges.

#### Start the build process

`sudo ./build.sh -c /home/<USER>/raspbian-ovos-config`

The `-c` flag should point to your edited configuration file.

Sit back and wait. The build process can last several hours.

#### Getting the image

After the build process, a compressed image will be avaliable in the directory `~/pi-gen/deploy`

Write the image to a USB3 drive or a SSD drive. SD cards may work, but have not been tested.

Boot your new OVOS assistant and enjoy!!
Loading
Loading