mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
update the hibi patcher script to handle initial m3k stuff
Change-Id: I63ed8443952888da3dafb23ff6e7daf9c7aca574
This commit is contained in:
parent
0cde20fadb
commit
82787709bd
2 changed files with 166 additions and 112 deletions
|
|
@ -69,10 +69,11 @@ void audiohw_preinit(void)
|
|||
{
|
||||
alsa_controls_init();
|
||||
hw_open();
|
||||
// set 19/'ADC Mux' 0
|
||||
// set 4/'Digital Capture Volume' 0
|
||||
// set 6/'Mic Volume' 0
|
||||
// set 11/'DACR Playback Volume' 0 (wtf?? vortex used 1, of used 0)
|
||||
// NOTE:
|
||||
// Of the exported controls, only these do anything:
|
||||
// 10 DACL Playback Volume
|
||||
// 11 DACR Playback Volume
|
||||
// 12 Low Mode Switch (see table 25 in datasheet, not simple..)
|
||||
}
|
||||
|
||||
void audiohw_postinit(void)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#
|
||||
# Hiby patcher Copyright (C) 2020 Solomon Peachy <pizza@shaftnet.org>
|
||||
#
|
||||
# Licensed under the GNU GPLv2 (or newer)
|
||||
# Licensed under the GNU GPLv2 (or later)
|
||||
#
|
||||
##################
|
||||
|
||||
|
|
@ -29,6 +29,8 @@ my $rbbname = $ARGV[2];
|
|||
my $prefix = "/tmp"; # XXX mktmp
|
||||
my $debug = 0; # Set to 1 to prevent cleaning up work dirs
|
||||
|
||||
my $hiby = 1; # 1 for hibyplayer-style updates, 0 for ingenic updates
|
||||
|
||||
#### Let's get to work
|
||||
|
||||
my @ubiopts;
|
||||
|
|
@ -42,6 +44,7 @@ if ($model eq 'rocker') {
|
|||
@ubiopts = ("-e", "124KiB", "-c", "1024", "-m", "2048", "-j", "8192KiB", "-U");
|
||||
} elsif ($model eq 'm3k') {
|
||||
@ubiopts = ("-e", "124KiB", "-c", "2048", "-m", "2048", "-j", "8192KiB", "-U");
|
||||
$hiby = 0;
|
||||
} else {
|
||||
die ("Unknown hiby model: $model\n");
|
||||
}
|
||||
|
|
@ -52,25 +55,24 @@ my $isowork = "$prefix/iso.$uptname";
|
|||
my $rootfsdir = "$prefix/rootfs.$uptname";
|
||||
my $ubiname;
|
||||
my $ubinamenew;
|
||||
|
||||
my $updatename;
|
||||
my $versionname;
|
||||
|
||||
my @sysargs;
|
||||
|
||||
|
||||
### Extract outer ISO9660 image
|
||||
#### Extract OF image wrapper
|
||||
if ($hiby) {
|
||||
system("rm -Rf $isowork");
|
||||
mkdir($isowork) || die ("Can't create '$isowork'");
|
||||
@sysargs = ("7z", "x", "-aoa", "-o$isowork", $inname);
|
||||
system(@sysargs);
|
||||
|
||||
### figure out the rootfs image filenames
|
||||
my $updatename;
|
||||
if ( -e "$isowork/UPDATE.TXT") {
|
||||
$updatename = "$isowork/UPDATE.TXT";
|
||||
} elsif ( -e "$isowork/update.txt") {
|
||||
$updatename = "$isowork/update.txt";
|
||||
}
|
||||
my $versionname;
|
||||
if ( -e "$isowork/VERSION.TXT") {
|
||||
$versionname = "$isowork/VERSION.TXT";
|
||||
} elsif ( -e "$isowork/version.txt") {
|
||||
|
|
@ -101,19 +103,39 @@ if (! -e "$isowork/$ubiname") {
|
|||
}
|
||||
|
||||
$ubiname = "$isowork/$ubiname";
|
||||
} else {
|
||||
# Deconstruct original file
|
||||
# TODO. Rough sequence:
|
||||
|
||||
### Extract RootFS
|
||||
# unzip m3k.fw
|
||||
# for x in recovery-update/nand/update*zip ; do unzip -o $x ; done
|
||||
# rm -Rf *zip META-INF
|
||||
# parse update000/update.xml:
|
||||
# <name>system.ubi</name>
|
||||
# <type>ubifs</type>
|
||||
# <size>###</size> ## total size, bytes
|
||||
# <chunksize>##</chunksize> ## max for each one I guess [optional, 0 def]
|
||||
# <chunkcount>##</chunkcount> ## add up [optional, 1 def]
|
||||
#
|
||||
# * Track name, start block
|
||||
# * when we find the first ubifs block, record name, start block #, end block #
|
||||
#
|
||||
# alternatively, cat update*/$name* > combined.ubi
|
||||
|
||||
$ubiname = "$uptname";
|
||||
}
|
||||
|
||||
#### Extract RootFS
|
||||
system("rm -Rf $rootfsdir");
|
||||
mkdir($rootfsdir) || die ("Can't create '$rootfsdir'");
|
||||
|
||||
@sysargs = ("ubireader_extract_files", "-k", "-o", $rootfsdir, $ubiname);
|
||||
system(@sysargs);
|
||||
|
||||
# exit(0);
|
||||
### Mangle RootFS
|
||||
|
||||
# Generate rb_bootloader.sh
|
||||
my $rbbasename = basename($rbbname);
|
||||
|
||||
#### Mangle RootFS
|
||||
if ($hiby) {
|
||||
my $bootloader_sh =
|
||||
"#!/bin/sh
|
||||
|
||||
|
|
@ -188,6 +210,32 @@ chmod 0755, "$rootfsdir/etc/rb_removing.sh";
|
|||
|
||||
# Deal with a nasty race condition in automount scripts
|
||||
system("perl -pni -e 's/rm -rf/#rm -Rf/;' $rootfsdir/etc/init.d/S50sys_server");
|
||||
} else {
|
||||
my $bootloader_sh =
|
||||
"#!/bin/sh
|
||||
|
||||
killall $rbbasename &>/dev/null
|
||||
killall -9 $rbbasename &>/dev/null
|
||||
|
||||
source /etc/profile
|
||||
|
||||
# Try to save the flash
|
||||
if ! [ -L /data/userfs/app.log ] ; then
|
||||
rm -f /data/userfs/app.log
|
||||
ln -s /dev/null /data/userfs/app.log
|
||||
fi
|
||||
|
||||
# Rockbox launcher!
|
||||
/usr/bin/$rbbasename
|
||||
sleep 1
|
||||
reboot
|
||||
";
|
||||
open FILE, ">$rootfsdir/usr/project/bin/play.sh" || die ("can't write bootloader script!");
|
||||
print FILE $bootloader_sh;
|
||||
close FILE;
|
||||
chmod 0755, "$rootfsdir/usr/project/bin/play.sh";
|
||||
|
||||
}
|
||||
|
||||
# Copy bootloader over
|
||||
@sysargs=("cp", "$rbbname", "$rootfsdir/usr/bin/$rbbasename");
|
||||
|
|
@ -201,6 +249,7 @@ system(@sysargs);
|
|||
|
||||
system("rm -Rf $rootfsdir") if (!$debug);
|
||||
|
||||
if ($hiby) {
|
||||
# md5sum
|
||||
my $md5 = `md5sum $ubinamenew | cut -d ' ' -f 1`;
|
||||
|
||||
|
|
@ -212,7 +261,7 @@ system("mv $ubinamenew $ubiname");
|
|||
open UPDATE, "<$updatename" || die ("Can't open update.txt!");
|
||||
open UPDATEO, ">$updatename.new" || die ("Can't open update.txt!");
|
||||
|
||||
$rootfs_found = 0;
|
||||
my $rootfs_found = 0;
|
||||
while (<UPDATE>) {
|
||||
if ($rootfs_found) {
|
||||
if (s/md5=.*/md5=$md5/) {
|
||||
|
|
@ -247,3 +296,7 @@ system("mv $versionname.new $versionname");
|
|||
system(@sysargs);
|
||||
|
||||
system("rm -Rf $isowork") if (!$debug);
|
||||
} else {
|
||||
# Reconstruct fiio/ingenic firmware update image
|
||||
# very TODO
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue