Add android build environment

This commit is contained in:
Waldemar Tomme 2025-01-07 20:24:14 +01:00
parent 4382f8ea78
commit 21adc7b24b
2 changed files with 93 additions and 0 deletions

View File

@ -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

View File

@ -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