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
Cheers,
TRS-80

What is Free Software and why is it so important for society?

Protocols, not Platforms

For the most Linux-y experience on your Linux phone, try SXMO!

I am (nominally) the Armbian Maintainer for PineBook Pro (although severely lacking in time these days).
  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
  Debian on Pinebook Pro u974615 8 449 03-22-2024, 03:57 PM
Last Post: u974615
  Pinebook Pro upgrading from the factory image yamsoup 12 1,126 02-22-2024, 04:02 PM
Last Post: tllim
  Help installing Manjaro on eMMC of Pinebook Pro pine4546464 4 1,921 12-13-2023, 07:22 PM
Last Post: trillobite
  Need Help Recovering Manjaro /boot Contents on Pinebook Pro calinb 6 1,981 12-11-2023, 03:47 AM
Last Post: calinb
  Gentoo on Pinebook Pro RELEASE jannik2099 54 86,671 12-08-2023, 11:25 PM
Last Post: tllim
  Manjaro 20.04 not loading from SD (with Manjaro on eMMC) zaius 1 295 12-07-2023, 03:11 PM
Last Post: wdt
  Boot Order in Pinebook Pro food 8 994 11-23-2023, 07:37 AM
Last Post: KC9UDX
  install debian on pbp jsch 7 3,833 11-22-2023, 04:22 PM
Last Post: TRS-80
  How to mainline kernel on daniel thompson's debian installer? hellojack 14 7,032 09-07-2023, 09:38 PM
Last Post: Der Geist der Maschine
  PineBook Pro seems to go to deep sleep, but doesn't wake up pogo 11 4,930 08-31-2023, 04:20 PM
Last Post: TRS-80

Forum Jump:


Users browsing this thread: 1 Guest(s)