From e5d44e8db5beef4885216d8716a755d8b00244b7 Mon Sep 17 00:00:00 2001 From: Waldemar Tomme Date: Fri, 27 Dec 2024 20:27:48 +0100 Subject: [PATCH] Add command to build and flash kernel --- .gitignore | 1 + dev/NOTES.md | 24 ++++++++++++++++++++++++ dev/default.nix | 26 ++++++++++++++++++++++++-- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 dev/NOTES.md diff --git a/.gitignore b/.gitignore index b09e271..0ddcaf5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /debug/ /tools/ /.cache/ +/.repos/ diff --git a/dev/NOTES.md b/dev/NOTES.md new file mode 100644 index 0000000..55a8962 --- /dev/null +++ b/dev/NOTES.md @@ -0,0 +1,24 @@ +### postmarketOS + +The dma counter only increased when probing i2c7 (the not working one). Could be either that this i2c uses dma to transfer and it does not work or its a fault interrupt. + +``` +samsung-a715f:~$ cat /proc/interrupts | grep -i i2c +137: 72 0 0 0 0 0 0 0 GICv3 633 Level 880000.i2c +138: 72 0 0 0 0 0 0 0 GICv3 635 Level 888000.i2c +141: 0 0 0 0 0 0 0 0 GICv3 386 Level a84000.i2c +142: 120 0 0 0 0 0 0 0 GICv3 388 Level a8c000.i2c + +samsung-a715f:~$ cat /proc/interrupts | grep -i dma +133: 1061 0 0 0 0 0 0 0 GICv3 311 Level gpi-dma +``` + +### Android +``` +a71:/ # cat /proc/interrupts | grep -i -e dma -e i2c + 18: 1141 0 0 0 0 0 0 0 PDC-GIC 311 Level gpi_dmaa00000_gpii0 +114: 941 0 0 0 0 0 0 0 PDC-GIC 633 Level i2c_geni +115: 1198 0 0 0 0 0 0 0 PDC-GIC 635 Level i2c_geni +119: 0 0 0 0 0 0 0 0 PDC-GIC 386 Level i2c_geni +139: 0 0 0 0 0 0 0 0 PDC-GIC 507 Edge jpegdma +``` diff --git a/dev/default.nix b/dev/default.nix index 8ec405c..cbdc8ba 100644 --- a/dev/default.nix +++ b/dev/default.nix @@ -26,6 +26,7 @@ ${pkgs.android-tools}/bin/avbtool add_hash_footer --partition_name dtbo --partition_size 2621440 --image $out/empty_dtbo.img ''; # rootDir = builtins.toString ./..; + rootDir = "."; # Assume PWD as root for now in pkgs.mkShell { packages = with pkgs; [ @@ -33,7 +34,7 @@ libfdt ])) (writeShellScriptBin "flash-lineage-magisk" '' - rootDir="." # Assume PWD as root for now + rootDir="${rootDir}" lineageBootImg="$rootDir/.cache/lineageos-magisk-boot.img" if [[ ! -e "$lineageBootImg" ]]; then @@ -73,7 +74,28 @@ heimdall flash \ --no-reboot \ --DTBO ${emptyDtbo}/empty_dtbo.img - pmbootstrap flasher --method heimdall-bootimg --resume flash_kernel + # does not work for some reason + # pmbootstrap flasher --method heimdall-bootimg --resume flash_kernel + '') + (writeShellScriptBin "init-repositories" '' + rootDir="${rootDir}" + mkdir -p "$rootDir/.repos" + [[ -d "$rootDir/.repos/mainline-kernel" ]] || git clone git@github.com:WiiPlayer2/linux-sm7150.git "$rootDir/.repos/mainline-kernel" + '') + (writeScriptBin "build-and-flash-kernel" '' + #!/usr/bin/env -S bash -e + rootDir="${rootDir}" + pmbootstrap --version + pushd $rootDir/.repos/mainline-kernel + trap "popd" EXIT + source $(pmbootstrap-envkernel) + if [[ ! -e ".output/.config" ]]; then + make defconfig sm7150.config + fi + make -j$(nproc) + pmbootstrap build --envkernel linux-postmarketos-qcom-sm7150 + pmbootstrap flasher --method fastboot flash_kernel + fastboot reboot '') ]; };