what is the magic dd incantation to copy the system from the sd card to the emmc?
#11
OK, my memory was wrong
"mainline" uboot has idbloader and uboot.itb, this uboot is uboot + trust
"BSP" uboot has idbloader, uboot.img and trust.img,,,
idb @64 sectors, uboot @8M, trust @12M (16384 sectors = 8M)
Nearly all mainline can NOT do S3mem, sleep to mem
s3mem is good for ~14 days, FWIW
towboot can, but not as good as BSP (?? ~2/3 life ??)
  Reply
#12
I did your test, wdt. I switched off my eMMC and the Armbian SD card will not boot from the PBP micro SD slot so, given that the boot order of the hard-coded SoC  ROM  is eMMC before micro SD, there is either no U-boot  code on the Armbian SD card or its code transfers control to the eMMC U-boot code.
Next I used dd to write PCM720's two U-boot files to the Armbian SD card and then it booted (with eMMC still disabled)! I've been using the PCM720 U-boot on eMMC for over a year now and it's been working well for me so I didn't want to mess with something newer and figured I'd try it on the Armbian SD card.
So Armbian boots from micro SD using PCM720 U-boot without eMMC memory enabled. What is different about Armbian that keeps it from booting when files or the image are copied to eMMC?

(08-08-2022, 07:00 PM)wdt Wrote: armbian uses boot.txt, run thru a simple compiler to make boot.scr
This is one of the things uboot looks for
While the kernel has to be configured to use nvme, 1st uboot has to find it (and be able to read it)
The text file is armbianEnv.txt, right? Yes--boot.cmd has a comment that says:

Code:
# Please edit /boot/armbianEnv.txt to set supported parameters
and also boot.scr:

Code:
# Please edit /boot/armbianEnv.txt to set supported parameters
But why is a compile even necessary when just moving the system to a new device that is obviously supported by the system when booted from SD? After I boot from SD, I can access both my eMMC and NVMe so it's obviously supported by the Armbian kernel. Is it a problem with initrd that requires it to be recompiled?
I don't understand this Armbian compiler requirement or the need for it. With other OSes on the PBP, it is sufficient to simply dd an image to a new memory device or copy the files over to a device that's already partitioned and formatted, as long a U-boot is valid.
Thanks!
-Cal
  Reply
#13
OK, I'll try to describe how the boot works
Please note: ALL? (nearly) images contain the 1st 16M, ie a mbr and a uboot package (2 or 3 files, in right place)
The boot rom searches SPI, emmc, SD for signature of idbloader
It is assumed that if there is an idbloader that there will be a uboot @8M on same media
Then uboot takes control, alters search order (& adds to it, ex, usb)
uboot is looking, in partitions for boot.scr, extlinux/extlinux.conf or aarch64.efi
The first one of those it finds, then it loads it and follows the config within
So... the path to kernel and initrd and dtb must be correct for a succesfull boot
Also note... uboot doesn't know if it is a 1 or 2 partition setup (and knows nothing about mount setup)
so it looks for boot/boot.scr AND boot.scr (it considers where it finds the config file to be /)
Of course, after initrd all this changes, but uboot has done its job by then and exited
I hope this was useful
-----more--
I think the idea of armbianENV.txt is that it is included (referenced) in boot.scr and doesn't need compiling,
but I don't know much about armbian........
----more explaination---
if there is a uboot on emmc, that is the one that will be used,
any uboot on SD will be IGNORED
when you install armbian to emmc, the uboot on emmc will be overwritten by uboot in image
this is the same as uboot on SD
armbians uboot does NOT work, you have proved this, I don't know why
uboot ONLY searches for the config files, all paths to kernel, initrd, dtb are in config file
when uboot loads the config file, then it knows the path to load kernel etc
  Reply
#14
(08-09-2022, 07:20 PM)wdt Wrote: OK, I'll try to describe how the boot works
Please note: ALL? (nearly) images contain the 1st 16M, ie a mbr and a uboot package (2 or 3 files, in right place)
The boot rom searches  SPI, emmc, SD for signature of idbloader
It is assumed that if there is an idbloader that there will be a uboot @8M on same media
Then uboot takes control,  alters search order (& adds to it, ex, usb)
uboot is looking, in partitions for boot.scr, extlinux/extlinux.conf or aarch64.efi
The first one of those it finds, then it loads it and follows the config within
So... the path to kernel and initrd and dtb must be correct for a succesfull boot
Also note... uboot doesn't know if it is a 1 or 2 partition setup (and knows nothing about mount setup)
so it looks for boot/boot.scr AND boot.scr  (it considers where it finds the config file to be /)
Of course, after initrd all this changes, but uboot has done its job by then and exited
I hope this was useful
-----more--
I think the idea of armbianENV.txt is that it is included (referenced) in boot.scr and doesn't need compiling,
but I don't know much about armbian........
----more explaination---
if there is a uboot on emmc, that is the one that will be used,
any uboot on SD will be IGNORED
when you install armbian to emmc, the uboot on emmc will be overwritten by uboot in image
this is the same as uboot on SD
armbians uboot does NOT work, you have proved this, I don't know why
uboot ONLY searches for the config files, all paths to kernel, initrd, dtb are in config file
when uboot loads the config file, then it knows the path to load kernel etc
Thanks for helping to fill the gaps in my PBP boot knowledge, wdt.

I have not attempted to flash the Armbian image to either my eMMC or my NVMe, because my eMMC contains PCM720 U-boot that I used to boot my daily driver Manjaro system on NVMe (NVMe isn't useful for U-boot, because NVMe is not in the PBP's ROM boot order). I have copied Armbian files to the eMMC though, which I've often done to try different version of an operating Manjaro from and to eMMC., NVMe, or SD.

I think the problem with Armbian running from anything but the SD card is a build problem. I found other reports of this failure on the Armbian forum (tried to mount to root filesystem by UUID and failed):
https://forum.armbian.com/search/?q=UUID...st&quick=1
and my post with a link to a failure screenshot here:
https://forum.armbian.com/topic/22360-ro...ent=145200
  Reply
#15
OK, I see you said you have usb -> emmc adapter
make an image of present emmc, maybe on usb key on pbp
dd if=/dev/emmc of=/mnt/sda/emmc.img bs=1M status=progress
(if you don't have a big enough key, pipeline thru gzip,, as so
dd if=dev/emmc bs=1M|gzip >someplace, usb key,,emmc.gz)
Then, with adapter you easily restore any screw-up,
that is I am assuming you have another computer?
Then do a install (of armbian) on emmc,,,DO NOT shut it off
until you ALSO install pcm uboot to emmc (as last step before reboot)
See, with a partition copy install, fstab, boot.scr and probably the initrd need to be adjusted
Because those are all set for the SD
---
BTW,,,pbp reboot is flakey, do a shut off, reboot often hangs
  Reply
#16
(08-10-2022, 01:06 PM)wdt Wrote: OK, I see you said you have usb -> emmc adapter
make an image of present emmc, maybe on usb key on pbp
dd if=/dev/emmc of=/mnt/sda/emmc.img bs=1M status=progress
(if you don't have a big enough key, pipeline thru gzip,, as so
dd if=dev/emmc bs=1M|gzip >someplace, usb key,,emmc.gz)
Then, with adapter you easily restore any screw-up,
that is I am assuming you have another computer?
Then do a install (of armbian) on emmc,,,DO NOT shut it off
until you ALSO install pcm uboot to emmc (as last step before reboot)
See, with a partition copy install, fstab, boot.scr and probably the initrd need to be adjusted
Because those are all set for the SD
---
BTW,,,pbp reboot is flakey, do a shut off, reboot often hangs

I think you have suggested a good plan. Thanks so much for your help.

I have an amd64 architecture laptop running MX-Linux and also a Pinephone with the PP docking station. Either could be used to image my PBP eMMC with my USB eMMC adapter. I think I trust a hard disk drive more than SD cards for backup, though...or my NVMe SSD but I don't have an NVMe USB adapter.

Though generally reliable, even the SanDisk SD cards that Armbian recommends can be a little flaky sometimes, but usually they are much better than other brands.

My Manjaro / is on NVMe. It has plenty of space for the eMMC image and it and the eMMC have proven to be accessible with PCM U-boot on the Armbian SD. Manjaro is my daily driver system that I'm trying to protect, but it mounts /boot from the eMMC. However, it works with /boot on NVMe too (though Manjaro kernel updates have proven to risky with /boot on the NVMe so I now keep /boot on the eMMC--there's really little downside given that U-boot is on the eMMC too). The important thing is to be able to restore PCM720's U-boot on the eMMC but that should be possible with the USB adapter and another machine too. I think a couple of backup and restore strategies are in order, just in case something doesn't work out.

Yeah--full power down has proven to be best for both my PBP and my PP. Even with a full power-down, it will sometimes boot my Manjaro system (boot on eMMC and / on NVMe) when it should boot the micro SD. A second try usually works as expected. This machine has always had boot flakiness when moving things around. Once setup and booting as desired, it's quite stable though. Strange!
  Reply
#17
OK, I see why you don't care about sleep, the nvme sleep problem
The idea of a emmc image backup was ONLY if it doesn't work, easy recovery
So... unless the nvme is small, shrink (gparted) manjaro / with only 100M free,
make a new partition for armbian /....this means that the nvme is easily restored
(just expand shrunk partition)
I would assume armbian install is from a SD boot (also the gparted work)
Unless the install forces a reboot that you cannot stop, installing PCM
is just a command line, cd to right place and the dd commands that you know
Maybe you have (on SD) a ~/pcm directory with the 2 files? or something similar?
I would bet that it would work
BTW, since most of the emmc is empty, you don't have to back it all up,
use appropriate count= (plus a bit extra to be sure)
My boot is ~60M, + the 31M space at beginning of emmc,, so count=120 bs=1M
Yours may be different, gparted will show
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is anyone successfully running guix system on PBP bluekeys 7 3,790 08-11-2022, 03:52 AM
Last Post: ennoausberlin
Big Grin PinephonePro can't Flashing to the eMMC ricardo 1 170 07-31-2022, 04:04 PM
Last Post: wpeckham
  PBP won’t boot from eMMC after Debian update / Tow-Boot installer won’t boot from SD Pino64 21 2,012 05-12-2022, 05:00 AM
Last Post: Pino64
  Broken eMMC boot annahellrothsparent 3 588 04-28-2022, 07:31 AM
Last Post: tophneal
  Fresh Manjaro does not boot from eMMC pentamassiv 6 1,292 03-27-2022, 11:01 AM
Last Post: xNix
  Installing debian on pinebook pro (deb installer/emmc) ljones 14 4,180 02-08-2022, 02:47 AM
Last Post: Humid Stylus
  [Manjaro] u-boot won't boot from eMMC with (unbootable) SD card present zackw 0 632 01-10-2022, 03:58 PM
Last Post: zackw
  NVMe timeout when booting from eMMC but not SD satwell 5 2,908 10-29-2021, 07:41 AM
Last Post: psstoev
  Debian/unstable SD card rescue image vajak 4 1,967 10-28-2021, 02:53 PM
Last Post: vajak
  Blank screen after Armbian 20.04 install to emmc? psychoacoustic 2 1,343 10-14-2021, 03:11 PM
Last Post: psychoacoustic

Forum Jump:


Users browsing this thread: 1 Guest(s)