Skip to content

Add Google Pixel 5a (barbet): the device slice - #4

Open
Gibbz wants to merge 5 commits into
denialwm:mainfrom
bit-shift-io:devices/barbet
Open

Gibbz wants to merge 5 commits into
denialwm:mainfrom
bit-shift-io:devices/barbet

Conversation

@Gibbz

@Gibbz Gibbz commented Nov 17, 2026 •

Copy link
Copy Markdown

The device slice of the split you described. It replaces the bring-up record
with the phone as Phonewave holds it; the firmware/Wi-Fi and audio/Bluetooth
parts follow as separate pull requests.

What is here

  • devices/barbet/device.toml, the root README.md row and the FEATURES.md
    section, with the hardware run's results. The battery row says the
    percentage is a voltage-derived estimate; the microphone row stays partial
    because of the DC offset.
  • devices/barbet/README.md: the hardware facts, the version 2 boot layout
    and the install step.
  • devices/barbet/boot/build-boot.sh: takes a release number, builds it
    unless it exists, packs the modules and boot/tail/ with image/boot-tail,
    writes the shared early userspace with image/init-boot --ramdisk, and
    packs the image with linux-perpetua's android-v2 from the vault's verified
    working image. No --evidence.
  • The DTB size in the boot-tail offset. This answers the layout question:
    the tail follows the DTB. image/initramfs/init and tools/phone-reboot
    now read the DTB size from the version 2 header and add it to the kernel and
    ramdisk sizes. A version 4 template has zero there, so the old offset is
    unchanged. The same change belongs in init-boot: Add --ramdisk for phones without an init_boot partition #2; this branch is based on init-boot: Add --ramdisk for phones without an init_boot partition #2, so it
    carries that one commit until init-boot: Add --ramdisk for phones without an init_boot partition #2 lands.

What left

  • pack-boot.py and its test: the packer is devices/boot/android-v2 in
    linux-perpetua#42. That PR now also has --tail, which writes the tail
    after the DTB.
  • The five provision scripts, flash-boot, serve-boot.sh,
    image/flash-root, the curl fallback and the 172.16.42.x addresses.
  • sleep/, droidloom/ and the three start scripts. Their findings are
    going into issues, as agreed.
  • The watchdog feeder: its own pull request, ending before exec switch_root,
    rescue only if the bootloader watchdog needs feeding, and without the
    tenth-ping line.

Not tested here

No phone and no image tools (mkbootimg, avbtool, mkfs.erofs) in this
environment. build-boot.sh is syntax-checked; the first real image needs a
run on the workstation. The kernel PR is still unbuilt and unrun for the
same reason.

@Gibbz
Gibbz marked this pull request as ready for review November 17, 2026 11:23
@Gibbz

Gibbz commented Nov 17, 2026

Copy link
Copy Markdown
Author

@doctorlogix ready for review as the userspace companion to denialwm/linux-perpetua#31. It carries the Barbet boot packing/flashing, Wi-Fi/Bluetooth/audio provisioning, and the sleep and Droidloom units. The open question is the boot-packer duplication with the kernel PR; build-boot.sh should get a fresh-image run once the kernel side settles.

@synthia-si

synthia-si Bot commented Nov 17, 2026

Copy link
Copy Markdown

Thanks for the work here. It is careful in the ways that matter most on a phone: slot A is never written, every write is checked by hash before and after, and no firmware is committed. We cannot test it, so this review is about structure, and on structure it needs to change before it can go in. Today it is a record of how one phone was brought up; what Phonewave holds is the phone described so that the shared image runs on it.

Your question: where the packer lives

In the kernel repository. devices/boot/ there holds one tool per boot chain, and the scripts here call them (devices/aston/boot/build-boot.sh calls android-gki). So android-v2 in the kernel pull request is the packer, and pack-boot.py with its test should leave this one. If the tests are worth keeping, they belong beside android-v2.

One change that touches every phone

The watchdog feeder in image/initramfs/init. As we read it:

  • the loop is still running when the init hands over to systemd; nothing stops it before exec switch_root;
  • switch_root deletes the early userspace, so /bin/busybox sleep 1 fails from then on and the loop spins without a pause;
  • it keeps /dev/watchdog open, and a watchdog opens once, so systemd cannot take it. The image relies on systemd's own watchdog (RuntimeWatchdogSec=30s) to restart a hung phone.

Please check this on your phone (ps and top after boot, and the journal for systemd's watchdog line). If the bootloader's watchdog does need feeding before systemd is up, the loop has to end right before the hand-over and keep running only in the rescue. Either way, send it as its own pull request: we want to try it on our phones before it reaches all of them. The line it logs on every tenth ping should go.

What a device looks like here

devices/README.md and image/README.md describe it; devices/roadstr/ is a good one to read beside them.

  1. device.toml is missing. It is the one file every device needs. Also a row in README.md's device table, and a section in FEATURES.md with the same rows as the other phones. The "works", "partial" and "verified" notes now spread over five READMEs belong in that section.

  2. Nothing is installed by hand on the phone. The five provision scripts copy programs to /usr/local/bin, units to /etc/systemd/system, firmware into /usr/lib/firmware, and mask alsa-restore. A reinstall loses all of it, and a second Pixel 5a owner has to repeat it. Here:

    • units the hardware needs, and the links that turn them on, go in boot/tail/systemd/system/;
    • firmware the kernel loads from the phone's own partitions is named in boot/tail/stock-firmware.conf with its hashes (image/README.md, "Firmware"); firmware that has to be in the boot image comes from the vault when the image is built, as the Edge 70's GPU, Bluetooth and Wi-Fi board files do;
    • programs come from packages.
  3. Use what is already packaged. rmtfs and tqftpserv are packages with our units (services/modem/linux-msm/), and dmail starts the modem. The copies of those units here, and a tqftpserv built by hand, should go.

  4. Build the boot ramdisk with image/init-boot. The script lays our /init over another project's ramdisk from the vault. init-boot: Add --ramdisk for phones without an init_boot partition #2 adds image/init-boot --ramdisk for exactly this case, a phone that keeps its ramdisk in boot. With it the rescue has our fastboot and SSH, so flash-boot, serve-boot.sh, image/flash-root, the curl fallback and the 172.16.42.x addresses are not needed. The other two init changes go with them: init-boot already makes /newroot, and the new "network on" line repeats the one after it.

  5. build-boot.sh takes a release, as the other phones' scripts do: the release folder in, a named image in the vault out, the module tail packed by image/boot-tail. The --evidence option can go.

  6. The start scripts. barbet-wifi-start, barbet-audio-start and barbet-bt-start stop and start remote processors and rebind drivers around polling loops and sleeps. What they encode is real: the modem loads the WLAN firmware only while the ADSP is offline, and Bluetooth answers only after that. But a shell script per device is not where we keep it. Where the kernel can order it, that is the place (the Bluetooth probe waiting for the chip's power, for one). What is left belongs to the service that starts the modem, as something any phone with that chip gets. Please open an issue describing the order the hardware needs before writing that part, so we can agree on where it goes.

  7. sleep/ and droidloom/ are not about this phone. Both are timers that undo, every 15 and 30 seconds, something another program does: Denial's idle suspend after an alarm wake, and the Android health service's timer. Any phone would see the same, so the fix belongs in Denial and in Droidloom. What you found is useful there; please file it as issues with the detail from your READMEs, and take both folders out. The sleep script also reads /home/bronson/, and the image keeps suspend off for now.

How to send it

Smaller pull requests would let us take the parts as they become ready:

  1. the device itself: device.toml, boot/build-boot.sh on top of init-boot: Add --ramdisk for phones without an init_boot partition #2 and android-v2, the README, the FEATURES.md section;
  2. firmware and Wi-Fi through the tail;
  3. audio, then Bluetooth.

The findings in your READMEs (the ADSP order, QMI_ERR_INCOMPATIBLE_STATE after a rebind, the in-band sleep and address notes) are worth keeping. The ones about the kernel belong in the device tree's comments or the kernel commits; the rest in the device's README, in a few lines each.

A phone with no init_boot partition carries the early userspace in its boot
image, after the kernel. --ramdisk writes just the legacy-lz4 ramdisk for
that image. The boot tail then starts after the ramdisk as well as the
kernel: the early userspace and phone-reboot add the ramdisk size from the
header to the offset. A boot image with no ramdisk comes out the same.

PHONEWAVE_KERNEL names the linux-perpetua source the rescue's font comes
from, in place of the workstation path; it defaults to that path.
@Gibbz

Gibbz commented Nov 17, 2026

Copy link
Copy Markdown
Author

Agreed on the structure. We will split this into the three PRs you describe
and make this one the device slice.

Where each thing goes:

  • Packer. devices/boot/android-v2 is in linux-perpetua#31. pack-boot.py
    and its test leave this branch; the test moves beside android-v2 if it is
    worth keeping. build-boot.sh will call the kernel tool the way
    devices/aston/boot/build-boot.sh calls android-gki.
  • Device files. Add device.toml, the root README table row and the
    FEATURES.md section; rewrite the device README to the hardware facts and
    the install/boot procedure.
  • No hand installs. Drop the five provision scripts. Hardware units and
    their enable links go in boot/tail/systemd/system/; firmware the kernel
    loads from the phone's partitions is named in boot/tail/stock-firmware.conf
    with hashes; firmware that has to be in the boot image comes from the vault
    at build time; programs come from packages. rmtfs and tqftpserv come from
    services/modem/linux-msm/, and dmail starts the modem.
  • Boot. build-boot.sh takes a release, uses image/init-boot --ramdisk
    and image/boot-tail, and writes a named image in the vault.
    flash-boot, serve-boot.sh, image/flash-root, the curl fallback, the
    172.16.42.x addresses and the init changes leave with it. We will base
    this slice on init-boot: Add --ramdisk for phones without an init_boot partition #2, or rebase onto it once it lands, so it does not carry a
    second copy of the ramdisk logic.
  • Sleep and Droidloom. Both folders leave this PR. We will file the
    findings as issues with Denial and Droidloom, with the detail from the two
    READMEs.
  • Start scripts. They leave this PR. We will open the ordering issue
    first, with the ADSP-offline/WLAN-firmware and post-WLAN-Bluetooth order,
    and keep the findings in the device README until there is an agreed home.

Watchdog feeder. Checked on the phone. The running image predates the
feeder, so it only shows the healthy case: systemd uses /dev/watchdog0 with
a 30 s timeout and 10 s pretimeout, and no feeder process is present. The
code path is clear enough though, and we agree it should not be in this PR:
it moves to its own PR, the loop ends before exec switch_root, it runs only
in the rescue if the bootloader watchdog actually needs feeding, and the
tenth-ping line goes.

One question before the boot slice is ready: where should the module tail
sit in the v2 image? #2 computes fsoffset from the kernel and ramdisk sizes,
but the v2 image puts the DTB after the ramdisk and android-v2 currently has
no --tail. If the tail follows the DTB, #2 needs dtb_size added to the
offset; if it goes between the ramdisk and the DTB, the bootloader's DTB
location changes. Which layout do you want us to implement?

@Gibbz Gibbz changed the title Add Google Pixel 5a (barbet) userspace support Add Google Pixel 5a (barbet): the device slice Nov 19, 2026
@Gibbz

Gibbz commented Nov 19, 2026

Copy link
Copy Markdown
Author

The split is up:

The two findings that left the device tree are now issues: denialwm/denial#283 (idle suspend after a non-input wake), denialwm/droidloom#41 (the example health HAL waking an idle cell), and #10 (the modem/ADSP/Bluetooth order and where it should live).

On the tail layout: the tail follows the DTB. The device slice adds dtb_size to the boot-tail offset in image/initramfs/init and tools/phone-reboot (the version 2 field at 1648; a version 4 header has zero there), and linux-perpetua#42 now has android-v2 --tail.

The original bring-up branch is preserved as devices/barbet-bringup (aad5ce0) for comparison.

Add the device facts and the boot layout: SM7250, the SOFEF01 panel, ST FTS
touch and DRV2624 haptics, the WCN3990 behind the modem, and the RT5514P and
TAS2562 audio parts. The phone boots from slot B with a version 2 image that
carries the kernel, the ramdisk, the DTB and the tail; slot A is stock
Android and is never written.
Take a release number like the other devices, build it unless it exists, and
pack the modules and boot/tail/ with image/boot-tail. The ramdisk is the
shared early userspace written by image/init-boot --ramdisk, since this phone
keeps it in boot, and the image is packed by linux-perpetua's android-v2
from the verified working image in the vault. The kernel carries the Barbet
tree it must boot, so --dtb replaces the template's Google tree, and --tail
puts the modules and firmware after the DTB.
A version 2 boot image lays out the kernel, the ramdisk and the DTB in that
order, and the tail follows. The early userspace and phone-reboot computed
the offset from the kernel and ramdisk sizes alone, so on a v2 image they
looked one DTB too early. Read the DTB size from the header as well; a
version 4 template has zero there and keeps the old offset.
Record what the hardware run showed, with the battery as a voltage-derived
estimate and the microphone as partial: the DSP loads and streams, but the
samples carry a DC offset.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants