Switch PineBook Pro BSP uBoot to mainline

I am looking to switch my PBP from BSP uboot to mainline since I don’t think S3 sleep will be working any longer using BSP uboot at least in newer kernels. I think I tried to do this a few months before and it messed everything up.

Let me know if I am doing this wrong, but here are the steps I plan on trying:

  1. Make sure I have mainline uboot-pinebookpro downloaded: sudo pacman -S uboot-pinebookpro
  2. Backup then clear the first 16Mb of emmc sudo dd if=/dev/zero of=/dev/mmcblkX bs=1024 count=16 conv=notrunc
  3. Then run the dd commands to flash mainline uboot to eMMC: ‘sudo dd if=/boot/idbloader.img of=/dev/mmcblkX seek=64 conv=notrunc,fsync
    sudo if=/boot/u-boot.itb of=/dev/mmcblkX seek=16384 conv=notrunc,fsync’

If feel like I am missing a step. Something about backing up and restoring MBR. Can anyone chime in on the proper way to do this?
Thanks!

I think this should be 32mb
sudo dd if=/dev/zero of=/dev/mmcblkX bs=1024 count=32 conv=notrunc,fsync

then flash the boot files but make sure to uninstall uboot-pinebookpro-bsp

sudo dd if=/boot/idbloader.img of=/dev/mmcblkX seek=64 conv=notrunc,fsync

sudo if=/boot/u-boot.itb of=/dev/mmcblkX seek=16384 conv=notrunc,fsync

I assume you’re changing the X in the mmcblkX to the drive number of emmc, if you’re using the exact same command then you’re doing it wrong.

Can you share the output of lsblk and also what size is your emmc and the sd card you’re using.

Thanks @spikerguy for the reply.
Yes, mmcblkX in my case is mmcblk2. I have not pulled the trigger yet on switching over but will report back when I do.
As per your request:

$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 276.6M 1 loop /var/lib/anbox/rootfs
mmcblk2 179:0 0 58.2G 0 disk
├─mmcblk2p1 179:1 0 213.6M 0 part /boot
└─mmcblk2p2 179:2 0 58G 0 part /
mmcblk2boot0 179:32 0 4M 1 disk
mmcblk2boot1 179:64 0 4M 1 disk
zram0 252:0 0 5.6G 0 disk [SWAP]

As an update, I think I cleared too much of the eMMC (using count=32 in my dd command) and it cleared out my MBR as well…
I ended up just flashing the first 32mb of the Manjaro ARM ISO and resizing my root partition in the MBR.

My last issue to figure out is why bluetooth isn’t working after this switch…

I will say that I am happy to report I no longer have the issue with mainline uBoot where it would only boot 1 out of 7 tries :slight_smile:

I do appreciate the help @spikerguy. Thanks!

1 Like

I just unbricked my Pinebook Pro, after (unwisely) using these lines of code on my machine. I may be wrong here, but I think there are a few things wrong with them:

First off, iirc, the unit of the bs parameter of dd is bytes, not kilobytes. So dd if=/dev/zero bs=1024 count=32 of=/dev/mmcblkX clears out the first 32 kilobytes of the device, not the first 32 megabytes.

Second, thinking about it, I don’t see why you would want to do that. The first 512 bytes of the hard drive (the first block) contain the MBR (Master Boot Record) which also contains the Partition table that saves the boundaries of the partitions. Executing the command above, will wipe these boundardies (and the other parts of the MBR) and render the data on your drive inaccessible (I did that yesterday, having a headache and not being concentrated)

Third, the other commands to write uboot to the space between the MBR and the start of the first partition should be fine on their own. The boot rom searches in known locations for the boot loader and the bootloader itself should know how large it is, so clearing the space around it shouldn’t be necessary