Skip to content
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
27 changes: 18 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ endif

# Default platforms to build (can be overridden with PLATFORMS=...)
ifeq (,$(PLATFORMS))
PLATFORMS = miyoomini trimuismart rg35xx rg35xxplus my355 tg5040 zero28 rgb30 m17 my282 magicmini rk3566
PLATFORMS = miyoomini trimuismart rg35xx rg35xxplus my355 tg5040 zero28 rgb30 m17 my282 magicmini
endif

###########################################################
Expand Down Expand Up @@ -208,26 +208,35 @@ dev-run-16x9:
# Usage: make dev-deploy - Deploy all platforms
# make dev-deploy PLATFORM=X - Deploy single platform
dev-deploy:
@if [ -n "$(PLATFORM)" ]; then \
./scripts/dev-deploy.sh --platform $(PLATFORM); \
@DEPLOY_ARGS=""; \
if [ -n "$(DEPLOY_PATH)" ]; then \
DEPLOY_ARGS="--path $(DEPLOY_PATH)"; \
fi; \
if [ -n "$(PLATFORM)" ]; then \
./scripts/dev-deploy.sh --platform $(PLATFORM) $$DEPLOY_ARGS; \
else \
./scripts/dev-deploy.sh; \
./scripts/dev-deploy.sh $$DEPLOY_ARGS; \
fi

# Build and deploy in one shot for dev iteration (always debug build)
# Uses 'stage' to prepare files without compression (faster than full 'all')
# Usage: make dev-build-deploy - Build all platforms and deploy
# make dev-build-deploy PLATFORM=miyoomini - Build and deploy single platform
# Usage: make dev-build-deploy - Build all platforms and deploy
# make dev-build-deploy PLATFORM=miyoomini - Build and deploy single platform
# make dev-build-deploy DEPLOY_PATH=/Volumes/LESSUI - Override SD card path
# Note: Single-platform requires 'make setup' to have been run first
dev-build-deploy:
@if [ -n "$(PLATFORM)" ]; then \
@DEPLOY_ARGS=""; \
if [ -n "$(DEPLOY_PATH)" ]; then \
DEPLOY_ARGS="--path $(DEPLOY_PATH)"; \
fi; \
if [ -n "$(PLATFORM)" ]; then \
if [ ! -d ./build/SYSTEM ]; then \
echo "Error: build/SYSTEM not found. Run 'make setup' first."; \
exit 1; \
fi; \
$(MAKE) common PLATFORM=$(PLATFORM) DEBUG=1 && $(MAKE) stage && ./scripts/dev-deploy.sh --platform $(PLATFORM); \
$(MAKE) common PLATFORM=$(PLATFORM) DEBUG=1 && $(MAKE) stage && ./scripts/dev-deploy.sh --platform $(PLATFORM) $$DEPLOY_ARGS; \
else \
$(MAKE) setup DEBUG=1 && $(MAKE) $(PLATFORMS) DEBUG=1 && $(MAKE) special && $(MAKE) stage && ./scripts/dev-deploy.sh; \
$(MAKE) setup DEBUG=1 && $(MAKE) $(PLATFORMS) DEBUG=1 && $(MAKE) special && $(MAKE) stage && ./scripts/dev-deploy.sh $$DEPLOY_ARGS; \
fi

# Build all components for a specific platform (in Docker)
Expand Down
32 changes: 23 additions & 9 deletions Makefile.toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
# specific architectures (e.g., trimuismart and tg5040 need amd64).
#
# Adding a new platform:
# 1. Fork the union-<platform>-toolchain repo to lessui-hq org
# 2. Add .github/workflows/build-container.yml to the fork
# 3. Trigger the workflow to build and publish container
# 4. Add platform entry to toolchains.json with appropriate architecture
# 1. Choose approach:
# a) Reuse existing toolchain: Add to toolchains.json with "toolchain" field
# (e.g., rgb30 reuses rk3566 toolchain)
# b) New toolchain: Fork union-<chipset>-toolchain repo to lessui-hq org
# 2. If creating new toolchain:
# - Add .github/workflows/build-container.yml to the fork
# - Trigger workflow to build and publish container
# 3. Add platform entry to toolchains.json with appropriate architecture
#
# DO NOT call this makefile directly unless debugging toolchain issues.
# Use the main makefile's 'shell' and 'build' targets instead.
Expand All @@ -43,7 +47,11 @@ GUEST_WORKSPACE = /root/workspace
# Pre-built container registry
CONTAINER_REGISTRY = ghcr.io
CONTAINER_ORG = lessui-hq
CONTAINER_NAME = union-$(PLATFORM)-toolchain

# Read toolchain name from toolchains.json (defaults to platform name)
# Allows platforms to share toolchains (e.g., rgb30 uses rk3566 toolchain)
TOOLCHAIN_NAME = $(shell jq -r --arg p "$(PLATFORM)" '.toolchains[$$p].toolchain // $$p' toolchains.json 2>/dev/null || echo "$(PLATFORM)")
CONTAINER_NAME = union-$(TOOLCHAIN_NAME)-toolchain
CONTAINER_TAG = latest
CONTAINER_IMAGE = $(CONTAINER_REGISTRY)/$(CONTAINER_ORG)/$(CONTAINER_NAME):$(CONTAINER_TAG)

Expand All @@ -52,7 +60,7 @@ CONTAINER_IMAGE = $(CONTAINER_REGISTRY)/$(CONTAINER_ORG)/$(CONTAINER_NAME):$(CON
DOCKER_PLATFORM = $(shell jq -r --arg p "$(PLATFORM)" '.toolchains[$$p].platform // "linux/arm64"' toolchains.json 2>/dev/null || echo "linux/arm64")

# Common docker run options
DOCKER_RUN = docker run --rm --platform=$(DOCKER_PLATFORM) -e LOG_FLAGS="$(LOG_FLAGS)" -e OPT_FLAGS="$(OPT_FLAGS)" -e BUILD_HASH="$(BUILD_HASH)" -v $(HOST_WORKSPACE):$(GUEST_WORKSPACE)
DOCKER_RUN = docker run --rm --platform=$(DOCKER_PLATFORM) -e PLATFORM="$(PLATFORM)" -e LOG_FLAGS="$(LOG_FLAGS)" -e OPT_FLAGS="$(OPT_FLAGS)" -e BUILD_HASH="$(BUILD_HASH)" -v $(HOST_WORKSPACE):$(GUEST_WORKSPACE)

# Default target: launch interactive shell (pulls image if missing)
all:
Expand All @@ -71,9 +79,15 @@ pull:
echo "❌ Container not found: $(CONTAINER_IMAGE)" && \
echo "" && \
echo "To add support for $(PLATFORM):" && \
echo " 1. Fork the union-$(PLATFORM)-toolchain to lessui-hq org" && \
echo " 2. Add .github/workflows/build-container.yml" && \
echo " 3. Trigger workflow to build and publish container" && \
echo " Option A: Reuse existing toolchain" && \
echo " 1. Add \"toolchain\": \"<chipset>\" to toolchains.json" && \
echo " 2. Specify platform architecture (linux/amd64 or linux/arm64)" && \
echo "" && \
echo " Option B: Create new toolchain" && \
echo " 1. Fork union-<chipset>-toolchain to lessui-hq org" && \
echo " 2. Add .github/workflows/build-container.yml" && \
echo " 3. Trigger workflow to build and publish container" && \
echo " 4. Add platform entry to toolchains.json" && \
echo "" && \
exit 1)
@echo "✓ Updated to latest"
Expand Down
13 changes: 11 additions & 2 deletions scripts/dev-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Usage: ./scripts/dev-deploy.sh [options]
#
# Options:
# --path PATH Override SD card path (default: /Volumes/LESSUI_DEV)
# --no-update Skip .tmp_update (won't trigger update on device boot)
# --platform X Only sync specific platform (e.g., miyoomini)
# --no-eject Don't eject the SD card after sync
Expand All @@ -20,7 +21,7 @@ set -e

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
SD_CARD="/Volumes/LESSUI_DEV"
SD_CARD="/Volumes/LESSUI_DEV" # Default, can be overridden
PAYLOAD_DIR="$PROJECT_ROOT/build/PAYLOAD"
BASE_DIR="$PROJECT_ROOT/build/BASE"

Expand All @@ -31,6 +32,14 @@ DO_EJECT=true

while [[ $# -gt 0 ]]; do
case $1 in
--path)
if [[ -z "${2:-}" || "$2" == --* ]]; then
echo "Error: --path requires a value"
exit 1
fi
SD_CARD="$2"
shift 2
;;
--no-update)
SYNC_UPDATE=false
shift
Expand All @@ -54,7 +63,7 @@ while [[ $# -gt 0 ]]; do
;;
*)
echo "Error: Unknown option: $1"
echo "Usage: $0 [--no-update] [--platform <name>] [--no-eject]"
echo "Usage: $0 [--path <path>] [--no-update] [--platform <name>] [--no-eject]"
exit 1
;;
esac
Expand Down
20 changes: 17 additions & 3 deletions skeleton/BOOT/common/updater
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@

# NOTE: becomes .tmp_update/updater

# LessOS provides platform directly via environment variable
if [ -n "$LESSOS_PLATFORM" ]; then
PLATFORM=$(echo "$LESSOS_PLATFORM" | tr '[:upper:]' '[:lower:]')
# LessOS provides device name - map to LessUI platform
if [ -n "$LESSOS_DEVICE" ]; then
case "$LESSOS_DEVICE" in
*"RGB30"*)
PLATFORM="rgb30"
;;
*"RG353P"*|*"RG353V"*|*"RG353M"*|*"RG353"*)
# Future: map to rg353 platform if/when we add it
# For now, unsupported
echo "LessUI: Device $LESSOS_DEVICE not yet supported"
PLATFORM=""
;;
*)
echo "LessUI: Unknown LessOS device: $LESSOS_DEVICE"
PLATFORM=""
;;
esac
else
# Stock OS - detect platform from cpuinfo
INFO=$(cat /proc/cpuinfo 2>/dev/null)
Expand Down
12 changes: 0 additions & 12 deletions skeleton/SYSTEM/rk3566/bin/shutdown

This file was deleted.

Empty file removed skeleton/SYSTEM/rk3566/cores/.keep
Empty file.
Empty file removed skeleton/SYSTEM/rk3566/dat/.keep
Empty file.
Empty file removed skeleton/SYSTEM/rk3566/lib/.keep
Empty file.
2 changes: 0 additions & 2 deletions skeleton/SYSTEM/rk3566/system.cfg

This file was deleted.

5 changes: 3 additions & 2 deletions toolchains.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"tg5040": {
"platform": "linux/amd64"
},
"rk3566": {
"platform": "linux/amd64"
"rgb30": {
"platform": "linux/amd64",
"toolchain": "rk3566"
}
}
}
20 changes: 0 additions & 20 deletions workspace/all/common/gl_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1872,10 +1872,7 @@ void GLVideo_uploadFrame(const void* data, unsigned width, unsigned height, size
}

void GLVideo_presentSurface(SDL_Surface* surface) {
LOG_debug("presentSurface: enter");

if (!gl_state.context_ready || gl_state.shutdown_prepared) {
LOG_debug("presentSurface: context not ready, returning");
return;
}

Expand All @@ -1884,28 +1881,21 @@ void GLVideo_presentSurface(SDL_Surface* surface) {
return;
}

LOG_debug("presentSurface: surface %dx%d", surface->w, surface->h);

SDL_Window* window = PLAT_getWindow();
if (!window) {
LOG_error("GL video: no window for surface presentation");
return;
}

LOG_debug("presentSurface: calling makeCurrent");
GLVideo_makeCurrent();
LOG_debug("presentSurface: makeCurrent done");

// Bind backbuffer
LOG_debug("presentSurface: binding FBO 0");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
LOG_debug("presentSurface: FBO 0 bound");

// Get screen dimensions
int screen_w = 0;
int screen_h = 0;
SDL_GetWindowSize(window, &screen_w, &screen_h);
LOG_debug("presentSurface: screen %dx%d", screen_w, screen_h);
if (screen_w <= 0 || screen_h <= 0) {
LOG_error("GL video: invalid window size %dx%d", screen_w, screen_h);
return;
Expand All @@ -1917,8 +1907,6 @@ void GLVideo_presentSurface(SDL_Surface* surface) {

if (!gl_state.ui_texture || gl_state.ui_texture_width != surf_w ||
gl_state.ui_texture_height != surf_h) {
LOG_debug("presentSurface: creating UI texture %ux%u", surf_w, surf_h);

if (gl_state.ui_texture) {
glDeleteTextures(1, &gl_state.ui_texture);
}
Expand All @@ -1934,21 +1922,16 @@ void GLVideo_presentSurface(SDL_Surface* surface) {

gl_state.ui_texture_width = surf_w;
gl_state.ui_texture_height = surf_h;

LOG_debug("presentSurface: UI texture created (id=%u)", gl_state.ui_texture);
}

LOG_debug("presentSurface: uploading pixels");
glBindTexture(GL_TEXTURE_2D, gl_state.ui_texture);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, surf_w, surf_h, GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
surface->pixels);

LOG_debug("presentSurface: setting viewport and clearing");
glViewport(0, 0, screen_w, screen_h);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);

LOG_debug("presentSurface: using shader program");
glUseProgram(gl_state.present_program);

glActiveTexture(GL_TEXTURE0);
Expand All @@ -1973,13 +1956,10 @@ void GLVideo_presentSurface(SDL_Surface* surface) {
glVertexAttribPointer(gl_state.loc_position, 2, GL_FLOAT, GL_FALSE, 0, verts);
glVertexAttribPointer(gl_state.loc_texcoord, 2, GL_FLOAT, GL_FALSE, 0, texco);

LOG_debug("presentSurface: drawing quad");
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

glDisableVertexAttribArray(gl_state.loc_position);
glDisableVertexAttribArray(gl_state.loc_texcoord);

LOG_debug("presentSurface: done");
}

void GLVideo_swapBuffers(void) {
Expand Down
13 changes: 2 additions & 11 deletions workspace/all/paks/LessUI/platforms/magicmini/init.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
#!/bin/sh
# magicmini initialization

# CPU/GPU/DMC governors
# CPU/GPU/DMC governors (CPU speed controlled by frontend)
echo userspace >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance >/sys/devices/platform/ff400000.gpu/devfreq/ff400000.gpu/governor
echo performance >/sys/devices/platform/dmc/devfreq/dmc/governor

CPU_PATH=/sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed
CPU_SPEED_PERF=1608000

cpu_restore() {
echo $CPU_SPEED_PERF >$CPU_PATH
}
cpu_restore

# SDL audio
export SDL_AUDIODRIVER=alsa
# Audio setup
amixer cset name='Playback Path' SPK

# Clear framebuffer
Expand Down
12 changes: 1 addition & 11 deletions workspace/all/paks/LessUI/platforms/miyoomini/init.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
#!/bin/sh
# miyoomini initialization

# CPU governor
# CPU governor (speed controlled by frontend)
echo userspace >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# CPU speeds for player
export CPU_SPEED_MENU=504000
export CPU_SPEED_GAME=1296000
export CPU_SPEED_PERF=1488000

cpu_restore() {
overclock.elf $CPU_SPEED_PERF
}
cpu_restore

# Detect Mini Plus
if [ -f /customer/app/axp_test ]; then
IS_PLUS=true
Expand Down
7 changes: 2 additions & 5 deletions workspace/all/paks/LessUI/platforms/my282/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
# LED off
echo 0 >/sys/class/leds/led1/brightness

# CPU speed control via reclock
cpu_restore() {
overclock.elf userspace 2 1344 384 1080 0
}
cpu_restore
# CPU governor (speed controlled by frontend)
overclock.elf userspace 2 1344 384 1080 0

# Clean up tee and update log
killall -9 tee
Expand Down
9 changes: 1 addition & 8 deletions workspace/all/paks/LessUI/platforms/my355/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
export PATH="$PATH:/usr/miyoo/bin:/usr/miyoo/sbin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/miyoo/lib"

# CPU setup
# CPU governor (speed controlled by frontend)
echo userspace >/sys/devices/system/cpu/cpufreq/policy0/scaling_governor
CPU_PATH=/sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed
CPU_SPEED_PERF=1992000

cpu_restore() {
echo $CPU_SPEED_PERF >$CPU_PATH
}
cpu_restore

# Headphone jack GPIO
echo 150 >/sys/class/gpio/export
Expand Down
11 changes: 1 addition & 10 deletions workspace/all/paks/LessUI/platforms/rg35xx/init.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
#!/bin/sh
# rg35xx initialization

# CPU setup
# CPU governor (speed controlled by frontend)
echo userspace >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

export CPU_SPEED_MENU=504000
export CPU_SPEED_GAME=1296000
export CPU_SPEED_PERF=1488000

cpu_restore() {
overclock.elf $CPU_SPEED_PERF
}
cpu_restore

# Storage scheduler optimization
echo noop >/sys/devices/b0238000.mmc/mmc_host/mmc0/emmc_boot_card/block/mmcblk0/queue/scheduler
echo noop >/sys/devices/b0230000.mmc/mmc_host/mmc1/sd_card/block/mmcblk1/queue/scheduler
Expand Down
Loading