Add command to build and flash kernel

This commit is contained in:
Waldemar Tomme 2024-12-27 20:27:48 +01:00
parent d511a82b0c
commit e5d44e8db5
3 changed files with 49 additions and 2 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
/debug/
/tools/
/.cache/
/.repos/

24
dev/NOTES.md Normal file
View File

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

View File

@ -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
'')
];
};