Skip to content

Instantly share code, notes, and snippets.

Avatar

Satadru Pramanik satmandu

View GitHub Profile
@satmandu
satmandu / chromeos_docker.sh
Last active Aug 5, 2021
Updated ChromeOS docker container script
View chromeos_docker.sh
#!/bin/bash
# chromeos_docker.sh
# Usage:
# chromeos_docker.sh recoveryfileurl name milestone arch
# or if image.bin already exists this works too:
# chromeos_docker.sh dummy name milestone arch
# (Default is not to delete the image after download.)
# e.g.
# Example for x86_64:
# chromeos_docker.sh https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_13816.82.0_nocturne_recovery_stable-channel_mp.bin.zip nocturne 90 x86_64
@satmandu
satmandu / gcc10.rb
Created Apr 14, 2021
gcc 10.3.0 chromebrew package WIP
View gcc10.rb
require 'package'
class Gcc10 < Package
description 'The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Ada, and Go.'
homepage 'https://www.gnu.org/software/gcc/'
version '10.3.0'
@isl_ver = '0.23'
compatibility 'all'
license 'GPL-3'
source_url 'https://gcc.gnu.org/pub/gcc/releases/gcc-10.3.0/gcc-10.3.0.tar.xz'
@satmandu
satmandu / getdeps
Last active Mar 25, 2021
Chromebrew get actual runtime dependencies for a package
View getdeps
#!/bin/env bash
# set -x
pkg="${1}"
CREW_LIB_PREFIX=$(crew const | grep CREW_LIB_PREFIX | awk -F = '{print $2}')
# Which packages have a needed library in CREW_LIB_PREFIX
# This is a subset of what crew whatprovides gives
whatprovidesfxn() {
pkgdepslcl="${1}"
filelcl=$(grep "$pkgdepslcl" /usr/local/etc/crew/meta/*.filelist | grep $CREW_LIB_PREFIX)
@satmandu
satmandu / llvm.rb
Last active Dec 19, 2020
llvm 11.0.1-rc2 for chromebrew
View llvm.rb
require 'package'
class Llvm < Package
description 'The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. The optional packages clang, lld, lldb, polly, compiler-rt, libcxx, libcxxabi and openmp are included.'
homepage 'http://llvm.org/'
version '11.0.1-rc2'
compatibility 'all'
source_url 'https://github.com/llvm/llvm-project/archive/llvmorg-11.0.1-rc2.tar.gz'
source_sha256 'c217780b9903eabf0fdb8ed227ae50b623d3f82afb9ac36beffbc81acbc6ff6c'
@satmandu
satmandu / zfs_build
Last active Jan 9, 2021
Compiles zfs 2.0.1 for ubuntu & debian systems (tested on x86_64 [groovy] and arm64 [raspi_os]). Not tested with zsys. . In a new folder do this to make zfs debs: curl -OLf https://gist.github.com/satmandu/3aebcd7d26cdc588b40af29f1be6009c/raw/8bd4ce4dc67ba258b9b6f613c1b604fdade9e552/zfs_build && chmod +x zfs_build && ./zfs_build
View zfs_build
#!/bin/bash -x
main () {
VER=10
export CC="ccache gcc-${VER}"
export CXX="ccache g++-${VER}"
export SHLIB_CXXLD="g++-${VER}"
#FC="ccache gfortran"
#F77="ccache gfortran"
zfs_work="$(pwd)/$(uname -m)"
mkdir -p "${zfs_work}"
@satmandu
satmandu / chromeos_docker.sh
Last active Mar 16, 2021
Docker buildx based package builder for Chromebrew on x86_64, i686, & armv7l. (armv7l only tested on Raspberry PI) Put both files in the same folder.
View chromeos_docker.sh
#!/bin/bash
# chromeos_docker.sh
# Usage:
# chromeos_docker.sh recoveryfileurl name milestone arch
# or if image.bin already exists this works too:
# chromeos_docker.sh dummy name milestone arch
# (Default is not to delete the image after download.)
# e.g.
# Example for x86_64:
# chromeos_docker.sh https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_13505.73.0_nocturne_recovery_stable-channel_mp.bin.zip nocturne 87 x86_64
@satmandu
satmandu / sommelier.rb
Last active Oct 19, 2020
WIP Platform2 Sommelier for chromebrew
View sommelier.rb
require 'package'
class Sommelier < Package
description 'Sommelier works by redirecting X11 and Wayland programs to the built-in ChromeOS wayland server.'
homepage 'https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/vm_tools/sommelier/'
version '2237607'
compatibility 'all'
source_url 'https://chromium-review.googlesource.com/changes/chromiumos%2Fplatform2~2237607/revisions/10/patch?zip&path=%2FCOMMIT_MSG'
source_sha256 '0dda9635fe947383e0a4abc573a289acbd81e07115dbb1aaafcc7f3b85a35d6a'
@satmandu
satmandu / arch2crew
Last active Mar 9, 2021
Script to help with creating Chromebrew package files from Arch Linux PKGBUILD files
View arch2crew
#!/bin/bash -x
# arch2crew
# Script to help with creating Chromebrew package files from Arch Linux PKGBUILD files
# Assumes rubocop is installed via "gem install rubocop"
# Usage: arch2crew <Arch Linux package name>
# Satadru Pramanik <satadru@gmail.com>
#
archpkgname="${1}"
# Initial setup
@satmandu
satmandu / dpcd_pixel_slate.patch
Last active May 29, 2021
Patch to make backlight work for nocturne/Pixel Slate (and maybe also eve) with linux kernel 5.12
View dpcd_pixel_slate.patch
diff -Npaur a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
--- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c 2021-05-07 18:57:14.612178675 -0400
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c 2021-05-07 18:58:15.107279925 -0400
@@ -593,7 +593,6 @@ intel_dp_aux_supports_vesa_backlight(str
* work just fine using normal PWM controls anyway.
*/
if (intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP &&
- (intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) &&
(intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP)) {
drm_dbg_kms(&i915->drm, "AUX Backlight Control Supported!\n");
@satmandu
satmandu / usbtrim
Last active Jun 27, 2020
Detect and enable trim for usb-connected sata/nvme drives in initramfs/initrd, ideally before zfs modules load.
View usbtrim
#!/bin/bash
# This goes in /usr/share/initramfs-tools/hooks/usbtrim
case $1 in
prereqs)
echo "udev"
exit 0
;;
esac