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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
46 changes: 37 additions & 9 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,21 @@ Active platforms (as of most recent): miyoomini, trimuismart, rg35xx, rg35xxplus

### Pak Systems

LessUI uses **three systems** for platform-specific `.pak` directories:
LessUI uses **four systems** for platform-specific `.pak` directories:

**1. Tool Paks** (`workspace/all/paks/`) - Self-contained cross-platform tools:
```
workspace/all/paks/
├── Tools/ # Tool paks (Clock, Input, Wifi, etc.)
├── Emus/ # Emulator paks (template-based)
├── MinUI/ # System pak (template-based)
└── makefile # Build orchestration
```

**1. Tool Paks** (`workspace/all/paks/Tools/`) - Self-contained cross-platform tools:
- Each pak has its own directory with `pak.json`, `launch.sh`, and optional `src/`
- Native code in `src/` is cross-compiled per platform
- Constructed during `make system` (not `make setup`)
- **Completed migrations**: `Clock/`, `Input/`, `Bootlogo/`, `Files/`
- Examples: `Clock/`, `Input/`, `Bootlogo/`, `Files/`, `Wifi/`
- Platform-specific resources supported via `<platform>/` directories
- Hybrid pattern supported (native for some platforms, shell-only for others)

Expand All @@ -125,26 +133,44 @@ LessUI uses **three systems** for platform-specific `.pak` directories:
- `configs/` - Config templates for all supported cores
- `cores-override/` - Local core zips for development

**3. Direct Paks** (`skeleton/TEMPLATES/paks/`) - Copied as-is for special cases:
**3. MinUI System Pak** (`workspace/all/paks/MinUI/`) - Template-based launcher init:
- `platforms/<platform>/` - Each platform has its own directory with all files:
- `config.sh` - Platform configuration (SDCARD_PATH, CPU speeds, features)
- `pre-init.sh` - LCD/backlight initialization (optional)
- `post-env.sh` - Model detection, audio, GPIO setup (optional)
- `daemons.sh` - Start keymon and platform daemons (optional)
- `poweroff-handler.sh` - Physical power switch handling (optional)
- `loop-hook.sh` - Per-iteration hooks like HDMI export (optional)
- Generated by `scripts/generate-minui-pak.sh` during `make setup`
- Output: `build/SYSTEM/<platform>/paks/MinUI.pak/launch.sh`

**4. Direct Paks** (`skeleton/TEMPLATES/paks/`) - Copied as-is for special cases:
- PAK.pak - Native application launcher (copied to all platforms)

**Generation:**
```bash
# Emulator paks generated during setup
make setup # Generates minarch paks and direct paks
# All paks generated during setup
make setup # Generates MinUI paks, emulator paks, and direct paks

# Tool paks constructed during system phase
make build PLATFORM=miyoomini # Compiles tool pak binaries
make system PLATFORM=miyoomini # Constructs complete tool paks
```

**Adding a new tool pak:**
1. Create directory `workspace/all/paks/<Name>/`
1. Create directory `workspace/all/paks/Tools/<Name>/`
2. Create `pak.json` with name, platforms, build type
3. Create `launch.sh` (cross-platform entry point)
4. For native code: create `src/` with source and makefile
5. Test: `make build PLATFORM=miyoomini && make system PLATFORM=miyoomini`

**Adding a new platform to MinUI:**
1. Create `workspace/all/paks/MinUI/platforms/<platform>/` directory
2. Create `config.sh` with platform variables (SDCARD_PATH, CPU config, features)
3. Create optional hook scripts (`pre-init.sh`, `post-env.sh`, `daemons.sh`, etc.)
4. Run `./scripts/generate-minui-pak.sh <platform>` to test
5. Add platform to `pak.json` platforms array

**Adding a new emulator core:**
1. Build core in external [minarch-cores repository](https://github.com/nchapman/minarch-cores)
2. Add to `workspace/all/paks/Emus/cores.json`
Expand Down Expand Up @@ -376,9 +402,11 @@ See `.clang-format` for complete style definition.
| Platform API | `workspace/all/common/api.c` |
| Platform definitions | `workspace/<platform>/platform/platform.h` |
| Common definitions | `workspace/all/common/defines.h` |
| Tool paks | `workspace/all/paks/` |
| Tool paks | `workspace/all/paks/Tools/` |
| Emulator pak templates | `workspace/all/paks/Emus/` |
| Pak generation script | `scripts/generate-paks.sh` |
| MinUI pak templates | `workspace/all/paks/MinUI/` |
| Emulator pak generation | `scripts/generate-paks.sh` |
| MinUI pak generation | `scripts/generate-minui-pak.sh` |
| Test suite | `tests/unit/all/common/test_utils.c` |
| Build orchestration | `Makefile` (host-side) |
| QA tools | `makefile.qa` |
Expand Down
20 changes: 10 additions & 10 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,18 @@ build:

# Copy platform binaries to build directory
system:
make -f ./workspace/$(PLATFORM)/platform/makefile.copy PLATFORM=$(PLATFORM)

# populate system
cp ./workspace/$(PLATFORM)/keymon/keymon.elf ./build/SYSTEM/$(PLATFORM)/bin/
# populate system (binaries that makefile.copy may reference)
# keymon.elf and show.elf are now installed by utils install hook (unified implementation)
cp ./workspace/$(PLATFORM)/libmsettings/libmsettings.so ./build/SYSTEM/$(PLATFORM)/lib
cp ./workspace/all/minui/build/$(PLATFORM)/minui.elf ./build/SYSTEM/$(PLATFORM)/bin/
cp ./workspace/all/minarch/build/$(PLATFORM)/minarch.elf ./build/SYSTEM/$(PLATFORM)/bin/
cp ./workspace/all/syncsettings/build/$(PLATFORM)/syncsettings.elf ./build/SYSTEM/$(PLATFORM)/bin/
# Install utils (calls install hook for each util)
# Install utils (calls install hook for each util - includes keymon.elf and show.elf)
@$(MAKE) -C ./workspace/all/utils install PLATFORM=$(PLATFORM) DESTDIR=$(CURDIR)/build/SYSTEM/$(PLATFORM)/bin
# Construct tool paks from workspace/all/paks/
@for pak_dir in ./workspace/all/paks/*/; do \
# Now run platform-specific copy (may reference utils like show.elf for BOOT)
make -f ./workspace/$(PLATFORM)/platform/makefile.copy PLATFORM=$(PLATFORM)
# Construct tool paks from workspace/all/paks/Tools/
@for pak_dir in ./workspace/all/paks/Tools/*/; do \
[ -d "$$pak_dir" ] || continue; \
pak_name=$$(basename "$$pak_dir"); \
[ -f "$$pak_dir/pak.json" ] || continue; \
Expand Down Expand Up @@ -215,7 +215,7 @@ clean:
# Clean workspace/all component build directories
rm -rf workspace/all/minui/build
rm -rf workspace/all/minarch/build
rm -rf workspace/all/paks/*/build
rm -rf workspace/all/paks/Tools/*/build
rm -rf workspace/all/utils/*/build
rm -rf workspace/all/syncsettings/build
# Clean platform-specific boot outputs
Expand Down Expand Up @@ -274,8 +274,8 @@ setup: name
@$(MAKE) -C ./workspace/all/utils setup DESTDIR=$(CURDIR)/build/SYSTEM/common/bin
@$(MAKE) -C ./workspace/all/paks setup DESTDIR=$(CURDIR)/build/SYSTEM/common/bin

# Generate platform-specific paks from templates
@echo "Generating paks from templates..."
# Generate emulator paks from templates
@echo "Generating emulator paks..."
@./scripts/generate-paks.sh all

# Platform-specific packaging for Miyoo/Trimui family
Expand Down
2 changes: 1 addition & 1 deletion makefile.qa
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ FORMAT_PATHS = workspace/all/minui/*.c \
workspace/all/minarch/*.c \
workspace/all/common/*.c \
workspace/all/common/*.h \
workspace/all/paks/*/src/*.c \
workspace/all/paks/Tools/*/src/*.c \
workspace/all/syncsettings/*.c \
workspace/*/platform/platform.c \
workspace/*/platform/platform.h \
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate-paks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ if ! command -v jq &> /dev/null; then
exit 1
fi

# Load platform metadata
PLATFORMS_JSON="$TEMPLATE_DIR/platforms.json"
# Load platform metadata from shared config
PLATFORMS_JSON="$PROJECT_ROOT/workspace/all/paks/config/platforms.json"
CORES_JSON="$TEMPLATE_DIR/cores.json"

if [ ! -f "$PLATFORMS_JSON" ]; then
Expand Down
94 changes: 0 additions & 94 deletions skeleton/SYSTEM/m17/paks/MinUI.pak/launch.sh

This file was deleted.

79 changes: 0 additions & 79 deletions skeleton/SYSTEM/magicmini/paks/MinUI.pak/launch.sh

This file was deleted.

Loading