Installing pmOS on the Samsung A52 4G
Unlocking the bootloader
- set up the Android phone.
- connect to Wi-Fi (mandatory for
OEM unlocking option to show up) - navigate to the phone’s settings
- all the way at the bottom press on
About Phone - click on
Software Informationand click 7 times onBuild numberuntil the phone states:Developer mode has been enabled. - press
backtwice and scroll down toDeveloper Options - enable
OEM unlockingandUSB debugging. IfOEM unlockingis not there, reboot the phone and try again.
Installation Heimdall
Two options: use the version provided by your OS, or compile from scratch if your OS does not provide a heimdall binary, or if this binary is too old. We need at least v2.2.2.
OS version
On Debian (for instance):
sudo apt install heimdall-flash
Compilation
Upstream project is located at https://git.sr.ht/~grimler/heimdall. Compilation steps:
git clone https://git.sr.ht/~grimler/Heimdall
cd Heimdall
mkdir build && cd build
cmake -DDISABLE_FRONTEND=ON ..
make -j$(nproc)
You can copy the resulting heimdall binary to your $PATH (e.g. cp bin/heimdall ~/.local/bin/). or you can sudo make install and heimdall will be installed system-wide in /usr/local/bin.
postmarketOS (pmbootstrap)
installing pmbootstrap
Follow the steps on the pmOS wiki
bootstrapping
Run pmbootstrap init for a random device (samsung a5) and set it up.
after that I followed newbytes instructions:
cd $(pmbootstrap config aports)
git fetch origin
git switch newbyte/a52-v25.12
Run pmbootstrap init again. Now you are able to select a52q. Pick the following options:
Channel [v25.12]: v25.12
Vendor [samsung]: samsung
Device codename [a5]: a52q
Username [user]: user
Provider [default]: pulseaudio
Provider [default]: wpa_supplicant
User interface [none]: none
Install systemd [default]: default
Change them? (y/n) [n]: n
Extra packages [openssh]: openssh
Use this timezone instead of GMT? (y/n) [y]: y
Locale [en_US]: en_US
Device hostname [samsung-a52q]: unbrick01
Would you like to copy these public keys to the device? (y/n) [n]: n
Build outdated packages during 'pmbootstrap install'? (y/n) [y]: y
Zap existing chroots to apply configuration? (y/n) [y]: y
installing pmOS
After this boot your device into Download Mode. You can get in Download Mode by fully powering off the device. Then, while holding Volume Up & Volume Down plug in a USB-C cable that is connected to your computer until you see a ‘Download’ screen. Release the buttons and press Volume Up to get in Download Mode. You will need to do this a few times :)
When in Download Mode, run pmbootstrap install and follow the steps. Then, flash the kernel by running pmbootstrap flasher --no-reboot flash_kernel.
If you get an error that
zstdis not found. Install it manually by runningpmbootstrap chroot -- apk add zstdand try again to flash the kernel.
Turn the phone off again, enter Download Mode again and flash the rootfs pmbootstrap flasher --no-reboot flash_rootfs.
Turn the phone off again, enter Download Mode again and flash the DTBO which you can get from here https://github.com/map220v/postmarket_samsung_a72q/releases/tag/dtbo. You flash this with the compiled heimdall by running heimdall flash --DTBO emptyDTBO.img
When you reboot the phone now you should see the pmOS splash screen followed by tty
SSH to device
After you boot to a TTY you can ssh into the phone after you give the phone an ip address. Find the phone with the command
ip a
Usually the phone has a random string like this enx9ad89e8d8f22. This is a USB network interface. Give this interface a ip address
sudo dhclient enx9ad89e8d8f22
Now you can SSH into the phone with the username and password set during pmbootstrap install.
ssh user@172.16.42.1
Share internet connection
Run a few commands on your machine and on the phone. You need to know the primary network interface name of your machine from which you are connected to the net. It could be en0 or wlan1 or wlxc0d3d34d, use ip a to find it.
On your machine:
sudo sysctl net.ipv4.ip_forward=1
# for OS with iptables (you can find your net interface with `ip a`.)
sudo iptables -t nat -A POSTROUTING -o <primary-net-interface> -j MASQUERADE
# for OS with nftables
sudo nft add table inet nat
sudo nft add chain inet nat postrouting '{ type nat hook postrouting priority srcnat ; }'
sudo nft add rule inet nat postrouting oifname <primary-net-interface> masquerade
On the phone:
sudo ip route add default via 172.16.42.2
echo "nameserver 9.9.9.9" | sudo tee /etc/resolv.conf
and you should share a connection now. To enable localhost access on the phone, edit /etc/network/interfaces and add the following
auto lo
iface lo inet loopback
ping 127.0.0.1 to test
Testing functionality
evtest
Install evtest with apk add evtest
Run evtest /dev/input/event0 and press the power button to get a response.
Event: time 151283560.995643, type 1 (EV_KEY), code 116 (KEY_POWER), value 1
Event: time 151283560.995643, -------------- SYN_REPORT ------------
Event: time 151283561.130515, type 1 (EV_KEY), code 116 (KEY_POWER), value 0
Event: time 151283561.130515, -------------- SYN_REPORT ------------
All hardware buttons and the touchscreen are working.
KEY_POWERis mapped to/dev/input/event0KEY_VOLUMEUPis mapped to/dev/input/event3KEY_VOLUMEDOWNis mapped to/dev/input/event1ABS_X,ABS_Y(touchscreen) etc. is mapped to/dev/input/event2
Install pd and libpd
Make sure the date of the phone is set. Manually works by running date -s "2026-05-05 10:22:00". Change the date/time accordingly.
Or run apk add chrony && rc-service chronyd start to a ntp service.
Add the testing repo to the bottom of the /etc/apk/repositories file
@edge https://dl-cdn.alpinelinux.org/alpine/edge/testing
Update apk and install pd and libpd.
apk update
apk add pure-data@edge libpd-dev@edge libpd@edge
sidequest: compiling Pd from scratch
In case pd is not packaged for your architecture, or if you need a more recent version.
sudo apk add build-base autoconf automake libtool alsa-lib-dev jack-dev
git clone https://github.com/pure-data/pure-data
cd pure-data
./autogen.sh
LIBS="`pkg-config -libs jack alsa`" ./configure --enable-alsa --enable-jack
make -j$(nproc)
sudo make install
Python
Installing python so we can run a simple script that sends evdev (touch) events over a local socket to pd.
apk add python3 py3-evdev
Clone the repo and run the python script
git clone https://git.xpub.nl/ugrnm/unbrick01.git
cd unbrick01/pd/startup
python touch2pd.py
If you touch the touchscreen, you should see x and y coordinates in the shell. These coordinates are being send on localhost to port 1337
pd
Now to receive the send touch coordinates, run the example pd patch in the shell
cd ~/unbrick01/pd/patch/unstable
pd -nogui -stderr phone_test.pd
touch the touchscreen and you should see the coordinates printed in the shell and you should hear sound, but --- no soundcards --- (yet)
BRAINDUMP
for things that may be useful in the future...
Turn on the speaker volume on minimal (none postmarketOS profile) samsung-m0 device:
alsaucm -c 0 set _verb HiFi set _enadev Speaker
Start JACK without X/DBUS/etc
JACK_NO_AUDIO_RESERVATION=1 jackd -d alsa
Start JACK without X/DBUS/etc and force 16bit (necessary for galaxy SIII)
JACK_NO_AUDIO_RESERVATION=1 jackd -d alsa -S