device-kobo-clara: new device (Kobo Clara HD) (MR 2334)

Support the downstream kernel and a close-to-mainline fork. Waveform
data for the eInk display and the Wi-Fi driver are not included yet.
Everything else should work.
This commit is contained in:
Timotej Lazar 2021-07-10 16:43:24 +02:00 committed by Dylan Van Assche
parent add2efe222
commit c1a3d06678
No known key found for this signature in database
GPG key ID: 8642571587897EA1
17 changed files with 9236 additions and 0 deletions

View file

@ -0,0 +1,65 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-kobo-clara
pkgdesc="Kobo Clara HD"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="
postmarketos-base
u-boot-kobo-clara
u-boot-tools
"
makedepends="devicepkg-dev"
source="
deviceinfo
uboot-script-downstream.cmd
uboot-script-mainline.cmd
"
subpackages="
$pkgname-kernel-downstream:kernel_downstream
$pkgname-kernel-mainline:kernel_mainline
$pkgname-nonfree-firmware:nonfree_firmware
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
kernel_downstream() {
pkgdesc="Downstream kernel"
depends="linux-kobo-clara"
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
mkimage -A arm -O linux -T script -n postmarketOS \
-d "$srcdir"/uboot-script-downstream.cmd "$srcdir/boot-downstream.scr"
install -Dm644 "$srcdir/boot-downstream.scr" "$subpkgdir/boot/boot.scr"
}
kernel_mainline() {
pkgdesc="Close to mainline kernel"
depends="linux-kobo-clara-mainline"
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
mkimage -A arm -O linux -T script -n postmarketOS \
-d "$srcdir/uboot-script-mainline.cmd" "$srcdir/boot-mainline.scr"
install -Dm644 "$srcdir/boot-mainline.scr" "$subpkgdir/boot/boot.scr"
}
nonfree_firmware() {
pkgdesc="Kobo Clara HD firmware"
depends="firmware-kobo-clara"
mkdir "$subpkgdir"
}
sha512sums="
8ff8c8a4a1cd274a060413423dea7767e06f4ab2bf539bcb1a084e2d4cb488115947e553e86e0c4a20287ca156ce167329a2c2c462a66094f1bec6ddccc07276 deviceinfo
9f95496929f46de69afb6b25b1e3d099668e0f759eb1d36f76d84af14c8bd78cb739c410c58d7a31283782c6ff11999575c8c7ec22c11adec018b3026b290408 uboot-script-downstream.cmd
5152e007591e07c4772ecbce4e212ae6c1b65264a46234c11c425f91439171a6379727e344a5c9654da368baa61b863660bf781e5e211d813532d29d8c2e7fd9 uboot-script-mainline.cmd
"

View file

@ -0,0 +1,31 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell
# scripts.
deviceinfo_format_version="0"
deviceinfo_name="Kobo Clara HD"
deviceinfo_manufacturer="Kobo"
deviceinfo_codename="kobo-clara"
deviceinfo_year="2018"
deviceinfo_modules_initfs=""
deviceinfo_arch="armv7"
deviceinfo_dtb_downstream="imx6sll-e60k02"
deviceinfo_dtb_mainline="imx6sll-kobo-clarahd"
# 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_downstream="u-boot/kobo-clara/u-boot.imx:2,firmware/kobo-clara/hwcfg+header.bin:1023,firmware/kobo-clara/ntxfw-E60K00+header.bin:1029,u-boot/kobo-clara/u-boot-env.bin:1536"
deviceinfo_sd_embed_firmware_mainline="u-boot/kobo-clara/u-boot.imx:2,firmware/kobo-clara/hwcfg+header.bin:1023,u-boot/kobo-clara/u-boot-env.bin:1536"

View file

@ -0,0 +1,17 @@
setenv bootargs console=ttymxc0,115200
# This must be called first, otherwise bootz does not work correctly.
# The actual kernel is loaded over this below.
load_ntxkernel
echo Loading kernel
load mmc 0:1 0x80800000 vmlinuz-kobo-clara
echo Loading DTB
load mmc 0:1 0x83000000 imx6sll-e60k02.dtb
echo Loading initrd
load mmc 0:1 0x85000000 uInitrd-kobo-clara
echo Booting kernel
bootz 0x80800000 0x85000000 0x83000000

View file

@ -0,0 +1,17 @@
setenv bootargs console=ttymxc0,115200
# This must be called first, otherwise bootz does not work correctly.
# The actual kernel is loaded over this below.
load_ntxkernel
echo Loading kernel
load mmc 0:1 0x80800000 vmlinuz-kobo-clara-mainline
echo Loading DTB
load mmc 0:1 0x83000000 imx6sll-kobo-clarahd.dtb
echo Loading initrd
load mmc 0:1 0x85000000 uInitrd-kobo-clara-mainline
echo Booting kernel
bootz 0x80800000 0x85000000 0x83000000

View file

@ -0,0 +1,49 @@
pkgname=firmware-kobo-clara
pkgver=4.26.16704
pkgrel=0
pkgdesc="Kobo Clara firmware"
url="https://wiki.mobileread.com/wiki/Kobo_Firmware_Releases"
arch="armv7"
license="proprietary"
options="!check !archcheck"
source="
https://download.kobobooks.com/firmwares/kobo7/Feb2021/kobo-update-4.26.16704.zip
hwcfg.bin
"
# Print given number as bytes in 32-bit little-endian
_le32() {
printf "%08x" "$1" | sed -E 's/(..)(..)(..)(..)/\\x\4\\x\3\\x\2\\x\1/'
}
# Print the magic header for the given file for Kobo u-boot
_print_header() {
length=$(stat -L -c %s "$1")
dd bs=496 count=1 if=/dev/zero
printf '\xff\xf5\xaf\xff\x78\x56\x34\x12%b\x00\x00\x00\x00' "$(_le32 "$length")"
}
build() {
# Prepend a header to each firmware file loaded by u-boot
for fw in hwcfg upgrade/mx6sll-ntx/ntxfw-E60K00 ; do
out="$srcdir/$fw+header.bin"
_print_header "$srcdir/$fw.bin" > "$out"
cat "$srcdir/$fw.bin" >> "$out"
done
}
package() {
# Hardware description struct, passed to kernel by u-boot
# See https://misc.andi.de1.cc/kobo/
install -Dm644 "$srcdir/hwcfg+header.bin" \
"$pkgdir/usr/share/firmware/kobo-clara/hwcfg+header.bin"
# Value table for the 2-color lm3630 frontlight, passed to kernel by u-boot
install -Dm644 "$srcdir/upgrade/mx6sll-ntx/ntxfw-E60K00+header.bin" \
"$pkgdir/usr/share/firmware/kobo-clara/ntxfw-E60K00+header.bin"
}
sha512sums="
c1f89e630777ebad282ad77f40355b5fb50ad3c8fa57ed624b89d53d4fbb788783ed60f85f6f848f786c8c5ea7dcb913d16446fa2a87d68f033277272799d149 kobo-update-4.26.16704.zip
f7820b6c4624bab4bea92a0e2732cdaae8a37fbbe2ef823e61c48bb3e2400c70f7ee3c7945e7826f01653ba65f9a4034e884b985518fbcb84c8759c9c6351fad hwcfg.bin
"

Binary file not shown.

View file

@ -0,0 +1,63 @@
# Kernel config based on: arch/arm/configs/kobo_defconfig
pkgname=linux-kobo-clara-mainline
pkgver=5.12.0
pkgrel=0
pkgdesc="Kobo Clara HD kernel fork, close to mainline"
arch="armv7"
_carch="arm"
_flavor="kobo-clara-mainline"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native pmb:kconfigcheck-nftables"
makedepends="
bash
bc
bison
devicepkg-dev
findutils
flex
gmp-dev
lzop
mpc1-dev
mpfr-dev
openssl-dev
perl
"
# Source
_repository="linux"
_commit="4dd67a97287964010bdae4751cb965bf118c14d7"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/akemnade/$_repository/archive/$_commit.tar.gz
$_config
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"
prepare() {
REPLACE_GCCH=0
default_prepare
. downstreamkernel_prepare
}
build() {
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$(( pkgrel + 1 ))-postmarketOS"
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir"
make modules_install dtbs_install \
O="$_outdir" \
ARCH="$_carch" \
INSTALL_MOD_PATH="$pkgdir" \
INSTALL_DTBS_PATH="$pkgdir/usr/share/dtb"
}
sha512sums="
7a2a2f5817eae9e8917b60a92c041912c0073e7f6aa48664a4b399e7d39a8f790d9ab020384bcc12d85d973b1879cadffc0a266885d7584a8a631b680c170acf linux-kobo-clara-mainline-4dd67a97287964010bdae4751cb965bf118c14d7.tar.gz
256971be31b2ecf3a4c41c047f7c8eb6e8255a1c275fe1c86e13f96139f454db8d5c1998b7be4aa0f67dcc93e0a5ec2fd7b3526e6e60afab72e44a33be42c8f0 config-kobo-clara-mainline.armv7
"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,65 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/imx_v7_kobo_defconfig
pkgname=linux-kobo-clara
pkgver=4.1.15
pkgrel=0
pkgdesc="Kobo Clara HD kernel fork"
arch="armv7"
_carch="arm"
_flavor="kobo-clara"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native pmb:kconfigcheck-nftables"
makedepends="
bash
devicepkg-dev
lzop
"
# Source
_repository="Kobo-Reader"
_commit="b912467581644d7b8b22cefc1e1bfc3231264979"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.bz2::https://github.com/kobolabs/$_repository/raw/$_commit/hw/imx6sll-clara/kernel.tar.bz2
$_config
gcc7-give-up-on-ilog2-const-optimizations.patch
gcc8-fix-put-user.patch
gcc10-extern_YYLOC_global_declaration.patch
fix-device-tree.patch
fix-shipped-library-name.patch
"
builddir="$srcdir/kernel"
_outdir="out"
prepare() {
REPLACE_GCCH=0
default_prepare
. downstreamkernel_prepare
}
build() {
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" \
CC="${CC:-gcc}" CFLAGS_MODULE="-fno-pic" \
KBUILD_BUILD_VERSION="$(( pkgrel + 1 ))-postmarketOS"
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir"
make modules_install dtbs_install \
O="$_outdir" ARCH="$_carch" \
INSTALL_MOD_PATH="$pkgdir" \
INSTALL_DTBS_PATH="$pkgdir/usr/share/dtb"
}
sha512sums="
0c937767d7700eb2fde8caadc67ed2dda73969dbff8806c3811e2d05d423b51bc8219643d9ff6f09fc02787a9cbac6b4ee8cf75ea6e39cceba6a067b6370329d linux-kobo-clara-b912467581644d7b8b22cefc1e1bfc3231264979.tar.bz2
daea06c27d55d14c91a85e7b10162e52ac401a44a5c08f4a065339a32adf654e7570687b22884c49b2d2f4882e7560c415b8897a95d4ccdfa0532c0a7bd47c57 config-kobo-clara.armv7
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb gcc10-extern_YYLOC_global_declaration.patch
8e6cc43ec5b3eb02e79d47841c3ada628e1ccfaece08a2a0c88542021f14603c99108bb1d4cd865b1dd3d62d3f7ae65b018bc778fb8dc9292e89e736c9b92a9d fix-device-tree.patch
a90128ca7d51ef36010ab8565f458f2914558cd8d77916b8a06cb750f14dde2b800d7886ed21553c16926616a00ec80ca2dce9a1f51164e5d110e0f4528db287 fix-shipped-library-name.patch
"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,34 @@
From 9df7c717b72507bf8d69715d30944f5bdaf639e8 Mon Sep 17 00:00:00 2001
From: Martijn Braam <martijn@brixit.nl>
Date: Sat, 29 Jun 2019 15:03:28 +0200
Subject: [PATCH] Fix vendor kernel
---
arch/arm/boot/dts/Makefile | 2 +-
arch/arm/boot/dts/imx6sll-e80k02.dts | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index b4adfdd12385..c80053cffe5a 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -400,7 +400,7 @@ dtb-$(CONFIG_SOC_IMX6UL) += \
dtb-$(CONFIG_SOC_IMX6SLL) += \
imx6sll-lpddr2-ntx.dtb \
imx6sll-e80k02.dtb \
- imx6sll-e80k02-sy7636.dtb \
+ imx6sll-e60k02-sy7636.dtb \
imx6sll-e70q02.dtb \
imx6sll-t05r02.dtb \
imx6sll-e60qm2.dtb \
diff --git a/arch/arm/boot/dts/imx6sll-e80k02.dts b/arch/arm/boot/dts/imx6sll-e80k02.dts
index 9bda463ffcbd..ecd12d2cd4b1 100644
--- a/arch/arm/boot/dts/imx6sll-e80k02.dts
+++ b/arch/arm/boot/dts/imx6sll-e80k02.dts
@@ -1,5 +1,5 @@
-#include "imx6sll-e80k02-base.dts"
+#include "imx6sll-e60k02-base.dts"
&i2c2 {
tps6518x@68 {

View file

@ -0,0 +1,21 @@
External object files should end with _shipped so that kbuild handles
them correctly. Link drivers/video/fbdev/mxc/lib.a_shipped-imx6sl-noaa
to lib-imx6sl-noaa.a_shipped and fix the Makefile.
diff --git a/drivers/video/fbdev/mxc/Makefile b/drivers/video/fbdev/mxc/Makefile
index cb81820c..9e59b92a 100644
--- a/drivers/video/fbdev/mxc/Makefile
+++ b/drivers/video/fbdev/mxc/Makefile
@@ -9,7 +9,7 @@ obj-$(CONFIG_FB_MXC_EDID) += mxc_edid.o
obj-$(CONFIG_FB_MXC_SYNC_PANEL) += mxc_dispdrv.o mxc_lcdif.o mxc_ipuv3_fb.o
obj-$(CONFIG_FB_MXC_EINK_PANEL) += mxc_epdc_fb.o
obj-$(CONFIG_FB_MXC_EINK_V2_PANEL) += mxc_epdc_v2_fb.o mxc_epdc_eink.o fake_s1d13522.o epdfb_dc.o
-mxc_epdc_eink-objs := mxc_epdc_eink_module.o lib.a_shipped-imx6sl-noaa
+mxc_epdc_eink-objs := mxc_epdc_eink_module.o lib-imx6sl-noaa.a
obj-$(CONFIG_FB_MXS_SII902X) += mxsfb_sii902x.o
obj-$(CONFIG_FB_MXC_DCIC) += mxc_dcic.o
obj-$(CONFIG_HANNSTAR_CABC) += hannstar_cabc.o
diff --git a/drivers/video/fbdev/mxc/lib.a_shipped-imx6sl-noaa b/drivers/video/fbdev/mxc/lib-imx6sl-noaa.a_shipped
similarity index 100%
rename from drivers/video/fbdev/mxc/lib.a_shipped-imx6sl-noaa
rename to drivers/video/fbdev/mxc/lib-imx6sl-noaa.a_shipped

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc10-extern_YYLOC_global_declaration.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc7-give-up-on-ilog2-const-optimizations.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc8-fix-put-user.patch

View file

@ -0,0 +1,36 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=u-boot-kobo-clara
pkgver=2016.03
pkgrel=0
pkgdesc="U-Boot for Kobo Clara HD"
arch="armv7"
_carch="arm"
license="GPL-2.0"
url="https://github.com/pmsourcedump/kobo_clara_uboot"
options="!check"
_repository="kobo_clara_uboot"
_commit="5af329fef886e21b777426d7bf5c6162e2317de7"
source="
$pkgname-$_commit.tar.gz::https://github.com/pmsourcedump/$_repository/archive/$_commit.tar.gz
u-boot-env.txt
"
builddir="$srcdir/$_repository-$_commit"
build() {
make ARCH="$_carch" mx6sll_ntx_lpddr2_512m_config
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.bin" "$pkgdir/usr/share/u-boot/kobo-clara/u-boot.bin"
install -D -m644 "$builddir/u-boot.imx" "$pkgdir/usr/share/u-boot/kobo-clara/u-boot.imx"
install -D -m644 "$builddir/u-boot-env.bin" "$pkgdir/usr/share/u-boot/kobo-clara/u-boot-env.bin"
}
sha512sums="
1712f5a922b44a8b80e49e00969f0948cd62864adedfb419d9d2f6ccf765b432f8632787f7c6d1502ec0aa6afb7b27bf4193733c2345ff4a0378b43b5b10643a u-boot-kobo-clara-5af329fef886e21b777426d7bf5c6162e2317de7.tar.gz
43c006f8198ac61e5c73dd4a2d583c5ab1da76b76492be9bee385096bdf33e3a42c8058707e8c2f61342faae152ba57f5046909d9ed403f74589d6604f77eb0d u-boot-env.txt
"

View file

@ -0,0 +1,2 @@
# Load actual boot script from the boot partition
bootcmd=load mmc 0:1 0x80800000 boot.scr ; source