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();
|
alsa_controls_init();
|
||||||
hw_open();
|
hw_open();
|
||||||
// set 19/'ADC Mux' 0
|
// NOTE:
|
||||||
// set 4/'Digital Capture Volume' 0
|
// Of the exported controls, only these do anything:
|
||||||
// set 6/'Mic Volume' 0
|
// 10 DACL Playback Volume
|
||||||
// set 11/'DACR Playback Volume' 0 (wtf?? vortex used 1, of used 0)
|
// 11 DACR Playback Volume
|
||||||
|
// 12 Low Mode Switch (see table 25 in datasheet, not simple..)
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiohw_postinit(void)
|
void audiohw_postinit(void)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#
|
#
|
||||||
# Hiby patcher Copyright (C) 2020 Solomon Peachy <pizza@shaftnet.org>
|
# 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 $prefix = "/tmp"; # XXX mktmp
|
||||||
my $debug = 0; # Set to 1 to prevent cleaning up work dirs
|
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
|
#### Let's get to work
|
||||||
|
|
||||||
my @ubiopts;
|
my @ubiopts;
|
||||||
|
|
@ -42,6 +44,7 @@ if ($model eq 'rocker') {
|
||||||
@ubiopts = ("-e", "124KiB", "-c", "1024", "-m", "2048", "-j", "8192KiB", "-U");
|
@ubiopts = ("-e", "124KiB", "-c", "1024", "-m", "2048", "-j", "8192KiB", "-U");
|
||||||
} elsif ($model eq 'm3k') {
|
} elsif ($model eq 'm3k') {
|
||||||
@ubiopts = ("-e", "124KiB", "-c", "2048", "-m", "2048", "-j", "8192KiB", "-U");
|
@ubiopts = ("-e", "124KiB", "-c", "2048", "-m", "2048", "-j", "8192KiB", "-U");
|
||||||
|
$hiby = 0;
|
||||||
} else {
|
} else {
|
||||||
die ("Unknown hiby model: $model\n");
|
die ("Unknown hiby model: $model\n");
|
||||||
}
|
}
|
||||||
|
|
@ -52,25 +55,24 @@ my $isowork = "$prefix/iso.$uptname";
|
||||||
my $rootfsdir = "$prefix/rootfs.$uptname";
|
my $rootfsdir = "$prefix/rootfs.$uptname";
|
||||||
my $ubiname;
|
my $ubiname;
|
||||||
my $ubinamenew;
|
my $ubinamenew;
|
||||||
|
my $updatename;
|
||||||
|
my $versionname;
|
||||||
|
|
||||||
my @sysargs;
|
my @sysargs;
|
||||||
|
|
||||||
|
#### Extract OF image wrapper
|
||||||
### Extract outer ISO9660 image
|
if ($hiby) {
|
||||||
system("rm -Rf $isowork");
|
system("rm -Rf $isowork");
|
||||||
mkdir($isowork) || die ("Can't create '$isowork'");
|
mkdir($isowork) || die ("Can't create '$isowork'");
|
||||||
@sysargs = ("7z", "x", "-aoa", "-o$isowork", $inname);
|
@sysargs = ("7z", "x", "-aoa", "-o$isowork", $inname);
|
||||||
system(@sysargs);
|
system(@sysargs);
|
||||||
|
|
||||||
### figure out the rootfs image filenames
|
### figure out the rootfs image filenames
|
||||||
my $updatename;
|
|
||||||
if ( -e "$isowork/UPDATE.TXT") {
|
if ( -e "$isowork/UPDATE.TXT") {
|
||||||
$updatename = "$isowork/UPDATE.TXT";
|
$updatename = "$isowork/UPDATE.TXT";
|
||||||
} elsif ( -e "$isowork/update.txt") {
|
} elsif ( -e "$isowork/update.txt") {
|
||||||
$updatename = "$isowork/update.txt";
|
$updatename = "$isowork/update.txt";
|
||||||
}
|
}
|
||||||
my $versionname;
|
|
||||||
if ( -e "$isowork/VERSION.TXT") {
|
if ( -e "$isowork/VERSION.TXT") {
|
||||||
$versionname = "$isowork/VERSION.TXT";
|
$versionname = "$isowork/VERSION.TXT";
|
||||||
} elsif ( -e "$isowork/version.txt") {
|
} elsif ( -e "$isowork/version.txt") {
|
||||||
|
|
@ -101,19 +103,39 @@ if (! -e "$isowork/$ubiname") {
|
||||||
}
|
}
|
||||||
|
|
||||||
$ubiname = "$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");
|
system("rm -Rf $rootfsdir");
|
||||||
mkdir($rootfsdir) || die ("Can't create '$rootfsdir'");
|
mkdir($rootfsdir) || die ("Can't create '$rootfsdir'");
|
||||||
|
|
||||||
@sysargs = ("ubireader_extract_files", "-k", "-o", $rootfsdir, $ubiname);
|
@sysargs = ("ubireader_extract_files", "-k", "-o", $rootfsdir, $ubiname);
|
||||||
system(@sysargs);
|
system(@sysargs);
|
||||||
|
|
||||||
# exit(0);
|
|
||||||
### Mangle RootFS
|
|
||||||
|
|
||||||
# Generate rb_bootloader.sh
|
|
||||||
my $rbbasename = basename($rbbname);
|
my $rbbasename = basename($rbbname);
|
||||||
|
|
||||||
|
#### Mangle RootFS
|
||||||
|
if ($hiby) {
|
||||||
my $bootloader_sh =
|
my $bootloader_sh =
|
||||||
"#!/bin/sh
|
"#!/bin/sh
|
||||||
|
|
||||||
|
|
@ -188,6 +210,32 @@ chmod 0755, "$rootfsdir/etc/rb_removing.sh";
|
||||||
|
|
||||||
# Deal with a nasty race condition in automount scripts
|
# Deal with a nasty race condition in automount scripts
|
||||||
system("perl -pni -e 's/rm -rf/#rm -Rf/;' $rootfsdir/etc/init.d/S50sys_server");
|
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
|
# Copy bootloader over
|
||||||
@sysargs=("cp", "$rbbname", "$rootfsdir/usr/bin/$rbbasename");
|
@sysargs=("cp", "$rbbname", "$rootfsdir/usr/bin/$rbbasename");
|
||||||
|
|
@ -201,6 +249,7 @@ system(@sysargs);
|
||||||
|
|
||||||
system("rm -Rf $rootfsdir") if (!$debug);
|
system("rm -Rf $rootfsdir") if (!$debug);
|
||||||
|
|
||||||
|
if ($hiby) {
|
||||||
# md5sum
|
# md5sum
|
||||||
my $md5 = `md5sum $ubinamenew | cut -d ' ' -f 1`;
|
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 UPDATE, "<$updatename" || die ("Can't open update.txt!");
|
||||||
open UPDATEO, ">$updatename.new" || 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>) {
|
while (<UPDATE>) {
|
||||||
if ($rootfs_found) {
|
if ($rootfs_found) {
|
||||||
if (s/md5=.*/md5=$md5/) {
|
if (s/md5=.*/md5=$md5/) {
|
||||||
|
|
@ -247,3 +296,7 @@ system("mv $versionname.new $versionname");
|
||||||
system(@sysargs);
|
system(@sysargs);
|
||||||
|
|
||||||
system("rm -Rf $isowork") if (!$debug);
|
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