From 0e028947eac03423977dca11dca865954ae7ad77 Mon Sep 17 00:00:00 2001 From: erebion Date: Fri, 23 Aug 2024 01:04:11 +0200 Subject: [PATCH 1/2] update project status and cleanup docs --- IMAGE.md | 22 ++++++++++------------ README.md | 26 ++++++++++++-------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/IMAGE.md b/IMAGE.md index a0e4f8e..41285b6 100644 --- a/IMAGE.md +++ b/IMAGE.md @@ -25,15 +25,12 @@ DEB_HOST_ARCH=arm64 dpkg-buildpackage -a arm64 -us -uc -rfakeroot -b -Pcross,noc ## Building the Image -First `cd` to the Mobian repo. - -Copy the kernel deb to `devices/qcom/packages`, so that it gets installed onta the image we are about to build. - -Temporary workarounds: - -- Comment `loupe` in `include/packages-phosh.yaml` as that is currently not available in the repo. The image viewer can be installed later. -- Comment `mobian-phosh` because of a broken dependency and insert `phosh-core`, the metapackage just installs things like an XMPP client and nothing important we couldn't install later. +- First `cd` to the Mobian repo +- Copy the kernel deb to `devices/qcom/packages`, so that it gets installed onta the image we are about to build. - Add your SSH authorized keys file to `overlays/ssh/authorized_keys`, important so you can log in later +- Make sure the internet connection is stable, as the build fails if it cannot download all packages successfully. + +Now build the image: ```bash ./build.sh -t qcom -s -u mobian | tee mobian-build.log # -s for SSH, which we need later @@ -41,15 +38,16 @@ Temporary workarounds: (If you replace `mobian` with your own username, you will have to use that one for SSH later, of course) -Wait. It takes a while. Make sure the internet connection is stable, as the build fails if it cannot download all packages successfully. +Wait. It takes a while. -Note: Your SSH Host Keys currently get generated while building the image, please don't give your image to anyone else. +Note: Your SSH Host Keys seemingly get generated while building the image, please don't give your image to anyone else. +To Do: Verify whether those keys really end up in the image. ## Flash to device: ``` fastboot --set-active --slot a -fastboot flash boot_a mobian-qcom-phosh-20240614.boot-bonito-sdc.img +fastboot flash boot_a mobian-qcom-phosh-20240614.boot-sargo.img fastboot flash userdata mobian-qcom-phosh-20240614.rootfs.img fastboot erase dtbo ``` @@ -58,4 +56,4 @@ Boot up the device. Connect it via USB. ## Temporary manual changes -Documented in README.md in this repo. +The steps are documented in `README.md` in this repo. diff --git a/README.md b/README.md index fc557ab..bd91fe3 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ Connect via SSH: `ssh mobian@10.66.0.1` Accept the host key. +Note: If you built the image with a different username, you will have to set that in `ansible/ansible.cfg`. + ### Roll out workarounds using Ansible You have to have `ansible-playbook` installed. @@ -40,7 +42,8 @@ Roll out audio workarounds: `./audio.sh` - Make installer images work on this device - Have droid-juicer run on installer images -- Make an ITP for tinyalsa and q6voiced and get that done (use the workarounds from this repo to get call audio working for now) +- Make sure my `q6voiced` package no longer includes a hard-coded config for this device +- Create an ITP for `tinyalsa` and `q6voiced` and get both into the repos (use the workarounds from this repo to get working call audio for now) - Combine SDM670 kernel patches with those in the Mobian qcom kernel - Patches are already being upstreamed by the sdm670-linux project, maybe that's already done before I start working on it xD @@ -48,7 +51,7 @@ Roll out audio workarounds: `./audio.sh` - Remove hard-coded value in the `droid-juicer` systemd unit (needs someone who knows Rust, **help wanted**) - https://gitlab.com/mobian1/droid-juicer/-/issues/4 -- Combining SDM670 kernel patches with the Mobian qcom kernel (To Do List entry above) +- Combining SDM670 kernel patches with the Mobian qcom kernel (To Do List entry above, **help wanted**) Done: @@ -69,8 +72,8 @@ For those I will remove the workarounds once the changes are in the Mobian repo - add udev rule for the vibration motor to the right package - fix udev rule for the Bluetooth workaround in this repo -- add script that brings up Bluetooth & then package it - - for now this repo contains a simple script specific to this device and a udev rule, but something is wrong with the udev rule. Run "/opt/bluetooth-mac.bash" to get Bluetooth working, repeat after reboots +- create/find script/tool that brings up Bluetooth & then package it + - for now this repo contains a simple script specific to this device and a udev rule, but something is wrong with the udev rule. Run `/opt/bluetooth-mac.bash` to get Bluetooth working, repeat after reboots ### This Works @@ -90,24 +93,19 @@ For those I will remove the workarounds once the changes are in the Mobian repo - eSIM - SMS (only receiving has been tested, but I don’t have reason to believe sending wouldn’t work) - audio (ALSA config not packaged, but can be manually added using the playbook in this repo) -- full disk encryption (works, need to get some MRs merged and will document that soon) -- camera (both are still WIP, front camera buggy, back camera works but patches not in git yet) -- GPS (needs some improvements for better accuracy) +- full disk encryption (works, will document that soon) +- camera (patches not pushed to my device-specific kernel) ### This Has An Unknown Status - Fingerprint Sensor -- NFC (no idea what software I could use for testing, but should work, does so on pmOS) +- GPS (needs some improvements for better accuracy) +- NFC (should work, does so on pmOS) ### This Does Not Work Yet (Soon™) - USB host mode (no Kernel support yet, but apparently this is being worked on) -### This Has An Unknown Status - -- Fingerprint Sensor -- NFC (no idea what software I could use for testing, but should work, does so on pmOS) - ### This Is Missing And Will Come Later - accelerometer @@ -119,7 +117,7 @@ For those I will remove the workarounds once the changes are in the Mobian repo - My efforts of packaging a device-specific kernel: https://salsa.debian.org/erebion/sdm-670-linux (which can be used for now as patches are not yet in upstream Linux) - `mobian-recipes`, which is used to build images: https://salsa.debian.org/Mobian-team/mobian-recipes -- `droid-juicer`, which retrieves some important files from some partitions: https://gitlab.com/mobian1/droid-juicer +- `droid-juicer`, which retrieves some important files, such as firmware, from some partitions: https://gitlab.com/mobian1/droid-juicer - postmarketOS wiki: https://wiki.postmarketos.org (lovely folks, thanks for sharing everything you found out the hard way :D) ### Thanks For All The Fish From 81df5538c354f98a5c2402abd682740b40545f91 Mon Sep 17 00:00:00 2001 From: erebion Date: Fri, 23 Aug 2024 01:05:21 +0200 Subject: [PATCH 2/2] cleanup Ansible tasks, drop permissions for cloning the repos, use systemd override instead of 2nd unit for droid-juicer --- ansible/audio.yml | 34 +++++++++----- ansible/files/droid-juicer-sdm670.service | 15 ------ ansible/files/override.conf | 4 ++ ansible/workarounds.yml | 56 ++++++++++++++++------- 4 files changed, 66 insertions(+), 43 deletions(-) delete mode 100644 ansible/files/droid-juicer-sdm670.service create mode 100644 ansible/files/override.conf diff --git a/ansible/audio.yml b/ansible/audio.yml index 957dc76..7cf98e9 100644 --- a/ansible/audio.yml +++ b/ansible/audio.yml @@ -5,7 +5,7 @@ ### ALSA Config ### - - name: "Remove previously downloaded versions of alsa ucm configs" + - name: "Remove previously downloaded version of alsa ucm configs" ansible.builtin.file: path: "/root/alsa-ucm-conf-master.tar.gz" state: absent @@ -16,6 +16,7 @@ dest: /root/alsa-ucm-conf-master.tar.gz force: true # overwrite if the already have a previous version mode: '0440' + delay: 2 retries: 20 - name: "Remove alsa ucm configs" @@ -62,7 +63,7 @@ - libdbus-cpp-dev - make - devscripts - - doxygen + - doxygen state: present update_cache: true @@ -81,6 +82,8 @@ repo: 'https://salsa.debian.org/erebion/tinyalsa.git' dest: /opt/repos/tinyalsa version: mobian-git20240621 + become_user: nobody + delay: 2 retries: 20 - name: "Clone q6voiced repo" @@ -88,6 +91,8 @@ repo: 'https://salsa.debian.org/erebion/q6voiced.git' dest: /opt/repos/q6voiced version: mobian-git20240607 + become_user: nobody + delay: 2 retries: 20 - name: "chown repo directories to nobody:nogroup" @@ -97,19 +102,26 @@ owner: nobody group: nogroup - - name: "Build Debian packages for tinyalsa and q6voiced" + - name: "Build Debian packages for tinyalsa" ansible.builtin.shell: cmd: debuild -i -us -uc -b - chdir: "{{ item }}" + chdir: "/opt/repos/tinyalsa/" become_user: nobody - loop: - - "/opt/repos/tinyalsa/" - - "/opt/repos/q6voiced/" - - name: "Install tinyalsa and q6voiced" + - name: "Install tinyalsa" ansible.builtin.apt: deb: "/opt/repos/{{ item }}" loop: - - "libtinyalsa_2.0.0+git20240621-7f06b2f-2_arm64.deb" - - "tinyalsa_2.0.0+git20240621-7f06b2f-2_arm64.deb" - - "q6voiced_0~0+git20240607-75ae4079-1_arm64.deb" + - "libtinyalsa-dev_2.0.0+git20240621-7f06b2f-3_arm64.deb" + - "libtinyalsa_2.0.0+git20240621-7f06b2f-3_arm64.deb" + - "tinyalsa_2.0.0+git20240621-7f06b2f-3_arm64.deb" + + - name: "Build Debian package for q6voiced" + ansible.builtin.shell: + cmd: debuild -i -us -uc -b + chdir: "/opt/repos/q6voiced/" + become_user: nobody + + - name: "Install tinyalsa and q6voiced" + ansible.builtin.apt: + deb: "/opt/repos/q6voiced_0~0+git20240607-75ae4079-1_arm64.deb" diff --git a/ansible/files/droid-juicer-sdm670.service b/ansible/files/droid-juicer-sdm670.service deleted file mode 100644 index c07e11c..0000000 --- a/ansible/files/droid-juicer-sdm670.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Android vendor firmware extraction -Wants=sysinit.target make-dynpart-mappings@system_a.service -After=-.mount tmp.mount boot.mount make-dynpart-mappings@system_a.service -Before=plymouth-quit.service display-manager.service -ConditionPathExists=!/var/lib/droid-juicer/status.json - -[Service] -Type=oneshot -ExecStartPre=-/usr/bin/plymouth display-message --text="Extracting binary firmware..." -ExecStart=/usr/bin/droid-juicer -ExecStartPost=/usr/sbin/reboot - -[Install] -WantedBy=basic.target diff --git a/ansible/files/override.conf b/ansible/files/override.conf new file mode 100644 index 0000000..83b16de --- /dev/null +++ b/ansible/files/override.conf @@ -0,0 +1,4 @@ +[Unit] +Description=Android vendor firmware extraction +Wants=sysinit.target make-dynpart-mappings@system_a.service +After=-.mount tmp.mount boot.mount make-dynpart-mappings@system_a.service diff --git a/ansible/workarounds.yml b/ansible/workarounds.yml index 226a4e5..dbc59a6 100644 --- a/ansible/workarounds.yml +++ b/ansible/workarounds.yml @@ -4,6 +4,26 @@ tasks: + ### Remove remnants of previous versions of this playbook ### + + - name: "Remove remnants from previous versions of this playbook" + ansible.builtin.service: + enabled: false + masked: true + name: "droid-juicer-sdm670.service" + ignore_errors: true # do not fail if the unit does not exist + register: temp_droid_juicer_unit + + - name: "Remove remnants of previous versions of this playbook" + ansible.builtin.file: + path: "/etc/systemd/system/droid-juicer-sdm670.service" + state: absent + + - name: Reload systemd units + ansible.builtin.systemd: + daemon_reload: yes + when: temp_droid_juicer_unit.changed + ### Various Small Fixes ### - name: "Copy /usr/share/initramfs-tools/hooks/qcom-firmware" @@ -18,33 +38,35 @@ # Has been merged, but package did not have a new release yet # https://salsa.debian.org/DebianOnMobile-team/qcom-phone-utils/-/merge_requests/2 - - name: "Copy custom droid-juicer service unit" + - name: "Create directory for a unit override for droid-juicer.service" + ansible.builtin.file: + path: "/etc/systemd/system/droid-juicer.service.d/" + state: directory + mode: '0644' + + - name: "Copy override.conf for droid-juicer.service" ansible.builtin.copy: - src: droid-juicer-sdm670.service - dest: /etc/systemd/system/droid-juicer-sdm670.service + src: override.conf + dest: /etc/systemd/system/droid-juicer.service.d/override.conf owner: root group: root - mode: u+rwx + mode: u+rw force: true - register: unit - # Original unit has a hardcoded value, we'll just use our own temporarily + register: droid_juicer_unit_override + # Original unit has a hardcoded value, we'll just an override temporarily # https://gitlab.com/mobian1/droid-juicer/-/issues/4 - - name: Reload systemd units + - name: "Reload systemd units" ansible.builtin.systemd: daemon_reload: yes - when: unit.changed + when: droid_juicer_unit_override.changed - - name: "Disable regular service unit for droid-juicer" - ansible.builtin.service: - enabled: false - masked: true - name: "droid-juicer.service" - - - name: "Enable custom service unit for droid-juicer" - ansible.builtin.service: + - name: "Restart droid-juicer.service after adding the override" + ansible.builtin.systemd: enabled: true - name: "droid-juicer-sdm670.service" + state: restarted + name: "droid-juicer.service" + when: droid_juicer_unit_override.changed ### Bluetooth ###