diff --git a/device/testing/device-tolino-shine3/APKBUILD b/device/testing/device-tolino-shine3/APKBUILD new file mode 100644 index 000000000..3bdbf8295 --- /dev/null +++ b/device/testing/device-tolino-shine3/APKBUILD @@ -0,0 +1,45 @@ +# Reference: +pkgname=device-tolino-shine3 +pkgdesc="Tolino Shine 3" +pkgver=0.1 +pkgrel=0 +url="https://postmarketos.org" +license="MIT" +arch="armv7" +options="!check !archcheck" +depends=" + perl + postmarketos-base + u-boot-tolino-shine3 + u-boot-tools + linux-kobo-clara-mainline +" +makedepends="devicepkg-dev" +install="$pkgname.post-install" + +source=" + deviceinfo + extract-waveform.initd + extract-waveform.pl + uboot-script.cmd +" + +build() { + devicepkg_build $startdir $pkgname +} + +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 + mkimage -A arm -O linux -T script -n postmarketOS \ + -d "$srcdir/uboot-script.cmd" "$srcdir/boot.scr" + install -Dm644 "$srcdir/boot.scr" "$pkgdir/boot/boot.scr" +} + +sha512sums=" +9f58b75c127cb823859dc8bfa4997c58ea3d7192919b257e6c26bc8c1ddec105943cca4193bc2c5058357a64fe1395b99dbb69a0b1a95fe008d710da40b21744 deviceinfo +c68e4e41d73a1f9d08aeed95743d5a3ae6831d36d0259ba96ceca297479fef01b78c2b569c376c5b24b4ee24ea7d3cb44d6e97730f44d81fd67e9f0586c4911a extract-waveform.initd +34475b314e45135c84e4abdc769d3aba9df56e37814c7f689d5e1aca5af060b2e028c01e871c3863534fede0be7c79aaebe0a1ff4f2bfab2ee974489119005cf extract-waveform.pl +86827d4464def94006105841000ed934326d814d49aa03292937228a37b1120ebb84f04cd23946feaca16c8eb8d847d671bef0ae98f2c5632fd01abb46bb033d uboot-script.cmd +" diff --git a/device/testing/device-tolino-shine3/device-tolino-shine3.post-install b/device/testing/device-tolino-shine3/device-tolino-shine3.post-install new file mode 100644 index 000000000..eef41e601 --- /dev/null +++ b/device/testing/device-tolino-shine3/device-tolino-shine3.post-install @@ -0,0 +1,3 @@ +#!/bin/sh + +rc-update add extract-waveform default diff --git a/device/testing/device-tolino-shine3/deviceinfo b/device/testing/device-tolino-shine3/deviceinfo new file mode 100644 index 000000000..8f3b5e054 --- /dev/null +++ b/device/testing/device-tolino-shine3/deviceinfo @@ -0,0 +1,31 @@ +# Reference: +# Please use double quotes only. You can source this file in shell +# scripts. + +deviceinfo_format_version="0" +deviceinfo_name="Tolino Shine 3" +# tolino was bought by Kobo, "about" pages on device list Kobo +# but to not add too much confusion, simply specify Tolino here +# Mainline kernel uses kobo as vendor-prefix for the model name compatible +deviceinfo_manufacturer="Tolino" +deviceinfo_codename="tolino-shine3" +deviceinfo_year="2018" +deviceinfo_arch="armv7" +deviceinfo_dtb="imx6sl-tolino-shine3" + +# Device related +deviceinfo_chassis="tablet" +deviceinfo_keyboard="false" +deviceinfo_external_storage="true" +deviceinfo_screen_width="1072" +deviceinfo_screen_height="1448" + +# Bootloader related +deviceinfo_flash_method="none" +deviceinfo_boot_part_start="49152" +deviceinfo_getty="ttymxc0;115200" +deviceinfo_generate_legacy_uboot_initfs="true" +deviceinfo_no_framebuffer="true" + +deviceinfo_sd_embed_firmware_step_size="512" +deviceinfo_sd_embed_firmware="u-boot/tolino-shine3/u-boot.imx:2,u-boot/tolino-shine3/u-boot-env.bin:1536" diff --git a/device/testing/device-tolino-shine3/extract-waveform.initd b/device/testing/device-tolino-shine3/extract-waveform.initd new file mode 100644 index 000000000..bfd46ced8 --- /dev/null +++ b/device/testing/device-tolino-shine3/extract-waveform.initd @@ -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 $? +} diff --git a/device/testing/device-tolino-shine3/extract-waveform.pl b/device/testing/device-tolino-shine3/extract-waveform.pl new file mode 100644 index 000000000..9d9e86dda --- /dev/null +++ b/device/testing/device-tolino-shine3/extract-waveform.pl @@ -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; diff --git a/device/testing/device-tolino-shine3/uboot-script.cmd b/device/testing/device-tolino-shine3/uboot-script.cmd new file mode 100644 index 000000000..153a5812c --- /dev/null +++ b/device/testing/device-tolino-shine3/uboot-script.cmd @@ -0,0 +1,14 @@ +led e60k02:white:on on +setenv bootargs console=ttymxc0,115200 + +echo Loading kernel +load mmc 0:1 0x80800000 vmlinuz + +echo Loading DTB +load mmc 0:1 0x83000000 imx6sl-tolino-shine3.dtb + +echo Loading initrd +load mmc 0:1 0x85000000 uInitrd + +echo Booting kernel +bootz 0x80800000 0x85000000 0x83000000 diff --git a/device/testing/u-boot-tolino-shine3/APKBUILD b/device/testing/u-boot-tolino-shine3/APKBUILD new file mode 100644 index 000000000..78d275dd6 --- /dev/null +++ b/device/testing/u-boot-tolino-shine3/APKBUILD @@ -0,0 +1,37 @@ +# Reference: +pkgname=u-boot-tolino-shine3 +pkgver=2020.10 +pkgrel=0 +pkgdesc="U-Boot for Tolino Shine 3, based on freescale fork" +arch="armv7" +_carch="arm" +license="GPL-2.0" +url="https://github.com/akemnade/u-boot-fslc" +makedepends="$depends_dev bc dtc bison flex" +options="!check" + +_repository="u-boot-fslc" +_commit="fcf25705fc8b57cb22c81b2d352e9a06269911be" +source=" + $pkgname-$_commit.tar.gz::https://github.com/akemnade/$_repository/archive/$_commit.tar.gz + u-boot-env.txt +" + +builddir="$srcdir/$_repository-$_commit" + +build() { + make ARCH="$_carch" mx6sltolinoshine3_defconfig + make ARCH="$_carch" + tools/mkenvimage -p 0 -s 8192 -o u-boot-env.bin "$srcdir/u-boot-env.txt" +} + +package() { + install -D -m644 "$builddir/u-boot-dtb.bin" "$pkgdir/usr/share/u-boot/tolino-shine3/u-boot.bin" + install -D -m644 "$builddir/u-boot-dtb.imx" "$pkgdir/usr/share/u-boot/tolino-shine3/u-boot.imx" + install -D -m644 "$builddir/u-boot-env.bin" "$pkgdir/usr/share/u-boot/tolino-shine3/u-boot-env.bin" +} + +sha512sums=" +6a9c3f5d2ad806ab9529f0c8fc19213098aae620c5bf34e5cc273453bf007266a674489deff18ffa82e8826280192dbc443b024a3f878836021ae6c062be4189 u-boot-tolino-shine3-fcf25705fc8b57cb22c81b2d352e9a06269911be.tar.gz +ca8237a86da93dfea62355cfbb8dbe4104c2f3aea71b4c36d5418e6aef6ead32e9d23e4731b8ff64b4a73ca563b0323087384de10d4946afd657dce4cc7c6fee u-boot-env.txt +" diff --git a/device/testing/u-boot-tolino-shine3/u-boot-env.txt b/device/testing/u-boot-tolino-shine3/u-boot-env.txt new file mode 100644 index 000000000..acd851bfc --- /dev/null +++ b/device/testing/u-boot-tolino-shine3/u-boot-env.txt @@ -0,0 +1,2 @@ +# Load actual boot script from the boot partition +bootcmd=load mmc 0:1 0x80800000 boot.scr ; source 0x80800000