New port: Anbernic RG Nano

A bit of context, this device is a clone of the FunKey-S with a different form factor, hardware is mostly identical, the relevant difference is it has audio out (via usb-c, adapter to 3.5mm is included), this is the reason why the FunKey-SDK is needed for bulding.

This port is based on the old SDL 1.2 code because the device doesn't have SDL2 support. Alongside what was supported in the SDL 1.2 builds this port supports battery level, charging status and backlight control.

Change-Id: I7fcb85be62748644b667c0efebabf59d6e9c5ade
This commit is contained in:
Hairo R. Carela 2025-07-14 23:04:37 -04:00 committed by Solomon Peachy
parent 9d3e286454
commit 48392bab94
94 changed files with 1517 additions and 29 deletions

View file

@ -0,0 +1,7 @@
# .cfg file created by rockbox c145f41658-250621 - http://www.rockbox.org
idle poweroff: 0
font: /FunKey/rockbox/fonts/16-WenQangYi-Unibit.fnt
database scan paths: /Music
qs top: brightness
qs bottom: brightness

BIN
packaging/rgnano/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,5 @@
UNMAP FN+Y
UNMAP FN+A
UNMAP FN+B
UNMAP FN+X
MAP START+FN TO KEY KEY_H

View file

@ -0,0 +1,40 @@
RG_NANO_DIR=$(ROOTDIR)/packaging/rgnano
MKSQUASHFS=$(dir $(CPP))mksquashfs
INSTALL_DIR=$(OPK_BUILD_DIR)/install
OPK_BUILD_DIR=opkdir
opkdir:
mkdir $(OPK_BUILD_DIR)
opkclean:
rm -rf $(OPK_BUILD_DIR)
opk: opkclean opkdir $(MKSQUASHFS) build
make PREFIX=$(OPK_BUILD_DIR)/rockbox fullinstall
# Install opk files
cp $(RG_NANO_DIR)/icon.png $(OPK_BUILD_DIR)
cp $(RG_NANO_DIR)/mapping.key $(OPK_BUILD_DIR)
cp $(RG_NANO_DIR)/rockbox.funkey-s.desktop $(OPK_BUILD_DIR)
cp $(RG_NANO_DIR)/config.cfg $(OPK_BUILD_DIR)
cp $(RG_NANO_DIR)/run.sh $(OPK_BUILD_DIR)
# Organize files
mkdir $(INSTALL_DIR)
mv $(OPK_BUILD_DIR)/rockbox/bin/rockbox $(INSTALL_DIR)
mv $(OPK_BUILD_DIR)/rockbox/lib/rockbox/* $(INSTALL_DIR)
mv $(OPK_BUILD_DIR)/rockbox/share/rockbox/* $(INSTALL_DIR)
rm -rf $(OPK_BUILD_DIR)/rockbox
mv $(INSTALL_DIR)/rockbox $(OPK_BUILD_DIR)
# Plugin workarounds
mkdir $(INSTALL_DIR)/rocks.data
mv $(INSTALL_DIR)/rocks/games/.picross $(INSTALL_DIR)/rocks.data/.picross
# Permissions
chmod +x $(OPK_BUILD_DIR)/rockbox
chmod +x $(OPK_BUILD_DIR)/run.sh
# Make opk
$(MKSQUASHFS) $(OPK_BUILD_DIR) rockbox_funkey-s.opk -all-root -noappend -no-exports -no-xattrs

View file

@ -0,0 +1,9 @@
[Desktop Entry]
Name=Rockbox
Comment=Open source jukebox firmware
Terminal=false
Type=Application
Exec=run.sh
Icon=icon
Categories=applications
FK-Keymap=mapping.key

38
packaging/rgnano/run.sh Executable file
View file

@ -0,0 +1,38 @@
#!/bin/sh
RBDIR=/mnt/FunKey/rockbox
CFGFILE=$RBDIR/config.cfg
BLPATH=/sys/class/backlight/backlight/brightness
# Install the rockbox folder
if [ ! -d $RBDIR ]; then
notif set 0 " Installing rockbox..."
mkdir -p $RBDIR
cp -r ./install/* $RBDIR
notif clear
else
OPKV=$(cat ./install/rockbox-info.txt | grep Version: | cut -d'-' -f2)
SDV=$(cat $RBDIR/rockbox-info.txt | grep Version: | cut -d'-' -f2)
if [[ $OPKV -gt $SDV ]]; then
notif set 0 " Updating rockbox..."
cp -r -f -u ./install/* $RBDIR
notif clear
fi
fi
# Copy default config
if [ ! -f $CFGFILE ]; then
mkdir -p $(dirname $CFGFILE)
cp ./config.cfg $CFGFILE
fi
# Get current volume/brightness -> launch rockbox -> restore previous values
CUR_VOL=$(volume get)
CUR_BL=$(cat $BLPATH)
volume set 100
./rockbox
volume set $CUR_VOL
echo $CUR_BL > $BLPATH