Rockbox for the HiBy R3 Pro II/R1

Original author Melissa Autumn (https://codeberg.org/oopsallnaps/rockbox-hibyos) with contributions from Marc Aarts.

Adaptation to Rockbox standards by Marc Aarts

Change-Id: I09e5af7ba0a75c648e4b9fd424badc2d3665c943
This commit is contained in:
Marc Aarts 2025-12-22 08:11:25 +01:00 committed by Solomon Peachy
parent eee6c31b4a
commit 1183b1ab1b
118 changed files with 2858 additions and 107 deletions

View file

@ -660,7 +660,9 @@ sub buildzip {
# until buildwps.pl is fixed, manually copy the classic_statusbar theme across
mkdir "$temp_dir/wps/classic_statusbar", 0777;
glob_copy("$ROOT/wps/classic_statusbar/*.bmp", "$temp_dir/wps/classic_statusbar");
if ($depth == 16) {
if ($depth >= 16 && $height > 480) {
copy("$ROOT/wps/classic_statusbar.24.sbs", "$temp_dir/wps/classic_statusbar.sbs");
} elsif ($depth == 16) {
copy("$ROOT/wps/classic_statusbar.sbs", "$temp_dir/wps");
} elsif ($depth > 1) {
copy("$ROOT/wps/classic_statusbar.grey.sbs", "$temp_dir/wps/classic_statusbar.sbs");

61
tools/configure vendored
View file

@ -1736,11 +1736,15 @@ cat <<EOF
244) M3K Linux 249) Eros Q / K native
246) M3K baremetal ==xDuoo== (hw4 bl only)
241) X3
==Shanling== 242) X3II ==Nintendo==
260) Q1 243) X20 290) Nintendo 3DS (WIP)
==Shanling== 242) X3II ==HiBy==
260) Q1 243) X20 300) R3 Pro II
301) R1
==Echo project== ==Surfans==
270) Echo R1 (WIP) 280) F28 (WIP)
==Nintendo==
290) Nintendo 3DS (WIP)
EOF
buildfor=`input`;
@ -4389,6 +4393,57 @@ fi
t_model="app"
;;
300|hibyr3proii)
target_id=123
application=yes
app_type="hibyos"
modelname="hibyr3proii"
target="HIBY_R3PROII"
memory=16 # The device has 64mb but let's make sure it still boots with things in the background
mipsellinuxcc
tool="cp "
boottool="cp "
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
output="rockbox.r3proii"
bootoutput="bootloader.r3proii"
appextra="recorder:gui:hosted"
plugins="yes"
# architecture, manufacturer and model for the target-tree build
# These align with
t_cpu="hosted"
t_manufacturer="hiby"
t_model="r3proii"
sysfontbl="24-Terminus"
sysfont="20-Terminus"
;;
301|hibyr1)
target_id=124
application=yes
app_type="hibyos"
modelname="hibyr1"
target="HIBY_R1"
memory=16 # The device has 64mb but let's make sure it still boots with things in the background
mipsellinuxcc
tool="cp "
boottool="cp "
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
output="rockbox.r1"
bootoutput="bootloader.r1"
appextra="recorder:gui:hosted"
plugins="yes"
# architecture, manufacturer and model for the target-tree build
# These align with
t_cpu="hosted"
t_manufacturer="hiby"
t_model="r1"
sysfontbl="24-Terminus"
sysfont="20-Terminus"
;;
*)
echo "Please select a supported target platform!"
exit 7

10
tools/r1_patcher/hiby_player.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
killall hiby_player &>/dev/null
killall -9 hiby_player &>/dev/null
killall bootloader.r1 &>/dev/null
killall -9 bootloader.r1 &>/dev/null
/usr/bin/bootloader.r1
sleep 1s

133
tools/r1_patcher/r1_patcher.sh Executable file
View file

@ -0,0 +1,133 @@
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo 'usage: ./r1_patcher.sh r1.upt bootloader.r1' >&2
exit 1
fi
################################################################################
### init
################################################################################
currentdir=$(pwd)
updatefile="$(basename $1)"
updatefile_rb="${updatefile%.*}_rb.upt"
workingdir=$(realpath ./working_dir)
workingdir_in=$workingdir"/in"
workingdir_out=$workingdir"/out"
rm -rf $workingdir
mkdir $workingdir
mkdir $workingdir_in
mkdir $workingdir_out
################################################################################
### extract
################################################################################
# extract iso
mkdir -p $workingdir_in/image_contents
7z -o$workingdir_in/image_contents x $updatefile
# create xImage (unchanged)
mkdir -p $workingdir_out/xImage
cat $workingdir_in/image_contents/ota_v0/xImage.* > $workingdir_out/xImage/xImage
# create rootfs
mkdir -p $workingdir_in/rootfs
mkdir -p $workingdir_in/rootfs/extracted
cat $workingdir_in/image_contents/ota_v0/rootfs.squashfs.* > $workingdir_in/rootfs/rootfs.squashfs
# extract rootfs
unsquashfs -f -d $workingdir_in/rootfs/extracted $workingdir_in/rootfs/rootfs.squashfs
################################################################################
### update
################################################################################
# copy 'bootloader'
cp $2 $workingdir_in/rootfs/extracted/usr/bin/
# copy modified 'hibyplayer.sh' script
cp hiby_player.sh $workingdir_in/rootfs/extracted/usr/bin/
chmod 0755 $workingdir_in/rootfs/extracted/usr/bin/hiby_player.sh
################################################################################
### rebuild
################################################################################
mkdir "$workingdir_out/image_contents"
mkdir "$workingdir_out/image_contents/ota_v0"
mksquashfs $workingdir_in/rootfs/extracted $workingdir_out/rootfs.squashfs -comp lzo
cd "$workingdir_out/image_contents/ota_v0"
# rootfs.squashfs
split -b 512k $workingdir_out/rootfs.squashfs --numeric-suffixes=0 -a 4 rootfs.squashfs.
rootfs_md5=($(md5sum $workingdir_out/rootfs.squashfs))
rootfs_size=$(stat -c%s "$workingdir_out/rootfs.squashfs")
md5=$rootfs_md5
ota_md5_rootfs="ota_md5_rootfs.squashfs.$md5"
parts=`find . -name 'rootfs.squashfs.*'`
for part in $parts; do
md5next=($(md5sum $part))
echo $md5next >> $ota_md5_rootfs
mv $part "$part.$md5"
md5=$md5next
done
# xImage
split -b 512k $workingdir_out/xImage/xImage --numeric-suffixes=0 -a 4 xImage.
ximage_md5=($(md5sum $workingdir_out/xImage/xImage))
ximage_size=$(stat -c%s "$workingdir_out/xImage/xImage")
md5=$ximage_md5
ota_md5_xImage="ota_md5_xImage.$md5"
parts=`find . -name 'xImage.*'`
for part in $parts; do
md5next=($(md5sum $part))
echo $md5next >> $ota_md5_xImage
mv $part "$part.$md5"
md5=$md5next
done
# ota_update.in
echo "ota_version=0
img_type=kernel
img_name=xImage
img_size=$ximage_size
img_md5=$ximage_md5
img_type=rootfs
img_name=rootfs.squashfs
img_size=$rootfs_size
img_md5=$rootfs_md5
" > ota_update.in
echo > ota_v0.ok
# ota_config.in
cd "$workingdir_out/image_contents"
echo "current_version=0" > ota_config.in
# iso
genisoimage -f -U -J -joliet-long -r -allow-lowercase -allow-multidot -o $currentdir/$updatefile_rb $workingdir_out/image_contents/
################################################################################
### cleanup
################################################################################
rm -rf $workingdir
exit 0

View file

@ -105,6 +105,8 @@ endif
ifneq (,$(findstring bootloader,$(APPSDIR)))
ifneq (,$(findstring sonynwz,$(APP_TYPE)))
include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make
else ifneq (,$(findstring hiby_x1600,$(APP_TYPE)))
include $(ROOTDIR)/firmware/target/hosted/hiby/hiby.make
else ifneq (,$(findstring hibyos,$(APP_TYPE)))
include $(ROOTDIR)/firmware/target/hosted/hibyos.make
else ifneq (,$(findstring fiio,$(APP_TYPE)))
@ -149,6 +151,10 @@ else # core
include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make
endif
ifneq (,$(findstring hiby_x1600,$(APP_TYPE)))
include $(ROOTDIR)/firmware/target/hosted/hiby/hiby.make
endif
ifneq (,$(findstring hibyos,$(APP_TYPE)))
include $(ROOTDIR)/firmware/target/hosted/hibyos.make
endif