Mic92/nixos-aarch64-images

Pinebook Pro doesn't boot

illustris opened this issue · 9 comments

Tried flashing to EMMC, doesn't boot. This might have something to do with differences in how u-boot is loaded by pbp. The manjaro image for example does this:

Disk /dev/sdb: 116.48 GiB, 125069950976 bytes, 244277248 sectors
Disk model: STORAGE DEVICE
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x563ebd55

Device     Boot  Start       End   Sectors   Size Id Type
/dev/sdb1        62500    500000    437501 213.6M  c W95 FAT32 (LBA)
/dev/sdb2       500001 244277247 243777247 116.2G 83 Linux
[illustris@illustris-thinkpad:~]$ sudo mount /dev/sdb1 ~/mnt/
[illustris@illustris-thinkpad:~]$ ls ~/mnt/
dtbs  extlinux  idbloader.img  Image  initramfs-linux.img  u-boot.itb

EDIT: nevermind, the differences in partitioning are apparently down to MBR vs GPT. The nixos image's partitions and offsets are in line with what is needed for GPT.

Made some progress. The issue appears to be the idbloader.img and u-boot.itb from uboot-pinebook-pro-rk3399_defconfig-2021.04. Flashing the u-boot and idbloader files I pulled form my working manjaro installation got it booting. U-boot logs up to "Starting kernel ..." appear on screen, and then it goes blank. It might be using UART from that point, but I can't confirm right now. I lost my pinebook UART cable, the replacement is arriving in a couple of weeks. I might be able to get the display working by modifying extlinux.conf.

Mic92 commented

I am just using uboot from nixpkgs:

pinebookPro = rockchip aarch64Pkgs.ubootPinebookPro;

Maybe also report in nixpkgs than.

Mic92 commented

Have you made progress? Maybe also try nixpkgs-unstable in case stable does not work.

Sorry, haven't had a chance to get back to this for a while. I'll give it a try this weekend and follow up.

I've been trying to get boot logs, but there's something weird going on with the serial terminal. Here's what I'm seeing:

U���NOTICE:  BL31: v2.4(release):23e0960
NOTICE:  BL31: Built : 08:24:23, May  8 2021
�����^�����%:v��%�8�˫l��q:������"�n��h����yt������������8q+��h��q�������h�l���������q��~u��� q����1Y������*��y� ��z�0���u�do�ʋx
                                                                                                                               ���jɪ��p��US����*�������������2��(��y�њ����:u�+������e������

I'm pretty sure 11500 is the right baud rate, given the bootloader build date and version are showing up correctly. This is also not nix-specific as this happens with Manjaro too. I'll continue working this.

I've been trying to get boot logs, but there's something weird going on with the serial terminal. Here's what I'm seeing:

U���NOTICE:  BL31: v2.4(release):23e0960
NOTICE:  BL31: Built : 08:24:23, May  8 2021
�����^�����%:v��%�8�˫l��q:������"�n��h����yt������������8q+��h��q�������h�l���������q��~u��� q����1Y������*��y� ��z�0���u�do�ʋx
                                                                                                                               ���jɪ��p��US����*�������������2��(��y�њ����:u�+������e������

I'm pretty sure 11500 is the right baud rate, given the bootloader build date and version are showing up correctly. This is also not nix-specific as this happens with Manjaro too. I'll continue working this.

Are you perhaps using the official UART cable? My tip is do not use that official UART cable. It is 5V level UART, while I think the Pinebook Pro UART is actually 1.8 V, but tolerant up to 3.0 V or so. You should optimally be using a 1.8 V level UART, but at least a more common 3.3 V level UART is not that far above spec (but could still theoretically damage the device). No idea why PINE are selling things that do not work completely correctly, and might even potentially damage the thing...

The issue mostly comes with sending data over it to UART, since then you are applying voltage to the device. Passively listening might be less bad, but with 5V levels you might not even be able to read things clearly and I think that might be the noise you are seeing.

Oh that makes sense... I was wondering why my logic analyzer could pick it up but the cable couldn't. Didn't think to check the levels on account of it being "the official cable" XD
If this is a known issue I can just use a level shifter. Thanks!

Turns out the official cables work. I just had a faulty ribbon cable inside the pbp. Took far too much trial and error to figure it out. I've flashed tow-boot on the spi-flash. Still cant get nixos booting from the image though. Here are the boot logs:

Please press [ESCAPE] or [CTRL+C] to enter the boot menu.
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:3...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
692 bytes read in 17 ms (39.1 KiB/s)
1:      NixOS - Default
Retrieving file: /boot/extlinux/../nixos/0avjs0xfcjkhnnv6zcqfr2i7miv9ijli-initrd-linux-5.10.52-initrd
8210128 bytes read in 376 ms (20.8 MiB/s)
Retrieving file: /boot/extlinux/../nixos/2xgc4ljvras2j0gp0kik9hkrk3kzylyg-linux-5.10.52-Image
43661824 bytes read in 1935 ms (21.5 MiB/s)
append: init=/nix/store/iwl96rdx5yvlm5jvnbxx3kw6rz5z12fq-nixos-system-nixos-21.05.1817.2262d7863a6/init console=ttyS0,115200n8 console=ttyAMA0,115200n8 console=tty0 loglevel=7
Retrieving file: /boot/extlinux/../nixos/2xgc4ljvras2j0gp0kik9hkrk3kzylyg-linux-5.10.52-dtbs/rockchip/rk3399-pinebook-pro.dtb
60467 bytes read in 39 ms (1.5 MiB/s)
Moving Image from 0x2080000 to 0x2200000, end=4c50000
## Flattened Device Tree blob at 01f00000
   Booting using the fdt blob at 0x1f00000
   Loading Ramdisk to f4726000, end f4efa6d0 ... OK
   Loading Device Tree to 00000000f4714000, end 00000000f4725c32 ... OK

Starting kernel ...

Display is blank, and the serial terminal shows nothing beyond this point. I tried booting from sdcard and emmc. Open to suggestions if anyone has ideas for debugging further.

EDIT: after flashing tow-boot, the upstream generic aarch64 image worked. The version of the image used in

url = "https://hydra.nixos.org/build/148774499/download/1/nixos-sd-image-21.05.1817.2262d7863a6-aarch64-linux.img.zst";
is probably the cause of the issue.

Mic92 commented

Ok. I bumped the version of the nixos image. Hopefully it would work now...