PINE64
After messing with eMMC partitions, PBP won't boot, even from SD card - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=111)
+--- Forum: Linux on Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=114)
+--- Thread: After messing with eMMC partitions, PBP won't boot, even from SD card (/showthread.php?tid=10035)

Pages: 1 2


After messing with eMMC partitions, PBP won't boot, even from SD card - imij - 06-02-2020

I tried to install Debian on my Pinebook Pro, because I don't really like Manjaro. I made the bootable SD with the Pinebook Pro build of Debian, booted into debian, and tried to write the debian disk image to the eMMC with gnome-disk-utility. I cleared all of the partitions before doing this, including the boot-manjaro partition. Perhaps that was my mistake, as now I can't boot at all, even with the SD card.

Is there any way to fix this?

Thanks!


RE: After messing with eMMC partitions, PBP won't boot, even from SD card - tophneal - 06-02-2020

You would've needed to have removed all partitions, so you did that correctly. The older Debian build and Manjaro are quite different, and use different variations of the bootloader. That could've cause problems if you didn't.

When attempting to boot into the SD card what is the PBPs behavior?

If your problems are persistent you can boot from SD by removing the back panel, using the switch to disable the eMMC, boot from the SD, and if you'd like to use the SD to reformat your eMMC you have about 1 minute to flip the switch and re enable the eMMC when booting from your SD. I believe there may be some commands that could rebind if your OS is already booted, but I cannot recall them, and they haven't been added to the wiki yet.


RE: After messing with eMMC partitions, PBP won't boot, even from SD card - manawyrm - 06-03-2020

Messing with the partition layout is a bit dangerous, because the start of the eMMC/SD card is layed out in a specific way. 

The RK3399 SoC will read it's idbloader.img from byte 32768 (from the start of the device, sector 0x40). 
After that is the u-boot at the magic offset byte 8388608 (sector 0x4000). 
That's the reason why partitions are starting rather far into the device on the stock images, to make space for the bootloader and SPL.

You can find more information about the boot process in this wiki article from Rockchip:
http://opensource.rock-chips.com/wiki_Boot_option

In short: Don't touch the first ~16-32 MiB of the device and you'll be fine. 
Otherwise, you'll need to dd the bootloader and idbloader back onto the partition after your actions: 
Code:
dd if=idbloader.img of=/dev/sdb seek=64
dd if=u-boot.itb of=/dev/sdb seek=16384
(as root, these files are probably in /boot)

Tobias


RE: After messing with eMMC partitions, PBP won't boot, even from SD card - imij - 06-03-2020

Thanks, disabling the eMMC let me boot from SD. Now I'm running into another issue: the OS can't seem to detect the eMMC at all now, even when I re-enabled the switch. I experimented with enabling the eMMC during different times: during boot, before login, after login, and it still won't be listed.
Code:
rock@Debian-Desktop:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 59.5G 0 disk
|-mmcblk0p1 179:1 0 64M 0 part /boot
`-mmcblk0p2 179:2 0 59.4G 0 part /

It is only listing one disk, which is the SD card I booted from.

Is there any way to fix this, or will I need to wait until I get the eMMC USB adapter to flash an OS that way?

Thank you


RE: After messing with eMMC partitions, PBP won't boot, even from SD card - tophneal - 06-03-2020

You need to enable the eMMC sooner during boot. I would advise, once I see the LEDs turn on during boot, immediately flip that switch back to enabled.


RE: After messing with eMMC partitions, PBP won't boot, even from SD card - Arwen - 06-03-2020

@imij,
If you have re-enabled the eMMC via the physical switch, (while still booted from  SD card), you can force the OS to recognize the eMMC again using;

Code:
echo fe330000.sdhci >/sys/bus/platform/drivers/sdhci-arasan/unbind
echo fe330000.sdhci >/sys/bus/platform/drivers/sdhci-arasan/bind

This is necessary if you missed the short window where it's booting the SD card, but the SD card OS has not come up completely. It's literally a few seconds, so pretty hard. Easier with the 2 commands above.

I use the following for my partition table so I KNOW where the 3 parts of the boot loader exist. Note that for some reason, "/boot" needs to be partition 1, so the partitions are out of order. But, hey it works for me.

Code:
Device            Start      End  Sectors  Size Type
/dev/mmcblk1p1    32768  1056767  1024000  500M Linux filesystem
/dev/mmcblk1p2       64    16383    16320    8M Linux reserved
/dev/mmcblk1p3    16384    24575     8192    4M Linux reserved
/dev/mmcblk1p4    24576    32767     8192    4M Linux reserved
/dev/mmcblk1p5  1056768 13639679 12582912    6G Linux swap
/dev/mmcblk1p6 13639680 61497310 47857631 22.8G Linux filesystem



RE: After messing with eMMC partitions, PBP won't boot, even from SD card - tophneal - 06-04-2020

(06-03-2020, 10:33 PM)Arwen Wrote:
Code:
echo fe330000.sdhci >/sys/bus/platform/drivers/sdhci-arasan/unbind
echo fe330000.sdhci >/sys/bus/platform/drivers/sdhci-arasan/bind

Ah, yes! These are the lines to rebind the eMMC I couldn't remember/find. @Arwen, do you know if these commands should work in any distro? They would be a great addition to the eMMC section of the wiki.


RE: After messing with eMMC partitions, PBP won't boot, even from SD card - Arwen - 06-04-2020

(06-04-2020, 06:21 AM)tophneal Wrote:
(06-03-2020, 10:33 PM)Arwen Wrote:
Code:
echo fe330000.sdhci >/sys/bus/platform/drivers/sdhci-arasan/unbind
echo fe330000.sdhci >/sys/bus/platform/drivers/sdhci-arasan/bind

Ah, yes! These are the lines to rebind the eMMC I couldn't remember/find. @Arwen, do you know if these commands should work in any distro? They would be a great addition to the eMMC section of the wiki.

Yes, they should work for any Linux distro, since it's in the kernel. It's already in the Wiki, though perhaps not where people are looking;

Wiki - Pinebook Pro - Bootable Storage


After messing with eMMC partitions, PBP won't boot, even from SD card - tophneal - 06-04-2020

Thanks for pointing that out and giving a link! I'd much rather refer people to that than quickly flipping the switch on when booting.


RE: After messing with eMMC partitions, PBP won't boot, even from SD card - imij - 06-08-2020

I got it working, thanks so much for your help!