1
0
Fork 0
forked from len0rd/rockbox

Samsung YP-R0/YP-R1 Safe Mode improvement

This is an improvement for the special
mode present in the samsung ypr0 target.
Apart adding new useful functionalities, it
fixes a random disconnection bug, solved by debouncing
and fully support to YP-R1 target.
This opens also the possibility to interface
this operating mode to rockbox USB functionality.

Change-Id: Id70541541fcfaa1234328485fab0696a3bd491c9
This commit is contained in:
Lorenzo Miori 2013-07-23 16:24:19 +02:00 committed by Thomas Martitz
parent 5ef1e2dcfa
commit 66aa00d3e0
15 changed files with 412 additions and 146 deletions

View file

@ -11,19 +11,21 @@
#
# * Script to patch an unpacked Samsung YP-R0 firmware file */
# Copyright (C) 2011 Thomas Martitz
# Copyright (C) 2013 Lorenzo Miori
######################################################################
# bail out early
set -e
if [ $# -lt 1 ] || [ $# -gt 2 ]; then
echo "Usage: $0 <files path> [path to unpacked rom]"
echo "\t<files path> is expected to have a rootfs layout and to contain"
echo "\tonly the files to overwrite (plain cp -r is used)"
echo "\t<files path> is expected to have a special resources and rootfs layout"
exit 1
fi
MODEL="unknown"
FILES=${1%/}
FILES=${FILES:-"/"}
COMMON_FILES="$FILES/common"
DIR=${2:-"."}
DIR=${DIR%/}
ROOTFS=$DIR/rootfs
@ -31,6 +33,35 @@ CRAMFS=$DIR/cramfs-fsl.rom
# sanity checks
for subdir in common r0 r1
do
if [ ! -d "$FILES/$subdir" ]
then
echo "Missing $FILES/$subdir. Invalid $FILES layout."
exit 1
fi
done
if [ ! -e "$FILES/r1/etc/safemode/cable_detect" ]
then
echo "Couldn't find cable_detect binary (try 'make' or select a valid layout directory)"
exit 1
fi
for image in pre_smode.raw post_smode.raw safemode.raw
do
if [ ! -e "$FILES/r1/etc/safemode/$image" ]
then
echo "Missing r1 .raw image file (try 'make'): $image"
exit 1
fi
if [ ! -e "$FILES/r0/etc/safemode/$image" ]
then
echo "Missing r0 .raw image file (try 'make'): $image"
exit 1
fi
done
# this needs to be run as root!
if [ $(whoami) != "root" ]
then
@ -55,13 +86,33 @@ fi
echo "Extracting cramfs image"
[ ! -e $ROOTFS ] || rmdir -p $ROOTFS
[ ! -e $ROOTFS ] || rm -R $ROOTFS
cramfs-1.1/cramfsck -x $ROOTFS $CRAMFS
echo "Patching rootfs"
echo "cp -r $FILES/* $ROOTFS/"
cp -r $FILES/.rockbox $ROOTFS/
cp -r $FILES/* $ROOTFS/
# now we can detect player version
# NOTE: order is important here, since ironically
# r1's ROM contains also r0's executables
if [ -e "$ROOTFS/usr/local/bin/r1" ]
then
MODEL="r1"
else
if [ -e "$ROOTFS/usr/local/bin/r0" ]
then
MODEL="r0"
fi
fi
echo "$MODEL ROM found."
echo "Patching rootfs (common files)"
echo "cp -r $COMMON_FILES/* $ROOTFS/"
cp -r $COMMON_FILES/.rockbox $ROOTFS/
cp -r $COMMON_FILES/* $ROOTFS/
echo "Patching rootfs ($MODEL files)"
MODEL_FILES="$FILES/$MODEL"
echo "cp -r $MODEL_FILES/* $ROOTFS/"
cp -r $MODEL_FILES/* $ROOTFS/
echo "Packing new cramfs image"
cramfs-1.1/mkcramfs $ROOTFS $CRAMFS