From 4dfa72c680d2a7fcaa54cbfa78d8501ef623cbfc Mon Sep 17 00:00:00 2001 From: Anton Bambura Date: Sat, 18 Jun 2022 18:15:33 +0300 Subject: [PATCH] google-nyan-big: new device (MR 3325) Co-Authored-By: Segfault [ci:skip-build]: already built successfully in CI --- .../30-xusb-firmware.files | 1 + .../testing/device-google-nyan-big/APKBUILD | 126 ++++++++++++++++++ .../testing/device-google-nyan-big/deviceinfo | 29 ++++ .../modprobe.d/gpu.conf | 1 + .../mpv/mpv.conf.wayland | 3 + .../device-google-nyan-big/mpv/mpv.conf.xorg | 3 + .../sway/tinydm/10-no-hardware-cursor.sh | 5 + .../device-google-nyan-big/uboot-script.cmd | 30 +++++ 8 files changed, 198 insertions(+) create mode 100644 device/testing/device-google-nyan-big/30-xusb-firmware.files create mode 100644 device/testing/device-google-nyan-big/APKBUILD create mode 100644 device/testing/device-google-nyan-big/deviceinfo create mode 100644 device/testing/device-google-nyan-big/modprobe.d/gpu.conf create mode 100644 device/testing/device-google-nyan-big/mpv/mpv.conf.wayland create mode 100644 device/testing/device-google-nyan-big/mpv/mpv.conf.xorg create mode 100644 device/testing/device-google-nyan-big/sway/tinydm/10-no-hardware-cursor.sh create mode 100644 device/testing/device-google-nyan-big/uboot-script.cmd diff --git a/device/testing/device-google-nyan-big/30-xusb-firmware.files b/device/testing/device-google-nyan-big/30-xusb-firmware.files new file mode 100644 index 000000000..e0ba8dce5 --- /dev/null +++ b/device/testing/device-google-nyan-big/30-xusb-firmware.files @@ -0,0 +1 @@ +/lib/firmware/nvidia/tegra124/xusb.bin diff --git a/device/testing/device-google-nyan-big/APKBUILD b/device/testing/device-google-nyan-big/APKBUILD new file mode 100644 index 000000000..4da6dda32 --- /dev/null +++ b/device/testing/device-google-nyan-big/APKBUILD @@ -0,0 +1,126 @@ +# Reference: +# Maintainer: Segfault +# Co-Maintainer: Jenneron +pkgname=device-google-nyan-big +pkgdesc="Acer Chromebook 13 CB5-311 / Acer Chromebook C810" +pkgver=1 +pkgrel=0 +url="https://postmarketos.org" +license="MIT" +arch="armv7" +options="!check !archcheck" +depends=" + alsa-ucm-conf + mesa-dri-gallium + postmarketos-base +" +subpackages=" + $pkgname-kernel-nyan-big-2gb:kernel_nyan_big_2gb + $pkgname-kernel-nyan-big-2gb-fhd:kernel_nyan_big_4gb_fhd + $pkgname-kernel-nyan-big-4gb:kernel_nyan_big_4gb + $pkgname-kernel-nyan-big-4gb-fhd:kernel_nyan_big_4gb_fhd + $pkgname-mpv-wayland:mpv_wayland + $pkgname-mpv-xorg:mpv_xorg + $pkgname-nonfree-firmware:nonfree_firmware + $pkgname-sway +" +makedepends="devicepkg-dev u-boot-tools" +source=" + 30-xusb-firmware.files + deviceinfo + modprobe.d/gpu.conf + mpv/mpv.conf.wayland + mpv/mpv.conf.xorg + sway/tinydm/10-no-hardware-cursor.sh + uboot-script.cmd +" + +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 nouveau as it is in very bad condition + install -Dm644 "$srcdir"/gpu.conf \ + "$pkgdir"/etc/modprobe.d/gpu.conf + + # U-Boot script + install -Dm644 "$srcdir"/boot.scr \ + "$pkgdir"/boot/boot.scr +} + +kernel_nyan_big_2gb() { + pkgdesc="Google Nyan Big (2 GB)" + depends="linux-google-nyan u-boot-nyan-2gb" + devicepkg_subpackage_kernel $startdir $pkgname $subpkgname +} + +kernel_nyan_big_2gb_fhd() { + pkgdesc="Google Nyan Big (2 GB, FullHD)" + depends="linux-google-nyan u-boot-nyan-2gb" + devicepkg_subpackage_kernel $startdir $pkgname $subpkgname +} + +kernel_nyan_big_4gb() { + pkgdesc="Google Nyan Big (4 GB)" + depends="linux-google-nyan u-boot-nyan-4gb" + devicepkg_subpackage_kernel $startdir $pkgname $subpkgname +} + +kernel_nyan_big_4gb_fhd() { + pkgdesc="Google Nyan Big (4 GB, FullHD)" + depends="linux-google-nyan u-boot-nyan-4gb" + 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, USB and GPU firmware" + depends="linux-firmware-mrvl linux-firmware-nvidia" + mkdir "$subpkgdir" + + # Firmware needed to boot from USB + install -Dm644 "$srcdir"/30-xusb-firmware.files \ + "$subpkgdir"/etc/postmarketos-mkinitfs/files/30-xusb-firmware.files +} + +sway() { + install_if="$pkgname=$pkgver-r$pkgrel postmarketos-ui-sway" + install -Dm755 "$srcdir"/10-no-hardware-cursor.sh \ + "$subpkgdir"/etc/tinydm.d/env-wayland.d/10-no-hardware-cursor.sh +} + +sha512sums=" +793688374d77efaf050c187d296d7fd55243773a1257b4d8adfa4cda50d4c0cacc035fb3d419a4b608989ed920636048680d900afe8a712f2166edf51552087a 30-xusb-firmware.files +0d63dbe93ab173a3939edb2b2226ddd8b4a20757053938df3538134ffa21ba218d048387e761b7a4f83f71cf906f976b6cd694e8c0b2ea7434e7ab2598b9392b deviceinfo +e6c5382b6f7dd10f350136d65a714de3ae337978c3ca88e63f016b4a42be87b422d2388fbf6d6a2feba15516fb9b409f6c5ff08968829e6fc2d1e8aeb9d3c508 gpu.conf +8f9dc3c7caeab6c5321dc2bf498f1a03a793f23cb776763316bc356b9d433d7a3337e61154069464dcda200bf390b99f3be8f657a40c6d2f6be3cbc6fb751080 mpv.conf.wayland +d6bc39df48ba0e985a796426039205335adf1c91b9c150b05a4239339fc78b1748b3a83c699de69e9a5829f29573a323f40788da58ed15b1951de1eab7e31c3d mpv.conf.xorg +78e566bf3a597b9b5f73f686feb93ae61d1bed350366428d74c7735f1f82ab390f47ba9deb9d21e8dfcee251dc6178956838ca1b34838bb0a7d740be0e2c8330 10-no-hardware-cursor.sh +1a4362e2c1d4eb6f7cf10d7131c1ea91b1e82836b23e2e90c1cae3b13ca77118d46f033b74a1e1281eaab19382985681816500b7a4987ec9979a50f51e5ec238 uboot-script.cmd +" diff --git a/device/testing/device-google-nyan-big/deviceinfo b/device/testing/device-google-nyan-big/deviceinfo new file mode 100644 index 000000000..09f4983de --- /dev/null +++ b/device/testing/device-google-nyan-big/deviceinfo @@ -0,0 +1,29 @@ +# Reference: +# Please use double quotes only. You can source this file in shell +# scripts. + +deviceinfo_format_version="0" +deviceinfo_name="Acer Chromebook 13 CB5-311 / Acer Chromebook C810" +deviceinfo_manufacturer="Acer" +deviceinfo_codename="google-nyan-big" +deviceinfo_year="2014" +deviceinfo_arch="armv7" +deviceinfo_dtb_nyan_big_2gb="tegra124-nyan-big" +deviceinfo_dtb_nyan_big_2gb_fhd="tegra124-nyan-big-fhd" +deviceinfo_dtb_nyan_big_4gb="tegra124-nyan-big" +deviceinfo_dtb_nyan_big_4gb_fhd="tegra124-nyan-big-fhd" +deviceinfo_modules_initfs="cros-ec cros-ec-spi cros-ec-keyb" + +# Device related +deviceinfo_chassis="laptop" +deviceinfo_keyboard="true" +deviceinfo_external_storage="true" +deviceinfo_screen_width="1366" +deviceinfo_screen_height="768" +deviceinfo_gpu_accelerated="true" + +# Bootloader related +deviceinfo_flash_method="none" +deviceinfo_cgpt_kpart="/usr/share/u-boot/google-nyan-big/u-boot-dtb.img.kpart" +deviceinfo_cgpt_kpart_start="8192" +deviceinfo_cgpt_kpart_size="32768" diff --git a/device/testing/device-google-nyan-big/modprobe.d/gpu.conf b/device/testing/device-google-nyan-big/modprobe.d/gpu.conf new file mode 100644 index 000000000..31075c0dd --- /dev/null +++ b/device/testing/device-google-nyan-big/modprobe.d/gpu.conf @@ -0,0 +1 @@ +blacklist nouveau diff --git a/device/testing/device-google-nyan-big/mpv/mpv.conf.wayland b/device/testing/device-google-nyan-big/mpv/mpv.conf.wayland new file mode 100644 index 000000000..554066f60 --- /dev/null +++ b/device/testing/device-google-nyan-big/mpv/mpv.conf.wayland @@ -0,0 +1,3 @@ +vo=wlshm +profile=sw-fast +ytdl-format="bestvideo[height<=?720]+bestaudio/best" diff --git a/device/testing/device-google-nyan-big/mpv/mpv.conf.xorg b/device/testing/device-google-nyan-big/mpv/mpv.conf.xorg new file mode 100644 index 000000000..3a7296eae --- /dev/null +++ b/device/testing/device-google-nyan-big/mpv/mpv.conf.xorg @@ -0,0 +1,3 @@ +vo=x11 +profile=sw-fast +ytdl-format="bestvideo[height<=?720]+bestaudio/best" diff --git a/device/testing/device-google-nyan-big/sway/tinydm/10-no-hardware-cursor.sh b/device/testing/device-google-nyan-big/sway/tinydm/10-no-hardware-cursor.sh new file mode 100644 index 000000000..4e5253eca --- /dev/null +++ b/device/testing/device-google-nyan-big/sway/tinydm/10-no-hardware-cursor.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# A workaround for missing cursor issue + +export WLR_NO_HARDWARE_CURSORS=1 diff --git a/device/testing/device-google-nyan-big/uboot-script.cmd b/device/testing/device-google-nyan-big/uboot-script.cmd new file mode 100644 index 000000000..680e4168d --- /dev/null +++ b/device/testing/device-google-nyan-big/uboot-script.cmd @@ -0,0 +1,30 @@ +if test ${devtype} = "usb" ; then + setenv bootargs console=tty1 PMOS_NO_OUTPUT_REDIRECT; +else + setenv bootargs console=tty1 PMOS_NO_OUTPUT_REDIRECT pmos_boot=/dev/mmcblk${devnum}p2 pmos_root=/dev/mmcblk${devnum}p3; +fi; + +if test -e ${devtype} ${devnum}:2 tegra124-nyan-big.dtb; then + echo "Selecting DTB for 1366x768 panel"; + setenv fdtfile tegra124-nyan-big.dtb; +else + echo "Selecting DTB for 1920x1080 panel"; + setenv fdtfile tegra124-nyan-big-fhd.dtb; +fi; + +echo Loading DTB +load ${devtype} ${devnum}:2 ${fdt_addr_r} ${fdtfile} + +echo Loading Initramfs +load ${devtype} ${devnum}:2 ${ramdisk_addr_r} initramfs +setenv ramdisk_size ${filesize} + +echo Loading Kernel +load ${devtype} ${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}