google-snow: new device (MR 2888)

This commit is contained in:
jenneron 2022-01-29 16:26:24 +02:00 committed by Alexey Min
parent ac6091a4a7
commit f38eb4b813
No known key found for this signature in database
GPG key ID: 0B19D2A65870B448
14 changed files with 455 additions and 0 deletions

View file

@ -0,0 +1,134 @@
# Reference: <https://postmarketos.org/devicepkg>
# Maintainer: Jenneron <jenneron@protonmail.com>
pkgname=device-google-snow
pkgdesc="Samsung Chromebook"
pkgver=1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="
alsa-ucm-conf
mesa-dri-gallium
postmarketos-base
u-boot-snow
"
makedepends="
devicepkg-dev
u-boot-tools
"
source="
deviceinfo
i3wm/xorg.conf.d/90-tap-to-click.conf
modprobe.d/mali.conf
uboot-script.cmd
ucm/HiFi.conf
ucm/Snow-I2S-MAX98090.conf
mpv/mpv.conf.wayland
mpv/mpv.conf.xorg
sway/foot/foot.ini
sway/tinydm/10-no-hardware-cursor.sh
"
subpackages="
$pkgname-i3wm
$pkgname-kernel-rev4:kernel_rev4
$pkgname-kernel-rev5:kernel_rev5
$pkgname-mpv-wayland:mpv_wayland
$pkgname-mpv-xorg:mpv_xorg
$pkgname-nonfree-firmware:nonfree_firmware
$pkgname-sway
"
build() {
devicepkg_build $startdir $pkgname
mkimage \
-A arm \
-O linux \
-T script \
-C none \
-a 0 \
-e 0 \
-n postmarketos \
-d "$srcdir"/uboot-script.cmd \
"$srcdir"/boot.scr
}
package() {
devicepkg_package $startdir $pkgname
# Block panfrost probe as it causes segfault in X11
install -Dm644 "$srcdir"/mali.conf \
"$pkgdir"/etc/modprobe.d/mali.conf
# Alsa UCM configs
install -Dm644 "$srcdir"/Snow-I2S-MAX98090.conf \
"$pkgdir"/usr/share/alsa/ucm2/conf.d/Snow-I2S-MAX980/Snow-I2S-MAX98090.conf
install -Dm644 "$srcdir"/HiFi.conf \
"$pkgdir"/usr/share/alsa/ucm2/conf.d/Snow-I2S-MAX980/HiFi.conf
# U-Boot script
install -Dm644 "$srcdir"/boot.scr \
"$pkgdir"/boot/boot.scr
}
i3wm() {
install_if="$pkgname=$pkgver-r$pkgrel postmarketos-ui-i3wm"
install -D -m644 "$srcdir"/90-tap-to-click.conf \
"$subpkgdir"/etc/X11/xorg.conf.d/90-tap-to-click.conf
}
# Kernel subpackages to copy correct DTB, uboot-script.cmd selects copied one
kernel_rev4() {
pkgdesc="Google Snow Rev 4"
depends="linux-postmarketos-exynos5"
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}
kernel_rev5() {
pkgdesc="Google Snow Rev 5"
depends="linux-postmarketos-exynos5"
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}
mpv_wayland() {
# Looks like wayland libs are installed with some x11 UIs too, so match wlroots here
install_if="$pkgname=$pkgver-r$pkgrel mpv wlroots"
install -Dm644 "$srcdir"/mpv.conf.wayland \
"$subpkgdir"/etc/mpv/mpv.conf
}
mpv_xorg() {
install_if="$pkgname=$pkgver-r$pkgrel mpv xorg-server"
install -Dm644 "$srcdir"/mpv.conf.xorg \
"$subpkgdir"/etc/mpv/mpv.conf
}
nonfree_firmware() {
pkgdesc="WiFi/BT firmware"
depends="linux-firmware-mrvl"
mkdir "$subpkgdir"
}
sway() {
install_if="$pkgname=$pkgver-r$pkgrel postmarketos-ui-sway"
install -Dm644 "$srcdir"/foot.ini \
"$subpkgdir"/etc/skel/.config/foot/foot.ini
install -Dm755 "$srcdir"/10-no-hardware-cursor.sh \
"$subpkgdir"/etc/tinydm.d/env-wayland.d/10-no-hardware-cursor.sh
}
sha512sums="
f7d3b70ee5f19e634cd41294aa4d1287dad6a8324f9223aa9c26de28b46305e3a9d22e340e0121d7a335aee0be49727e1e289d5daa53e7f22faa7d1347c5abd1 deviceinfo
e53ca475830930ecfc1fd537702e850e2abcb66fbed521cb6c3a2918d762649254bd0244ec93a47b20dfc593ec3afc9bdebdec1759a7bc96dcbe4800f40893da 90-tap-to-click.conf
c5fdd5a39a41044343d937a1ad31cc6bb893f19a329beb4ce09249064cac066d643c84ffcbfcd794113c228c5a56e28c82812092751546b49ab31142dc8245b1 mali.conf
e55e7ccbd038546b70825ed58bdf39bd2780176eacf4fbb36a0bfa3dcfa585a42f891905171ac4e7ce2e98f0c16d41a8586eca870fc53ac8f3adacc7b045777e uboot-script.cmd
8a8f593694528a9323ef4a0aff7e9c6ad45608957eb042d425663f682885c2f95eb01db4fe87b7c43a90de48f3e5f8b10cab4b13c547b5b0d31b924fcb083cad HiFi.conf
b163535da7626e3866faa45768c3888f69f90c98d694650e16a7594a03eb91391e166931eb487901217d983bb2dc4e49b99a2a5531740a7d87f8f4f5c3d0cf59 Snow-I2S-MAX98090.conf
8f9dc3c7caeab6c5321dc2bf498f1a03a793f23cb776763316bc356b9d433d7a3337e61154069464dcda200bf390b99f3be8f657a40c6d2f6be3cbc6fb751080 mpv.conf.wayland
d6bc39df48ba0e985a796426039205335adf1c91b9c150b05a4239339fc78b1748b3a83c699de69e9a5829f29573a323f40788da58ed15b1951de1eab7e31c3d mpv.conf.xorg
61c56cf84cf88371a2238845db1f8283c7eb7b417dec8c51d71e51fb96899bb026c0ee22dc94a43537a56477fb0db59de960949add4b0ce90552a1286e6afe69 foot.ini
78e566bf3a597b9b5f73f686feb93ae61d1bed350366428d74c7735f1f82ab390f47ba9deb9d21e8dfcee251dc6178956838ca1b34838bb0a7d740be0e2c8330 10-no-hardware-cursor.sh
"

View file

@ -0,0 +1,29 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell
# scripts.
deviceinfo_format_version="0"
deviceinfo_name="Samsung Chromebook"
deviceinfo_manufacturer="Samsung"
deviceinfo_codename="google-snow"
deviceinfo_year="2011"
deviceinfo_dtb_rev4="exynos5250-snow"
deviceinfo_dtb_rev5="exynos5250-snow-rev5"
deviceinfo_modules_initfs="drm-dp-aux-bus panel-edp drm-kms-helper cros-ec-keyb sbs-battery tps65090-charger"
deviceinfo_arch="armv7"
# Device related
deviceinfo_chassis="laptop"
deviceinfo_keyboard="true"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1366"
deviceinfo_screen_height="768"
# DRM is available, so all UIs can work with software rendering
deviceinfo_gpu_accelerated="true"
# Bootloader related
deviceinfo_flash_method="none"
deviceinfo_cgpt_kpart="/usr/share/u-boot/google-snow/u-boot-dtb.img.kpart"
deviceinfo_cgpt_kpart_start="8192"
deviceinfo_cgpt_kpart_size="32768"

View file

@ -0,0 +1,6 @@
Section "InputClass"
Identifier "touchpad"
MatchIsTouchpad "on"
Driver "libinput"
Option "Tapping" "on"
EndSection

View file

@ -0,0 +1 @@
blacklist panfrost

View file

@ -0,0 +1,3 @@
vo=wlshm
profile=sw-fast
ytdl-format="bestvideo[height<=?720]+bestaudio/best"

View file

@ -0,0 +1,3 @@
vo=x11
profile=sw-fast
ytdl-format="bestvideo[height<=?720]+bestaudio/best"

View file

@ -0,0 +1 @@
font=monospace:size=16

View file

@ -0,0 +1,5 @@
#!/bin/bash
# A workaround for missing cursor issue
export WLR_NO_HARDWARE_CURSORS=1

View file

@ -0,0 +1,35 @@
if test ${devnum} -eq 2 ; then
echo "Booting from SD";
setenv pmos_boot_dev 1;
else
echo "Booting from eMMC";
setenv pmos_boot_dev 0;
fi;
setenv bootargs console=null pmos_boot=/dev/mmcblk${pmos_boot_dev}p2 pmos_root=/dev/mmcblk${pmos_boot_dev}p3
if test -e mmc ${devnum}:2 exynos5250-snow.dtb; then
echo "Selecting DTB for rev 4";
setenv fdtfile exynos5250-snow.dtb;
else
echo "Selecting DTB for rev 5";
setenv fdtfile exynos5250-snow-rev5.dtb;
fi;
echo Loading DTB
load mmc ${devnum}:2 ${fdt_addr_r} ${fdtfile}
echo Loading Initramfs
load mmc ${devnum}:2 ${ramdisk_addr_r} initramfs
setenv ramdisk_size ${filesize}
echo Loading Kernel
load mmc ${devnum}:2 ${kernel_addr_r} vmlinuz
echo Resizing FDT
fdt addr ${fdt_addr_r}
fdt resize
echo Booting Kernel
bootz ${kernel_addr_r} ${ramdisk_addr_r}:${ramdisk_size} ${fdt_addr_r}

View file

@ -0,0 +1,139 @@
SectionVerb {
Value {
OutputDspName "speaker_eq"
}
EnableSequence [
cdev "hw:SnowI2SMAX98090"
cset "name='Left Speaker Mixer Left DAC Switch' on"
cset "name='Right Speaker Mixer Right DAC Switch' on"
cset "name='Digital EQ 3 Band Switch' off"
cset "name='Digital EQ 5 Band Switch' off"
cset "name='Digital EQ 7 Band Switch' off"
cset "name='Biquad Switch' off"
cset "name='Filter Mode' Music"
cset "name='ADC Oversampling Rate' 0"
cset "name='MIC2 Mux' IN34"
cset "name='DMIC Mux' DMIC"
cset "name='Left ADC Mixer MIC2 Switch' on"
cset "name='Right ADC Mixer MIC2 Switch' on"
cset "name='ADCR Boost Volume' 4"
cset "name='ADCL Boost Volume' 4"
cset "name='ADCR Volume' 11"
cset "name='ADCL Volume' 11"
cset "name='Speaker Left Mixer Volume' 2"
cset "name='Speaker Right Mixer Volume' 2"
cset "name='Record Path DC Blocking' on"
cset "name='Playback Path DC Blocking' on"
cset "name='Speaker Left Switch' off"
cset "name='Speaker Right Switch' off"
cset "name='Headphone Left Switch' off"
cset "name='Headphone Right Switch' off"
]
DisableSequence [
]
}
SectionDevice."Speakers" {
Comment "Speakers"
ConflictingDevice [
"Headphones"
]
EnableSequence [
cset "name='Speaker Left Switch' on"
cset "name='Speaker Right Switch' on"
]
DisableSequence [
cset "name='Speaker Left Switch' off"
cset "name='Speaker Right Switch' off"
]
Value {
PlaybackPCM "hw:${CardId}"
PlaybackChannels 2
PlaybackVolume "Speaker Volume"
}
}
SectionDevice."Headphones" {
Comment "Headphones"
ConflictingDevice [
"Speakers"
]
EnableSequence [
cset "name='Headphone Left Switch' on"
cset "name='Headphone Right Switch' on"
]
DisableSequence [
cset "name='Headphone Left Switch' off"
cset "name='Headphone Right Switch' off"
]
Value {
JackControl "Headphone Jack"
PlaybackPCM "hw:${CardId}"
PlaybackChannels 2
PlaybackVolume "Headphone Volume"
}
}
SectionDevice."InternalMicrophone" {
Comment "Internal Microphone"
ConflictingDevice [
"HeadsetMicrophone"
]
EnableSequence [
cset "name='DMIC Mux' DMIC"
]
DisableSequence [
cset "name='DMIC Mux' ADC"
]
Value {
CapturePCM "hw:${CardId}"
CaptureChannels 2
CaptureVolume "MIC2 Volume"
DefaultNodeGain "-500"
}
}
SectionDevice."HeadsetMicrophone" {
Comment "Headset Microphone"
ConflictingDevice [
"InternalMicrophone"
]
EnableSequence [
cset "name='DMIC Mux' ADC"
]
DisableSequence [
cset "name='DMIC Mux' DMIC"
]
Value {
JackControl "Mic Jack"
CapturePCM "hw:${CardId}"
CaptureChannels 2
CaptureVolume "MIC2 Volume"
DefaultNodeGain "-500"
}
}

View file

@ -0,0 +1,8 @@
Syntax 2
Comment "Google Snow internal card (Maxim 98090)"
SectionUseCase."HiFi" {
File "HiFi.conf"
Comment "Default"
}

53
temp/u-boot-snow/APKBUILD Normal file
View file

@ -0,0 +1,53 @@
# Maintainer: Jenneron <jenneron@protonmail.com>
pkgname=u-boot-snow
pkgver=2022.01
pkgrel=0
pkgdesc="u-boot for Google Snow chromebooks"
url="https://www.denx.de/wiki/U-Boot/"
arch="armv7"
license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause eCos-2.0 IBM-pibs
ISC LGPL-2.0-only LGPL-2.1-only X11"
options="!check" # no tests in upstream
makedepends="$depends_dev bc dtc python3-dev swig bison flex openssl-dev
py3-setuptools linux-headers u-boot-tools vboot-utils"
source="
https://ftp.denx.de/pub/u-boot/u-boot-${pkgver//_/-}.tar.bz2
cve-2017-5715.patch
fix-sd-card-detection.patch
"
builddir="$srcdir"/u-boot-${pkgver//_/-}
prepare() {
default_prepare
}
build() {
make snow_defconfig
make
mkimage -A arm -O linux -T kernel -C none -e 0x43E00000 -a 0x43E00000 -d u-boot-dtb.bin u-boot-dtb.img
echo -e "\n" > dummy_config
echo -e "\n" > dummy_bootloader
vbutil_kernel \
--pack u-boot-dtb.img.kpart \
--keyblock /usr/share/vboot/devkeys/kernel.keyblock \
--signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \
--version 1 \
--arch arm \
--config dummy_config \
--bootloader dummy_bootloader \
--vmlinuz u-boot-dtb.img
}
package() {
install -D -m644 "$builddir"/u-boot-dtb.img.kpart \
"$pkgdir"/usr/share/u-boot/google-snow/u-boot-dtb.img.kpart
}
sha512sums="
d83c62bd8f0f51664d2aca329a3ce1379cfd1dfff439dccd6cfc2cb33cfef89a2b01855c97716f591b5550bfdf99e2f3aef7efa33f2e7834c820648f9eef3825 u-boot-2022.01.tar.bz2
29378f89edc367f8ea2316ed04d0515398442f74bb29cda85f7cd9edc494707e6e27f1a0dd7cc3aa590fd683710b158da92a596b1b94ee4356d26a9a6c0bf27c cve-2017-5715.patch
af1095d82c905aab244845419e9b7bf009a043f3c223bb72c9748edea6093d7bd272dfc0eaf9b6b3882fad2e0cdf3652f6b1d81126f0e9f5fa73f13983577ead fix-sd-card-detection.patch
"

View file

@ -0,0 +1,11 @@
From: jenneron <jenneron@protonmail.com>
diff --git a/configs/snow_defconfig b/configs/snow_defconfig
index e5bac37808..6d75307a6b 100644
--- a/configs/snow_defconfig
+++ b/configs/snow_defconfig
@@ -97,3 +97,4 @@ CONFIG_TPM=y
CONFIG_ERRNO_STR=y
CONFIG_UNIT_TEST=y
# CONFIG_UT_LIB_ASN1 is not set
+CONFIG_ARM_CORTEX_A15_CVE_2017_5715=y

View file

@ -0,0 +1,27 @@
From: hexdump <hexdump0815@googlemail.com>
adjusted according to the kernel timing in arch/arm/boot/dts/exynos5250-snow-common.dtsi
samsung,dw-mshc-ciu-div = <3>;
samsung,dw-mshc-sdr-timing = <2 3>;
samsung,dw-mshc-ddr-timing = <1 2>;
resulting in 2 3 3 for sdr timing + div 3
diff --git a/arch/arm/dts/exynos5250-snow.dts b/arch/arm/dts/exynos5250-snow.dts
index e41f2d3041..67a2ec34d2 100644
--- a/arch/arm/dts/exynos5250-snow.dts
+++ b/arch/arm/dts/exynos5250-snow.dts
@@ -312,8 +312,11 @@
mmc@12220000 {
samsung,bus-width = <4>;
- samsung,timing = <1 2 3>;
+ samsung,timing = <2 3 3>;
samsung,removable = <1>;
+// no-1-8-v;
+// cap-sd-highspeed;
+// card-detect-delay = <500>;
};
mmc@12230000 {