Installing debian on pinebook pro (deb installer/emmc)
#1
Hello!

I've been using debian images from here to run on my pinebook pro and while they work fine for a microsd card how do you install not to microsd but to the built in emmc?

From what I gather a normal install isn't possible direct from the debian installer to emmc is there a way to do this at all?

ljones
  Reply
#2
From my experience using Debian installer on original Pinebook - the rub is that it fails to correctly partition eMMC, leaving enough space in the beginning (16MiB, IIRC) for U-boot. It then also installs several not strictly necessary packages that IMHO also don't add much value in terms of ease of system management. But most importantly, the installer doesn't do much to actually install U-boot. So, it is possible to install Debian onto eMMC, but you should do your own manual partitioning and you will need to install U-boot manually. For partitioning - in the simplest case you just need a single ext4 partition, but it should start at, IIRC, 16MiB mark to leave enough space on eMMC for U-boot. For U-boot installation - you should be able to install the appropriate package (IIRC `u-boot-rockchip`) after chroot-ing into the newly installed system and read the package's docs (should be in `/usr/share/doc/u-boot-rockchip` or something like that). In the end you'll likely need to run something like `u-boot-install-rockchip /dev/mmcblk1` as root, assuming /dev/mmcblk1 is the device name for your eMMC storage.
This message was created with 100% recycled electrons
  Reply
#3
Moonwalkers is right, AFAIK; U-Boot is the problem with the Debian installer. I was able to install mainline Debian on my Pinebook Pro (US keyboard) by installing Tow-Boot [1] to SPI flash as my U-Boot, which means Debian doesn't need to handle it at all. (Really, it shouldn't have to.) I then modified the Debian install image by opening it on a second computer and placing the Pinebook Pro firmware files [2] into the installer's firmware directories (I think I needed to create those). The result, after a little bit of tinkering (which I unfortunately do not remember completely), was a fully functional mainline Debian install using the official zcat'd Debian-provided images [3]. The only problem I've encountered is that Tow-Boot frequently stalls during the boot process, a problem I also faced while wrestling with Manjaro's U-Boot, which makes me think Tow-Boot inherited it from U-Boot when it was forked.

As a warning, doing anything with the SPI flash can be a little dangerous. Recovering from a mistake might require a serial cable [4]; I invested in one of these (third-party off Amazon confirmed to work with PBP, not the official one) before I installed Tow-Boot, though I never thankfully needed to use it to save my PBP.

[1] https://tow-boot.org/
[2] https://github.com/cobratbq/pinebook-pro
[3] https://d-i.debian.org/daily-images/arm6...rd-images/
[4] https://pine64.com/product/pinebook-pine...l-console/
  Reply
#4
Ok I think I'm going to leave this one for now. I don't have any experience with towboot or uboot really and I also don't have anything like a serial cable for the pinebook. Guessing really it is best left until debian's installer can install uboot ok.

I did look at the partitioning on the inbuilt emmc and I have two partitions, the second is normal linux but the first is fat32 and about 200MB or so.

ljones
  Reply
#5
Hassles like that are why Armbian exists. Wink
  Reply
#6
(01-26-2022, 03:14 PM)ljones Wrote: Ok I think I'm going to leave this one for now. I don't have any experience with towboot or uboot really and I also don't have anything like a serial cable for the pinebook. Guessing really it is best left until debian's installer can install uboot ok.

I did look at the partitioning on the inbuilt emmc and I have two partitions, the second is normal linux but the first is fat32 and about 200MB or so.

ljones

If you don't feel safe doing it - don't do it. But just as a reality check - considering it seems every ARM device has its own version of U-boot, and even often its own method of installing it (e.g., on RPi it's just a file on a bootable FAT32 partition vs specific sector location on Pinebook), it will probably be a long while before Debian installer will properly support fully automated installation without any manual steps. Considering Debian for ARM has been around already since early to mid 2000s, it is likely going to be a very long while. If you're unwilling to risk (which is not much of a risk if you don't install anything in SPI flash but install U-boot onto the first 16MiB of SD or eMMC storage, like I suggested), then your best bet is to use something like Daniel Thompson's script (search around the forums here; there should also be a link in the wiki) or Armbian images.
This message was created with 100% recycled electrons
  Reply
#7
Been trying to think about how to do this at all btw!

Then I thought -- I have a rockpro64 I just recently bought here and it has removable emmc, just like the pinebook pro; I also now have the emmc to usb adapter. Since that and the pinebook pro has very similar hardware I decided to try things out on the rockpro64 first but avoid trying to do anything with the SPI.

I made a little bit of progress and eventually got the rockpro64 to boot off the emmc but not successfully. Here's what I tried.

- Installed debian to the emmc on the rockpro64 via the usb adapter. Used the installer to make two partitions a 128MB fat32 partition (sda1) and a linux partition ext4 (sda5). Made sda5 bootable.

- Booted off an already working debian install from a micro sd card on the rockpro64. Left the emmc to usb adapter plugged into the usb port on the rockpro64. Then did:

Code:
$ mkdir /tmp/0
$ mount /dev/sda5 /tmp/0 -o rw
$ mount -o bind /dev /tmp/0/dev
$ chroot /tmp/0
$ apt install u-boot-rockchip

then

Code:
$ u-boot-install-rockchip /dev/sda1

But that didn't work and I eneded up getting error "dd: failed to open /idbloader.img : no such file or directory". After finding the relevent file(s) I then did

Code:
$ cd /usr/lib/u-boot/rockpro64-rk3399/
$ cp * /

(That copied idbloader.img, rk3399-rockpro64.dtb, u-boot.bin, uboot.elf, u-boot.img, u-boot-nodtb.bin, u-boot-spi.bin and i-boot-tpl.bin to / ). Then;

Code:
$ cd /
$ u-boot-install-rockchip /dev/sda1

This worked and said:
Code:
Writing idbloader
328+1 records in
328+1 records out
168320 bytes (168kB, 164 KiB) copied, 0.050321 s, 3.3 MB/s
Writing u-boot image
1919+1 records in
1919+1 records out
983008 bytes (983 kB, 869 KiB) copied, 0.338676 s, 2.9MB/s

I then powered off the rockpro64 and removed the microsd card and the jumper (emmc disable) from the rockpro64. I then placed the emmc onto the rockpro64.

The system boots and I get messages on screen, but it stops at "Starting kernel ...." !

Any ideas?

ljones
  Reply
#8
Again, likely a uboot issue,,,, there are 2 'strains' of uboot,,,, bsp and mainline
mainline has no trust (ATF, andriod trusted firmware), the uboot is u-boot.itb (which contains trust)
vrs bsp,, uboot.img,,, this needs trust.img
Maybe debian does it differently
Without a README you really have no idea which version is which
The SPI forms are a bit different, the idbloader has some 'extra' blank sectors inserted into it
Also starts at zero,,, these are ONLY for writing to SPI
---
I would check if the dtb is referenced in extlinux.conf and that it exists in the right place
(because of the 2 partition, there should be NO leading /boot in path)
So, I would try a different uboot package, for reasons I prefer an updated mrfixit uboot, a bsp uboot (for s3 sleep)
Whatever you choose, copy mbr, 1st 16M (somewhere, usb stick?),,,, blank (/dev/zero) 1st 16M,,,, restore mbr
Then write choosen uboot package
Do check that it is mbr and not GPT partitioned, I don't know what debian does (GPT=34 sectors)
  Reply
#9
Wonder how the debian installer works in that case? Maybe it does do something differently! But where is the mr. fixit updated uboot btw -- I could only find full os'es/distros and not just the bootloader files themselves. The emmc I can confirm is partitioned as MBR btw.

I did notice another package in debian called u-boot-menu which I installed and tried using by running u-boot-update in the chroot.

This then created /boot/extlinux and /boot/extlinux/extlinux.conf. I then changed the "append" line in that file from what it said (append root=UUID=d08e60a1-9506-4368-bd55-55d9bf538f2d) to say append root=ROOT_DEBIAN . Re-ran u-boot-install-rockchip then exited out of the chroot and did e2label /dev/sda5 ROOT_DEBIAN. Shut down the rockpro64, took the emmc off the emmc to usb adapter and placed onto the rockpro64 itself, ejected the sd card and powered back on.

This time I got a boot menu with 2 options although it still hangs with "Starting kernel ..." x.x

I don't see any debian version of bsp u-boot not sure where that could be found.

ljones
  Reply
#10
(02-01-2022, 02:22 PM)ljones Wrote: Wonder how the debian installer works in that case? Maybe it does do something differently! But where is the mr. fixit updated uboot btw -- I could only find full os'es/distros and not just the bootloader files themselves. The emmc I can confirm is partitioned as MBR btw.

I did notice another package in debian called u-boot-menu which I installed and tried using by running u-boot-update in the chroot.

This then created /boot/extlinux and /boot/extlinux/extlinux.conf. I then changed the "append" line in that file from what it said (append root=UUID=d08e60a1-9506-4368-bd55-55d9bf538f2d) to say append root=ROOT_DEBIAN . Re-ran u-boot-install-rockchip then exited out of the chroot and did e2label /dev/sda5 ROOT_DEBIAN. Shut down the rockpro64, took the emmc off the emmc to usb adapter and placed onto the rockpro64 itself, ejected the sd card and powered back on.

This time I got a boot menu with 2 options although it still hangs with "Starting kernel ..." x.x

I don't see any debian version of bsp u-boot not sure where that could be found.

ljones

You won't find BSP u-boot in Debian repos. That said, if u-boot-rockchip you installed prints out some text during early boot - it should be good enough to boot Debian kernel. So long as you have kernel 5.10.something or newer - you should have a bootable system. If you're still relatively new to Linux on ARM I would suggest you start with the simplest possible setup - single ext4 partition starting at 16MiB mark (sector 32768). If you install u-boot-menu it should automatically take care of creating the correct extlinux.conf for you, and even if it doesn't - you probably should change /etc/default/u-boot and re-run `sudo u-boot-update` instead of changing extlinux.conf directly. You also should not forget `LABEL=` if you want to specify your root by FS label instead of UUID. As in `root=LABEL=ROOT_DEBIAN` instead of `root=ROOT_DEBIAN`. If you have a separate /boot you will want to either install a package that copies device tree files to /boot for you automatically (`flash-kernel`, I believe), or copy them there yourself - by default u-boot-menu will point u-boot in extlinux.conf to device tree files location is /usr/lib/, where they are unpacked by the package manager when you install a kernel, but that location is inaccessible when u-boot loads kernel if you have separate /boot. If you copy device tree files manually - you should make sure extlinux.conf points u-boot to them.
This message was created with 100% recycled electrons
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unable to install Debian Bullseye because of missing wifi firmware Pino64 2 237 05-27-2022, 11:00 PM
Last Post: Pino64
  pre-order pinebook pro justwantin 3 144 05-27-2022, 12:09 PM
Last Post: dachalife
  PBP won’t boot from eMMC after Debian update / Tow-Boot installer won’t boot from SD Pino64 21 774 05-12-2022, 05:00 AM
Last Post: Pino64
  Broken eMMC boot annahellrothsparent 3 221 04-28-2022, 07:31 AM
Last Post: tophneal
  Gentoo on Pinebook Pro RELEASE jannik2099 52 53,588 03-31-2022, 04:28 AM
Last Post: RobertZamora52
  postmarketOS/Alpine edge image for the Pinebook Pro MartijnBraam 73 67,510 03-29-2022, 06:50 AM
Last Post: pobblebonk
  Fresh Manjaro does not boot from eMMC pentamassiv 6 669 03-27-2022, 11:01 AM
Last Post: xNix
  Dual boot Manjaro and Debian? dieselnutjob 3 391 03-26-2022, 07:17 AM
Last Post: dieselnutjob
  Unsuccessful using danielt's unofficial Debian installer on the PBP joeDoe 1 460 03-25-2022, 08:15 AM
Last Post: danielt
  Problems installing/ booting a different Linux on PinebookPro v-man 3 613 03-22-2022, 06:37 PM
Last Post: pentamassiv

Forum Jump:


Users browsing this thread: 4 Guest(s)