Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pine64-pinephone-braveheart: Add firmware package #163

Conversation

samueldr
Copy link
Member

@samueldr samueldr commented Jun 11, 2020

The firmware is limited to bluetooth only, nothing else (for now)
requires a discrete firmware file.

It looks like the touchscreen can get one, but it is not required, and
seemingly no one provides one.


cc @masipcat

This was tested on top of master.

Note that since it's unfree, even though it's redistributable, it's not part of the default configuration. (I'll need to consult to know what to do about unfree redistributable).

For now, you'll need to build the initrd using the following config:

{ config, ... }:
{
  mobile.boot.stage-1.firmware = [
    config.mobile.device.firmware
  ];
}

It can also, and probably also should, be added to hardware.firmware (the same way).


What was done:

Using examples/demo, verified it could pair with a bluetooth headset.

It wasn't verified as playing media, as the pulseaudio setup is not setup in a way where it should be expected to work. So there was no sink to use. Though the device did pair successfully.

The firmware is limited to bluetooth only, nothing else (for now)
requires a discrete firmware file.

It looks like the touchscreen can get one, but it is not required, and
seemingly no one provides one.
@samueldr samueldr added the 4. type: enhancement New feature or request label Jun 11, 2020
@masipcat
Copy link

I suspect that maybe the -f in cp -vrf "$src/rtl_bt" $out/lib/firmware/ is what makes it work. I'll test it as well later today

@samueldr
Copy link
Member Author

Oh, it shouldn't matter, the -f came from "bad copy pasting" (but really not) of the derivation from another firmware package. It only "forces" writing if e.g. the target path is a file that is -w; that would happen if you try to replace an existing file copied from the nix store.

@masipcat
Copy link

On my Pinephone:

[me@nixos:~]$ ls -l /run/current-system/firmware
lrwxrwxrwx 1 root root 65 Jan  1 00:00 /run/current-system/firmware -> /nix/store/a0a17wm5ipcf8pgk2lc9m1wpjpnvvir8-firmware/lib/firmware

[me@nixos:~]$ ls -l /run/current-system/firmware/
total 0

I'll keep investigating what it's missing but if this works for you go ahead :-)

@samueldr
Copy link
Member Author

You have to do something for it to work, either or both of

  • Adding it to stage-1 using mobile.boot.stage-1.firmware
  • Adding it to stage-2 using hardware.firmware

If it's only added to stage-1, it won't be present in stage-2. I could make it so it is present when stage-2 is built or rebuilt with said stage-1, but this could get confusing considering that stage-1 is a separate piece still.

Also, if added to stage-1, you would need to update the boot partition, either dd over it, or open it and replace the kernel/initrd.

This makes me think there is no "user story" figured out yet for stage-1 upgrades.

So I guess an easier way for you now could be to add it to stage-2 and rebuilding, that is assuming you were re-building on device.

@masipcat
Copy link

You have to do something for it to work, either or both of

* Adding it to `stage-1` using `mobile.boot.stage-1.firmware`

* Adding it to `stage-2` using `hardware.firmware`

If it's only added to stage-1, it won't be present in stage-2. I could make it so it is present when stage-2 is built or rebuilt with said stage-1, but this could get confusing considering that stage-1 is a separate piece still.

Also, if added to stage-1, you would need to update the boot partition, either dd over it, or open it and replace the kernel/initrd.

Oh, I didn't know I needed both! I rebuilt the image and reflashed the sd and now it works :)

[    1.304214] Bluetooth: Core ver 2.22
[    1.304278] Bluetooth: HCI device and connection manager initialized
[    1.304297] Bluetooth: HCI socket layer initialized
[    1.304304] Bluetooth: L2CAP socket layer initialized
[    1.304321] Bluetooth: SCO socket layer initialized
[    1.954756] Bluetooth: HCI UART driver ver 2.3
[    1.954765] Bluetooth: HCI UART protocol H4 registered
[    1.954803] Bluetooth: HCI UART protocol LL registered
[    1.954837] Bluetooth: HCI UART protocol Three-wire (H5) registered
[    1.954974] Bluetooth: HCI UART protocol Broadcom registered
[    1.969376] Bluetooth: RFCOMM TTY layer initialized
[    1.969404] Bluetooth: RFCOMM socket layer initialized
[    1.969429] Bluetooth: RFCOMM ver 1.11
[    1.969440] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    1.969444] Bluetooth: BNEP filters: protocol multicast
[    1.969452] Bluetooth: BNEP socket layer initialized
[    1.969455] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[    1.969462] Bluetooth: HIDP socket layer initialized
[    2.773826] Bluetooth: hci0: RTL: examining hci_ver=07 hci_rev=000b lmp_ver=07 lmp_subver=8703
[    2.779920] Bluetooth: hci0: RTL: chip_type status=0 type=5
[    2.783798] Bluetooth: hci0: RTL: rom_version status=0 version=1
[    2.783808] Bluetooth: hci0: RTL: loading rtl_bt/rtl8723cs_xx_fw.bin
[    2.784163] Bluetooth: hci0: RTL: loading rtl_bt/rtl8723cs_xx_config-pinebook.bin
[    2.805104] Bluetooth: hci0: RTL: cfg_sz 63, total sz 19427
[    3.118334] Bluetooth: hci0: RTL: fw version 0xaa5ca4dc

@samueldr samueldr merged commit 5d5d939 into NixOS:master Jun 13, 2020
@samueldr samueldr deleted the device/pine64-pinephone-braveheart/firmware branch June 13, 2020 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants