what is the magic dd incantation to copy the system from the sd card to the emmc? - 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: what is the magic dd incantation to copy the system from the sd card to the emmc? (/showthread.php?tid=17084) Pages:
1
2
|
RE: what is the magic dd incantation to copy the system from the sd card to the emmc? - wdt - 08-08-2022 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 ??) RE: what is the magic dd incantation to copy the system from the sd card to the emmc? - calinb - 08-09-2022 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.scrThe text file is armbianEnv.txt, right? Yes--boot.cmd has a comment that says: Code: # Please edit /boot/armbianEnv.txt to set supported parameters Code: # Please edit /boot/armbianEnv.txt to set supported parameters 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 RE: what is the magic dd incantation to copy the system from the sd card to the emmc? - wdt - 08-09-2022 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 RE: what is the magic dd incantation to copy the system from the sd card to the emmc? - calinb - 08-10-2022 (08-09-2022, 07:20 PM)wdt Wrote: OK, I'll try to describe how the boot worksThanks 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%20does%20not%20exist&quick=1 and my post with a link to a failure screenshot here: https://forum.armbian.com/topic/22360-rockpro64-jammy-2205-emmc-boot/?do=findComment&comment=145200 RE: what is the magic dd incantation to copy the system from the sd card to the emmc? - wdt - 08-10-2022 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 RE: what is the magic dd incantation to copy the system from the sd card to the emmc? - calinb - 08-10-2022 (08-10-2022, 01:06 PM)wdt Wrote: OK, I see you said you have usb -> emmc adapter 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! RE: what is the magic dd incantation to copy the system from the sd card to the emmc? - wdt - 08-10-2022 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 RE: what is the magic dd incantation to copy the system from the sd card to the emmc? - TRS-80 - 08-15-2022 (08-01-2022, 12:15 AM)geokon Wrote: I had trouble installing it the conventional way to the emmc - where you copy the compressed system image to the emmc. The 'conventional way' (on Armbian) would be to use the nand-sata-install tool (which, IIRC, may also be available from armbian-config (not sure)). Different SBCs boot in all different ways, which is part of the problem with them. This is all very different from x86 you may be used to. Having said all of the above, some other people were also reporting this issue at Armbian forums (Werner gives a clue in that thread about how it works), so maybe something went wrong. I do believe it used to work at some point. Edit: I just realized you are probably the same calinb from the thread I linked. Keep up the good work, and I hope to be able to help you some more very soon (just need to pick up my new PBP from post office in a couple days). RE: what is the magic dd incantation to copy the system from the sd card to the emmc? - calinb - 08-18-2022 (08-15-2022, 07:17 PM)TRS-80 Wrote:(08-01-2022, 12:15 AM)geokon Wrote: I had trouble installing it the conventional way to the emmc - where you copy the compressed system image to the emmc. Yes--I posted to the Armbian forum thread. WDT has been very helpful here in filling in the gaps in my knowledge but I don't have time to work on the problem right now. I think it has something to do with initrd generation (initrd doesn't seem to be able to read the eMMC memory and reports (I think) that it can't find the UUID for my eMMC that I put in armbianEnv.txt. armbianEnv.txt: Code: verbosity=1 I have PCM720's Uboot on eMMC (works fine for Manjaro) and Armbian /boot is on SD card. Hopefully this screen shot link of the Armbian failure works: Ambian_eMMC_boot failure. |