device-kobo-clara: add init script to extract EPD waveform (MR 2334)
[ci:skip-build] already built successfully in CI
This commit is contained in:
parent
4be98f830f
commit
b1d88b7bf0
4 changed files with 62 additions and 6 deletions
|
@ -1,28 +1,32 @@
|
|||
# Reference: <https://postmarketos.org/devicepkg>
|
||||
pkgname=device-kobo-clara
|
||||
pkgdesc="Kobo Clara HD"
|
||||
pkgver=0.1
|
||||
pkgver=0.2
|
||||
pkgrel=0
|
||||
url="https://postmarketos.org"
|
||||
license="MIT"
|
||||
arch="armv7"
|
||||
options="!check !archcheck"
|
||||
depends="
|
||||
perl
|
||||
postmarketos-base
|
||||
u-boot-kobo-clara
|
||||
u-boot-tools
|
||||
"
|
||||
makedepends="devicepkg-dev"
|
||||
source="
|
||||
deviceinfo
|
||||
uboot-script-downstream.cmd
|
||||
uboot-script-mainline.cmd
|
||||
"
|
||||
install="$pkgname.post-install"
|
||||
subpackages="
|
||||
$pkgname-kernel-downstream:kernel_downstream
|
||||
$pkgname-kernel-mainline:kernel_mainline
|
||||
$pkgname-nonfree-firmware:nonfree_firmware
|
||||
"
|
||||
source="
|
||||
deviceinfo
|
||||
extract-waveform.initd
|
||||
extract-waveform.pl
|
||||
uboot-script-downstream.cmd
|
||||
uboot-script-mainline.cmd
|
||||
"
|
||||
|
||||
build() {
|
||||
devicepkg_build $startdir $pkgname
|
||||
|
@ -30,6 +34,8 @@ build() {
|
|||
|
||||
package() {
|
||||
devicepkg_package $startdir $pkgname
|
||||
install -Dm755 "$srcdir"/extract-waveform.pl "$pkgdir"/usr/sbin/extract-waveform.pl
|
||||
install -Dm755 "$srcdir"/extract-waveform.initd "$pkgdir"/etc/init.d/extract-waveform
|
||||
}
|
||||
|
||||
kernel_downstream() {
|
||||
|
@ -60,6 +66,8 @@ nonfree_firmware() {
|
|||
|
||||
sha512sums="
|
||||
8ff8c8a4a1cd274a060413423dea7767e06f4ab2bf539bcb1a084e2d4cb488115947e553e86e0c4a20287ca156ce167329a2c2c462a66094f1bec6ddccc07276 deviceinfo
|
||||
c68e4e41d73a1f9d08aeed95743d5a3ae6831d36d0259ba96ceca297479fef01b78c2b569c376c5b24b4ee24ea7d3cb44d6e97730f44d81fd67e9f0586c4911a extract-waveform.initd
|
||||
34475b314e45135c84e4abdc769d3aba9df56e37814c7f689d5e1aca5af060b2e028c01e871c3863534fede0be7c79aaebe0a1ff4f2bfab2ee974489119005cf extract-waveform.pl
|
||||
9f95496929f46de69afb6b25b1e3d099668e0f759eb1d36f76d84af14c8bd78cb739c410c58d7a31283782c6ff11999575c8c7ec22c11adec018b3026b290408 uboot-script-downstream.cmd
|
||||
5152e007591e07c4772ecbce4e212ae6c1b65264a46234c11c425f91439171a6379727e344a5c9654da368baa61b863660bf781e5e211d813532d29d8c2e7fd9 uboot-script-mainline.cmd
|
||||
"
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
rc-update add extract-waveform default
|
21
device/testing/device-kobo-clara/extract-waveform.initd
Normal file
21
device/testing/device-kobo-clara/extract-waveform.initd
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/sbin/openrc-run
|
||||
|
||||
description="Extract EPD waveform blob to /lib/firmware"
|
||||
|
||||
depend() {
|
||||
after root
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
# Only run once
|
||||
rm -f /etc/runlevels/*/$RC_SVCNAME
|
||||
|
||||
dir="/lib/firmware/imx/epdc"
|
||||
|
||||
ebegin "Copying EPD waveform to /lib/firmware..."
|
||||
mkdir -p "$dir" && cd "$dir" \
|
||||
&& extract-waveform.pl /dev/mmcblk0 epdc_PENG060D.fw \
|
||||
&& ln -sf epdc_PENG060D.fw epdc.fw
|
||||
eend $?
|
||||
}
|
24
device/testing/device-kobo-clara/extract-waveform.pl
Normal file
24
device/testing/device-kobo-clara/extract-waveform.pl
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/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;
|
Loading…
Reference in a new issue