pmaports/device/testing/device-tolino-shine3/extract-waveform.pl
Andreas Kemnade f5a4a663e0
tolino-shine3: new device (MR 2909)
Basic support for the Tolino Shine 3 ebook reader. It is the same board as
the Kobo Clara HD.
Waveform handling shares the same oddities as for the Kobo Clara HD
but the file epdc_E060SCM.fw from the IMX6SL BSP from NXP does also work.
The existing waveform from SD card is used.

Preferred way to install is to clone the internal SD, keeping the original
as a backup, install on that clone.

U-Boot is a more recent one than the factory u-boot, so devicetrees are nicely
supported. Kernel is the near mainline kernel also used by the Kobo Clara HD.
2022-05-05 21:18:08 +02:00

24 lines
765 B
Perl

#!/usr/bin/env perl
# SPDX-License-Identifier: GPL-2.0+
# (c) 2020, Andreas Kemnade
sub usage {
print "Usage: $0 disk epdc.fw\ndisk is the Kobo/Toline disk (image) containing a waveform\n";
exit(1);
}
&usage unless $#ARGV == 1;
open IMGFILE, '<:raw', @ARGV[0] or die "cannot open @ARGV[0]";
seek IMGFILE, 0x700000-16, 0;
read IMGFILE, $magic, 8;
(unpack("x0 H16", $magic) eq "fff5afff78563412") or die "invalid magic";
seek IMGFILE, 0x700000-8, 0;
read IMGFILE, $lengthbytes, 4;
$length = unpack("x0 V", $lengthbytes) or die "invalid length";
print $length . " bytes\n" ;
seek IMGFILE, 0x700000, 0 or die "seek failed, file too short?";
open OUTFILE, '>:raw', @ARGV[1] or die "cannot open @ARGV[1]";
read IMGFILE, $waveform, $length;
print OUTFILE $waveform;