From 21adc7b24b4f936a57d878d86585018de4ae72b1 Mon Sep 17 00:00:00 2001 From: Waldemar Tomme Date: Tue, 7 Jan 2025 20:24:14 +0100 Subject: [PATCH] Add android build environment --- dev/NOTES.md | 7 ++++ dev/default.nix | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) diff --git a/dev/NOTES.md b/dev/NOTES.md index 55a8962..8a254d4 100644 --- a/dev/NOTES.md +++ b/dev/NOTES.md @@ -11,6 +11,13 @@ samsung-a715f:~$ cat /proc/interrupts | grep -i i2c samsung-a715f:~$ cat /proc/interrupts | grep -i dma 133: 1061 0 0 0 0 0 0 0 GICv3 311 Level gpi-dma + +samsung-a715f:~# cat /sys/kernel/debug/dmaengine/summary +dma0 (800000.dma-controller): number of channels: 8 + +dma1 (a00000.dma-controller): number of channels: 8 + dma1chan0 | a84000.i2c:tx + dma1chan1 | a84000.i2c:rx ``` ### Android diff --git a/dev/default.nix b/dev/default.nix index 844aa5f..b8e5398 100644 --- a/dev/default.nix +++ b/dev/default.nix @@ -27,12 +27,97 @@ ''; # rootDir = builtins.toString ./..; rootDir = "."; # Assume PWD as root for now + + android-toolchain = pkgs.fetchGit { + url = ""; + rev = "main"; + }; + android-fhs = pkgs.buildFHSUserEnv { + name = "android-env"; + targetPkgs = pkgs: with pkgs; [ + android-tools + libxcrypt-legacy # libcrypt.so.1 + freetype # libfreetype.so.6 + fontconfig # java NPE: "sun.awt.FontConfiguration.head" is null + yaml-cpp # necessary for some kernels according to a comment on the gist + + # Some of the packages here are probably unecessary but I don't wanna figure out which + bc + binutils + bison + ccache + curl + flex + gcc + git + git-repo + git-lfs + gnumake + gnupg + gperf + imagemagick + jdk11 + elfutils + libxml2 + libxslt + lz4 + lzop + m4 + nettools + openssl.dev + perl + pngcrush + procps + python3 + rsync + schedtool + SDL + squashfsTools + unzip + util-linux + xml2 + zip + + # only necessary if you wanna use `runScript = "zsh";` below + zsh + ]; + multiPkgs = pkgs: with pkgs; [ + zlib + ncurses5 + libcxx + readline + + libgcc # crtbeginS.o + iconv # ??? - i put this here and by the time i went back to remove unecessary packages i forgot why + iconv.dev # sys/types.h + ]; + runScript = "bash"; + profile = '' + export ALLOW_NINJA_ENV=true + export USE_CCACHE=1 + export CCACHE_EXEC=/usr/bin/ccache + export ANDROID_JAVA_HOME=${pkgs.jdk11.home} + # Building involves a phase of unzipping large files into a temporary directory + export TMPDIR=/tmp + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.ncurses5}/lib + ''; + }; + # android-fhs-shell = pkgs.stdenv.mkDerivation { + # name = "android-env-shell"; + # nativeBuildInputs = [ + # android-fhs + # ]; + # shellHook = "exec android-env"; + # dontUnpack = true; + # }; in pkgs.mkShell { packages = with pkgs; [ (python3.withPackages (pypi: with pypi; [ libfdt ])) + android-fhs + (writeShellScriptBin "flash-lineage-magisk" '' rootDir="${rootDir}" lineageBootImg="$rootDir/.cache/lineageos-magisk-boot.img" @@ -81,6 +166,7 @@ rootDir="${rootDir}" mkdir -p "$rootDir/.repos" [[ -d "$rootDir/.repos/mainline-kernel" ]] || git clone git@github.com:WiiPlayer2/linux-sm7150.git "$rootDir/.repos/mainline-kernel" + # [[ -d "$rootDir/.repos/android-kernel" ]] || git clone ssh://git@git.web.home.dark-link.info:2222/a71-pmos/android-kernel-a71.git "$rootDir/.repos/android-kernel" '') (writeScriptBin "build-and-flash-kernel" '' #!/usr/bin/env bash