permacomputing

Source repository for the main permacomputing wiki site
git clone http://git.permacomputing.net/repos/permacomputing.git # read-only access
Log | Files | Refs

unbrick01.mdwn (5199B)


      1 # Installing pmOS on the Samsung A52 4G
      2 
      3 ## Unlocking the bootloader
      4 
      5 Set up the Android phone. Connect to Wi-Fi and navigate to the phone it’s settings. All the way at the bottom press on `About Phone`. Click on `Software Information` and click 7 times on `Build number` until the phone states: `Developer mode has been enabled`.
      6 
      7 Press `back` twice and scroll down to `Developer Options`. Enable `OEM unlocking` and `USB debugging`. If `OEM unlokcing` is not there, reboot the phone and try again.
      8 
      9 ## Compile Heimdall
     10 
     11 I needed a newer version of Heimdall which I couldn’t find without compiling it myself. To do this you can clone Heimdall from: [https://git.sr.ht/~grimler/heimdall](https://git.sr.ht/~grimler/heimdall).
     12 
     13 ```bash
     14 git clone https://git.sr.ht/~grimler/Heimdall
     15 cd Heimdall
     16 mkdir build && cd build
     17 cmake -DDISABLE_FRONTEND=ON ..
     18 make -j$(nproc)
     19 sudo make install
     20 ```
     21 
     22 You can copy `heimdall` to your PATH (e.g. `cp bin/heimdall ~/.local/bin/`). Running `heimdall version` should say `v2.2.2` (or higher).
     23 
     24 ## postmarketOS (pmbootstrap)
     25 
     26 ### installing pmbootstrap
     27 
     28 Follow the steps on the [pmOS wiki](https://wiki.postmarketos.org/wiki/Pmbootstrap/Installation)
     29 
     30 ### bootstrapping
     31 
     32 Run `pmbootstrap init` for a random device (samsung a5) and set it up.
     33 after that I followed newbytes instructions:
     34 
     35 ```bash
     36 cd $(pmbootstrap config aports)
     37 git fetch origin
     38 git switch newbyte/a52-v25.12
     39 ```
     40 
     41 Run `pmbootstrap init` again. Now you are able to select `a52q`. Pick the following options:
     42 
     43 ```bash
     44 Channel [v25.12]: v25.12
     45 Vendor [samsung]: samsung
     46 Device codename [a5]: a52q
     47 Username [user]: user
     48 Provider [default]: default
     49 User interface [none]: none
     50 Change them? (y/n) [n]: n
     51 Extra packages [openssh]: openssh
     52 Use this timezone instead of GMT? (y/n) [y]: y
     53 Locale [en_US]: en_US
     54 ```
     55 
     56 ### installing pmOS
     57 
     58 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 :)
     59 
     60 When in `Download Mode`, run `pmbootstrap install` and follow the steps. Then, flash the kernel by running `pmbootstrap flasher --no-reboot  flash_kernel`.
     61 
     62 > If you get an error that `zstd` is not found. Install it manually by running `pmbootstrap chroot -- apk add zstd` and try again to flash the kernel.
     63 
     64 Turn the phone off again, enter `Download Mode` again and flash the rootfs `pmbootstrap flasher --no-reboot flash_rootfs`.
     65 
     66 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](https://github.com/map220v/postmarket_samsung_a72q/releases/tag/dtbo). You flash this with the compiled heimdall by running `heimdall flash --DTBO emptyDTBO.img`
     67 
     68 When you reboot the phone now you should see the pmOS splash screen followed by tty
     69 
     70 ## SSH to device
     71 
     72 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 
     73 
     74 `ip a`
     75 
     76 Usually the phone has a random string like this `enx9ad89e8d8f22`. This is a USB network interface. Give this interface a ip address
     77 
     78 `sudo dclient enx9ad89e8d8f22`
     79 
     80 Now you can SSH into the phone with the username and password set during `pmbootstrap install`.
     81 
     82 `ssh user@172.16.42.1`
     83 
     84 ## Share internet connection
     85 
     86 To share your internet connection to the phone run the following commands on your machine:
     87 
     88 ```bash
     89 sudo sysctl net.ipv4.ip_forward=1
     90 sudo iptables -t nat -A POSTROUTING -o <your-internet-interface> -j MASQUERADE
     91 ```
     92 
     93 You can find your internet interface with `ip a`. On the phone run the following commands:
     94 
     95 ```
     96 sudo ip route add default via 172.16.42.2
     97 echo "nameserver 9.9.9.9" | sudo tee /etc/resolv.conf
     98 ```
     99 
    100 and you should share a connection now.
    101 
    102 # Testing functionality
    103 
    104 ## evtest
    105 
    106 Install [`evtest`](https://wiki.postmarketos.org/wiki/Input_devices#Using_evtest_to_show_input_events) with `apk add evtest`
    107 
    108 Run `evtest /dev/input/event0` and press the power button to get a response.
    109 
    110 ```bash
    111 Event: time 151283560.995643, type 1 (EV_KEY), code 116 (KEY_POWER), value 1
    112 Event: time 151283560.995643, -------------- SYN_REPORT ------------
    113 Event: time 151283561.130515, type 1 (EV_KEY), code 116 (KEY_POWER), value 0
    114 Event: time 151283561.130515, -------------- SYN_REPORT ------------
    115 
    116 ```
    117 
    118 __*All*__ hardware buttons __*and*__ the touchscreen are working.
    119 
    120 * `KEY_POWER` is mapped to `/dev/input/event0`
    121 * `KEY_VOLUMEUP` is mapped to `/dev/input/event3`
    122 * `KEY_VOLUMEDOWN` is mapped to `/dev/input/event1`
    123 * `ABS_X`, `ABS_Y` (touchscreen) etc. is mapped to `/dev/input/event2`
    124 
    125 ## Install libpd
    126 
    127 Make sure the date of the phone is set. Manually works for now by running `date -s "2026-05-05 10:22:00"`. Change the date/time accordingly.
    128 
    129 Add the testing repo to the bottom of the `/etc/apk/repositories` file
    130 
    131 ```bash
    132 @edge https://dl-cdn.alpinelinux.org/alpine/edge/testing
    133 ```
    134 
    135 Update apk and install `libpd`.
    136 
    137 ```bash
    138 apk update
    139 apk add libpd-dev@edge libpd@edge
    140 ```
    141