Skip to content

Instantly share code, notes, and snippets.

@shauninman
Created May 16, 2026 15:10
Show Gist options
  • Select an option

  • Save shauninman/8398c1577cb362b3119e8c6a722a1bf2 to your computer and use it in GitHub Desktop.

Select an option

Save shauninman/8398c1577cb362b3119e8c6a722a1bf2 to your computer and use it in GitHub Desktop.
Replacing boot logos on Anbernic RG DS stock Linux
on device
dd if=/dev/block/by-name/boot of=/tmp/boot.img
then download boot.img locally and run
dtc -I dtb -O dts boot.img > boot.dts
prep
mkdir bootwork
cd bootwork
cp ../boot.img .
confirm partition numbers
dumpimage -l boot.img
but should be
dumpimage -T flat_dt -p 2 -o resource.img boot.img
if necessary
apt update
apt install golang
git clone https://github.com/Evsio0n/rsce-go
cd rsce-go
go mod download
go mod tidy
go build -o rsce_tool
cp rsce_tool /usr/local/bin/
extract
mkdir resource
cd resource
rsce_tool -u ../resource.img
modify bitmaps
logo.bmp - top screen
logo_kernel.bmp - bottom
repack modified bitmaps into resource-mod.img
rsce_tool \
-p rk-kernel.dtb \
-p battery_1.bmp \
-p battery_2.bmp \
-p battery_3.bmp \
-p battery_4.bmp \
-p battery_5.bmp \
-p battery_fail.bmp \
-p logo.bmp \
-p logo_kernel.bmp \
-p battery_0.bmp
mv boot-second ../resource-mod.img
cd ../
pad to original size
ORIGINAL_SIZE=$(wc -c < resource.img)
cp resource-mod.img resource-pad.img
truncate -s $ORIGINAL_SIZE resource-pad.img
patch original boot.img (note that the seek offset comes from data-position in boot.dts)
cp boot.img boot-mod.img
dd if=resource-pad.img of=boot-mod.img bs=512 seek=$((0x2580800 / 512)) conv=notrunc
then update the hash
OLD_HASH=$(sha256sum resource.img | cut -d' ' -f1)
NEW_HASH=$(sha256sum resource-pad.img | cut -d' ' -f1)
OFFSET=$(xxd -p boot-mod.img | tr -d '\n' | grep -abo "$OLD_HASH" | cut -d: -f1)
printf '%s' "$NEW_HASH" | xxd -r -p | dd of=boot-mod.img bs=1 seek=$((OFFSET / 2)) conv=notrunc
--
write back
dd if=/tmp/boot-mod.img of=/dev/block/by-name/boot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment