Camera Service Management Planning
Status: PLANNING COMPLETE - Ready for Implementation
Date: 2026-02-19
Overview
This document outlines the plan to:
- Disable rkipc autostart in firmware boot
- Start and manage rkaiq_3A_server via init.d script
Current State
Existing Camera-Related Code
- start-seedsigner.sh (line 16, 24):
- Already kills rkipc on startup:
killall rkipc 2>/dev/null - This is a reactive approach (kills after it starts)
- Already kills rkipc on startup:
- S99seedsigner init script:
- Runs late in boot sequence (S99)
- Calls start-seedsigner.sh
- File installation (os-build.sh line 608-611):
[[ -f "/build/files/S99seedsigner" ]] && cp -v "/build/files/S99seedsigner" "$ROOTFS_DIR/etc/init.d/" - RkLunch.sh location:
- Generated by LuckFox SDK
- Located at:
/oem/usr/bin/RkLunch.shin final image - Contains:
rkipc -a /oem/usr/share/iqfiles &line
Required Changes
1. Disable rkipc Autostart
Approach: Post-Build sed Modification (RECOMMENDED)
Why this approach:
- Simple and maintainable
- No SDK source modifications required
- Easy to verify
- Non-destructive (comments out, doesn’t delete)
Implementation:
Add to buildroot/os-build.sh after line 606:
# Disable rkipc autostart in RkLunch.sh (camera management conflict)
if [[ -f "$ROOTFS_DIR/oem/usr/bin/RkLunch.sh" ]]; then
print_info "Disabling rkipc autostart in RkLunch.sh"
sed -i 's/^\(.*rkipc -a.*\)$/#\1 # Disabled for SeedSigner camera management/' "$ROOTFS_DIR/oem/usr/bin/RkLunch.sh"
print_success "rkipc autostart disabled"
else
print_info "RkLunch.sh not found at expected location"
fi
Also update:
buildroot/build-local.shwith identical changes
Alternative approaches considered:
- SDK patch: Too complex, requires finding source
- File replacement: Requires maintaining full RkLunch.sh copy
- Deletion: Too aggressive, may break other functionality
2. Start rkaiq_3A_server
Approach: Create S50rkaiq init script
Why S50:
- Runs before most services (50 is early/mid boot)
- Runs before SeedSigner (S99)
- Provides camera ISP service for SeedSigner to use
Implementation:
Step 1: Create buildroot/files/S50rkaiq:
#!/bin/sh
#
# Start/stop rkaiq_3A_server for camera ISP management
#
# This service manages the camera Image Signal Processor (ISP)
# and should run before applications that use the camera.
#
case "$1" in
start)
echo "Starting rkaiq_3A_server..."
/usr/bin/rkaiq_3A_server &
;;
stop)
echo "Stopping rkaiq_3A_server..."
killall rkaiq_3A_server 2>/dev/null
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0
Step 2: Make executable in repository:
chmod +x buildroot/files/S50rkaiq
Step 3: Update buildroot/os-build.sh after line 611:
# Install rkaiq_3A_server init script
if [[ -f "/build/files/S50rkaiq" ]]; then
print_info "Installing rkaiq_3A_server init script"
cp -v "/build/files/S50rkaiq" "$ROOTFS_DIR/etc/init.d/"
chmod +x "$ROOTFS_DIR/etc/init.d/S50rkaiq"
print_success "rkaiq_3A_server init script installed"
fi
Step 4: Update buildroot/build-local.sh with identical changes
Boot Sequence
Before Changes:
- System init
- RkLunch.sh runs → starts rkipc
- S99seedsigner runs → kills rkipc, starts SeedSigner
- Camera ISP in unknown state
After Changes:
- System init
- S50rkaiq runs → starts rkaiq_3A_server (camera ISP ready)
- RkLunch.sh runs → rkipc line commented (no action)
- S99seedsigner runs → starts SeedSigner (camera ISP already available)
Files to Create
buildroot/files/S50rkaiq- New init script
Files to Modify
buildroot/os-build.sh:- Add RkLunch.sh modification (after line 606)
- Add S50rkaiq installation (after line 611)
buildroot/build-local.sh:- Same changes as os-build.sh
Verification Steps
Build-Time Verification:
- Check that
S50rkaiqis created in repository - Verify
S50rkaiqis executable - After build, verify:
RkLunch.shhas commented rkipc line/etc/init.d/S50rkaiqexists in rootfs/etc/init.d/S50rkaiqis executable
Runtime Verification:
- Boot device
- Check running processes:
ps aux | grep rkaiq # Should show rkaiq_3A_server running ps aux | grep rkipc # Should be empty (not running) - Test camera with SeedSigner
- Test service management:
/etc/init.d/S50rkaiq stop /etc/init.d/S50rkaiq start /etc/init.d/S50rkaiq restart
Dependencies Check
Required Binaries:
/usr/bin/rkaiq_3A_server- Must exist in SDK build- Location verified: SDK should provide this in buildroot
Required Libraries:
- rkaiq_3A_server may depend on ISP libraries
- Should be included in SDK by default
Risk Assessment
Low Risk:
- ✅ Init script creation (standard pattern)
- ✅ sed modification (non-destructive)
- ✅ File copying (standard build process)
Medium Risk:
- ⚠️ RkLunch.sh path may vary between SDK versions
- ⚠️ rkaiq_3A_server binary location may vary
- ⚠️ Need to verify camera still works after changes
Mitigation:
- Add path verification before sed
- Add binary existence check before starting service
- Test on actual hardware before release
Benefits
- Proper service lifecycle - Start/stop/restart capability
- Clean boot sequence - Services start in correct order
- No process conflicts - rkipc prevented from starting
- Maintainable - Standard init.d pattern
- Persistent - Works across reboots
Testing Plan
Phase 1: Build Testing
- Create S50rkaiq file
- Build completes successfully
- Verify files in output image
Phase 2: Boot Testing
- Flash image to device
- Device boots successfully
- rkaiq_3A_server is running
- rkipc is NOT running
Phase 3: Functional Testing
- Camera works in SeedSigner
- QR code scanning works
- Service stop/start/restart works
- No errors in system logs
Phase 4: Edge Case Testing
- Reboot device - services start correctly
- Kill rkaiq manually - init script can restart
- Multiple rapid restarts work correctly
Implementation Checklist
When ready to implement:
- Create
buildroot/files/S50rkaiqwith init script content - Make S50rkaiq executable:
chmod +x buildroot/files/S50rkaiq - Add RkLunch.sh modification to
buildroot/os-build.sh - Add S50rkaiq installation to
buildroot/os-build.sh - Add same changes to
buildroot/build-local.sh - Commit changes with appropriate message
- Build and test on Mini hardware
- Build and test on Max hardware
- Document results
References
- LuckFox forum recommendation: Comment out rkipc in RkLunch.sh
- Original issue: Camera service management
- Related file:
docs/CAMERA_DEBUG.md - Init script pattern: Standard SysVinit
Status
✅ PLANNING COMPLETE
⏳ READY FOR IMPLEMENTATION
Planning completed: 2026-02-19
Document author: AI Agent (Copilot)