## Recovery Mode
```
adb reboot recovery
```
Ensure Phone is Off, Hold Volume Up + Power, Release as soon as the Samsung logo shows up, (Also release when warning about unsafe software etc. is shown)

## Download Mode
Hold Volume Up + Volume Down and plug USB cable into device; hold until download mode visible

## Unlock Bootloader
Enable OEM Unlocking in Android Developer Options, Enter Download Mode, Hold Volume Up, accept with Volume Up

## Installation (WIP)
```bash
pmbootstrap install --no-recommends --android-recovery-zip --password pw --zap --recovery-install-partition super
```

## Create empty dtbo partition file
```bash
avbtool add_hash_footer --partition_name dtbo --partition_size 2621440 --image empty_dtbo.img
```

## Dump kernel values through debugfs
```bash
mount -t debugfs debugfs /sys/kernel/debug
ls -lah /sys/kernel/debug # A lot of values here can be copied/dumped
```

## Fix bluetooth after reboot
```bash
sudo btmgmt --index 0 public-addr 00:11:22:33:44:55
```
NOTE: `bluez-btmgmt` must be installed

## Enable Internet over USB
(see https://wiki.postmarketos.org/wiki/USB_Internet)
### Host
```bash
sysctl net.ipv4.ip_forward=1
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -s 172.16.42.0/24 -j ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE -s 172.16.42.0/24
iptables-save
```
### Device
```bash
ip route add default via 172.16.42.2 dev usb0
echo nameserver 1.1.1.1 > /etc/resolv.conf
echo 'ip route add default via 172.16.42.2 dev usb0' > /etc/local.d/usb_internet.start
chmod +x /etc/local.d/usb_internet.start
rc-update add local
```

## Notes
- `&pdc` implies +480 when using `&intc`
- Regarding GPI DMA issue: https://oftc.irclog.whitequark.org/linux-msm/2023-11-26 (and following days)

## Misc. Links
- https://softhandtech.com/what-is-ffbm-mode-in-android/
- https://wiki.postmarketos.org/wiki/Samsung_Galaxy_S24_Ultra_(samsung-e3q)
- https://wiki.postmarketos.org/wiki/Samsung_Galaxy_A52_4G_(samsung-a52q)
- https://github.com/JamiKettunen/qcom-fw-setup
