From 83d79ea9145bcadc26b5bf1f1e54784db5a3af43 Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Mon, 13 Jan 2020 19:55:23 -0800 Subject: [PATCH] purism-librem5: new device (Purism Librem 5) (!869) This adds a device package for the Librem 5 phone [ci:skip-build]: already built successfully in CI --- device/device-purism-librem5/00-kwin.sh | 1 + device/device-purism-librem5/00-mesa.sh | 1 + device/device-purism-librem5/APKBUILD | 55 +++++++++++++++++++ .../device-purism-librem5.post-install | 8 +++ device/device-purism-librem5/deviceinfo | 31 +++++++++++ device/device-purism-librem5/flash_script.lst | 23 ++++++++ .../device-purism-librem5/modprobe.d_rsi.conf | 2 + device/device-purism-librem5/uboot-script.cmd | 20 +++++++ 8 files changed, 141 insertions(+) create mode 100644 device/device-purism-librem5/00-kwin.sh create mode 100644 device/device-purism-librem5/00-mesa.sh create mode 100644 device/device-purism-librem5/APKBUILD create mode 100755 device/device-purism-librem5/device-purism-librem5.post-install create mode 100644 device/device-purism-librem5/deviceinfo create mode 100755 device/device-purism-librem5/flash_script.lst create mode 100644 device/device-purism-librem5/modprobe.d_rsi.conf create mode 100644 device/device-purism-librem5/uboot-script.cmd diff --git a/device/device-purism-librem5/00-kwin.sh b/device/device-purism-librem5/00-kwin.sh new file mode 100644 index 000000000..64673d012 --- /dev/null +++ b/device/device-purism-librem5/00-kwin.sh @@ -0,0 +1 @@ +export KWIN_DRM_DEVICE_NODE=/dev/dri/card1 diff --git a/device/device-purism-librem5/00-mesa.sh b/device/device-purism-librem5/00-mesa.sh new file mode 100644 index 000000000..dadf5526b --- /dev/null +++ b/device/device-purism-librem5/00-mesa.sh @@ -0,0 +1 @@ +export ETNA_MESA_DEBUG=no_supertile diff --git a/device/device-purism-librem5/APKBUILD b/device/device-purism-librem5/APKBUILD new file mode 100644 index 000000000..3f36c0cc8 --- /dev/null +++ b/device/device-purism-librem5/APKBUILD @@ -0,0 +1,55 @@ +# Reference: +pkgname="device-purism-librem5" +pkgdesc="Purism Librem 5 Phone" +pkgver=0.9 +pkgrel=0 +url="https://postmarketos.org" +license="MIT" +arch="aarch64" +options="!check !archcheck" +depends="postmarketos-base + linux-purism-librem5 + uboot-tools + u-boot-librem5 + gpsd + mesa-git mesa-git-glapi mesa-git-gl mesa-git-gles mesa-git-egl mesa-git-gbm + mesa-git-dri-etnaviv mesa-git-dri-kmsro + ofono +" +makedepends="devicepkg-dev" +source=" + deviceinfo + uboot-script.cmd + modprobe.d_rsi.conf + 00-mesa.sh + 00-kwin.sh + flash_script.lst +" +subpackages="$pkgname-plasma" +install="$pkgname.post-install" + +build() { + mkimage -A arm64 -C none -O linux -T script -d "$srcdir/uboot-script.cmd" "$srcdir/boot.scr" + devicepkg_build $startdir $pkgname +} + +plasma() { + install_if="$pkgname kwin" + install -D -m644 "$srcdir/00-kwin.sh" "$subpkgdir/etc/profile.d/00-kwin.sh" +} + +package() { + install -D -m644 "$srcdir"/boot.scr \ + "$pkgdir"/boot/boot.scr + install -D -m644 "$srcdir/modprobe.d_rsi.conf" "$pkgdir/etc/modprobe.d/rsi.conf" + install -D -m644 "$srcdir/00-mesa.sh" "$pkgdir/etc/profile.d/00-mesa.sh" + install -D -m644 "$srcdir/flash_script.lst" "$pkgdir/usr/share/uuu/flash_script.lst" + devicepkg_package $startdir $pkgname +} + +sha512sums="79121c475a5a957625bfa72e1d1f0e262e0abece703e9efa8c26522725d025625d49c003375ae6af3422eb25540de46196c8f5aab130e76014b630560f4c080b deviceinfo +3bc45540000e438e525501b2e816282d778fca10d426e42c9a80c0e752618ce50deb12c3edd9f3edc52edd8eb229d16afae7d407fe2c4ba0dbfefbcb4214780c uboot-script.cmd +d10531ad6646ad6cfaf8ee1b0cc38f4e5e2eb39599251b75f25e954f1105761d5480d92cbe06ad52560207b883439071db89b19babf046a810360bd07c52c655 modprobe.d_rsi.conf +5fdf45859f2bb154bcfe7c7341de4d5b239ef43d3f865e30456af073a8ee9d6682515c7e1dd52ddbe3969669d60689ba93c08ead32aadcfb164ff72a02b2e1a4 00-mesa.sh +685ec71484a932c59f83f1039d4d18a010a5849342e96d9e15ae8ce64374aac15073f9c51d7d9f270c60e70d2ea15c685b8f528cdc40f991b093b9227cba6a48 00-kwin.sh +d033df2b9125622c946af67dad83070473c86937b5825f57ad272c9145b594071dd6913949127803c45af4ea3226526551718d40739f9f1ee4bfe6446e62c856 flash_script.lst" diff --git a/device/device-purism-librem5/device-purism-librem5.post-install b/device/device-purism-librem5/device-purism-librem5.post-install new file mode 100755 index 000000000..da27dde59 --- /dev/null +++ b/device/device-purism-librem5/device-purism-librem5.post-install @@ -0,0 +1,8 @@ +#!/bin/sh + +# Enable GPS support +rc-update add gpsd default +sed -i 's/DEVICE=\"\"/DEVICE=\"\/dev\/ttymxc2\"/' /etc/conf.d/gpsd +sed -i 's/BAUDRATE=\"4800\"/BAUDRATE=\"9600\"/' /etc/conf.d/gpsd + +rc-update add ofono default diff --git a/device/device-purism-librem5/deviceinfo b/device/device-purism-librem5/deviceinfo new file mode 100644 index 000000000..5df321012 --- /dev/null +++ b/device/device-purism-librem5/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="Purism Librem 5 Phone" +deviceinfo_manufacturer="Purism" +deviceinfo_codename="purism-librem5" +deviceinfo_date="" +deviceinfo_dtb="freescale/imx8mq-librem5" +deviceinfo_append_dtb="false" +deviceinfo_modules_initfs="" +deviceinfo_arch="aarch64" + +# Device related +deviceinfo_keyboard="false" +deviceinfo_external_storage="true" +deviceinfo_screen_width="720" +deviceinfo_screen_height="1440" +deviceinfo_dev_touchscreen="" +deviceinfo_dev_touchscreen_calibration="" +deviceinfo_dev_keyboard="" +deviceinfo_no_framebuffer="true" +# The following is required since this device has builtin ethernet +deviceinfo_disable_dhcpd="true" +deviceinfo_getty="ttymxc0;115200" + +# Bootloader related +deviceinfo_flash_method="uuu" +deviceinfo_generate_legacy_uboot_initfs="true" +deviceinfo_sd_embed_firmware="firmware/librem5/phone-boot.img:2" +deviceinfo_boot_part_start="4096" diff --git a/device/device-purism-librem5/flash_script.lst b/device/device-purism-librem5/flash_script.lst new file mode 100755 index 000000000..169a25d58 --- /dev/null +++ b/device/device-purism-librem5/flash_script.lst @@ -0,0 +1,23 @@ +uuu_version 1.0.1 + +# Note: This script is meant to be used by uuu running in the native chroot, so +# all paths are relative to the native chroot and not to the device rootfs +# chroot. + +SDP: boot -f /mnt/rootfs_purism-librem5/usr/share/firmware/librem5/phone-boot.img + +SDPU: delay 1000 +SDPU: write -f /mnt/rootfs_purism-librem5/usr/share/firmware/librem5/phone-boot.img -offset 0x57c00 +SDPU: jump + +SDPV: delay 1000 +SDPV: write -f /mnt/rootfs_purism-librem5/usr/share/firmware/librem5/phone-boot.img -skipspl +SDPV: jump + +SDPS: boot -f /mnt/rootfs_purism-librem5/usr/share/firmware/librem5/phone-boot.img + +FB: ucmd mmc dev 0 +FB: ucmd setenv fastboot_dev mmc +FB: ucmd setenv mmcdev 0 +FB: flash -raw2sparse all /home/pmos/rootfs/purism-librem5.img +FB: Done diff --git a/device/device-purism-librem5/modprobe.d_rsi.conf b/device/device-purism-librem5/modprobe.d_rsi.conf new file mode 100644 index 000000000..4f4bca98d --- /dev/null +++ b/device/device-purism-librem5/modprobe.d_rsi.conf @@ -0,0 +1,2 @@ +# This disables bluetooth, but enables wifi. +options rsi_91x dev_oper_mode=13 rsi_zone_enabled=1 diff --git a/device/device-purism-librem5/uboot-script.cmd b/device/device-purism-librem5/uboot-script.cmd new file mode 100644 index 000000000..b4cb8a87b --- /dev/null +++ b/device/device-purism-librem5/uboot-script.cmd @@ -0,0 +1,20 @@ +setenv bootargs init=/init.sh rw console=ttymxc0,115200 cma=256M PMOS_NO_OUTPUT_REDIRECT PMOS_FORCE_PARTITION_RESIZE +setenv mmcdev 0 +setenv mmcpart 1 + +printenv +echo Loading DTB +ext2load mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} imx8mq-librem5.dtb + +echo Loading Initramfs +ext2load mmc ${mmcdev}:${mmcpart} ${ramdisk_addr_r} uInitrd-purism-librem5 + +echo Loading Kernel +ext2load mmc ${mmcdev}:${mmcpart} ${kernel_addr_r} vmlinuz-purism-librem5 + +echo Resizing FDT +fdt addr ${fdt_addr_r} +fdt resize + +echo Booting kernel +booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}