Migration from i.MX8MPlus to A311D

No need to be sorry! :slight_smile: If you donā€™t find the documentation, then even if it exists, it might also be a problem with how findable it is. In case of A311D, a document for how to upgrade the hardware only very recently was uploaded: https://mntre.com/documentation/pocket-reform-rcm4-bpi-upgrade-manual.pdf

As for the software side, the reform-emmc-bootstrap script is also only a very recent addition so it cannot be part of the handbook, for example. Do you have your OS on your NVMe SSD? In that case, the upgrade process theoretically is that you first swap out the module. That will remove the /boot partition from your OS on NVMe. So for now, your existing OS on NVMe cannot be booted anymore. So you flash the latest system image on a new sd-card and boot that. From that installation you can then run reform-emmc-bootstrap which will attempt to populate the eMMC of your new module with a /boot partition that can boot your existing OS on your NVMe SSD.

If you need more details or if you run into problems as you run reform-emmc-bootstrap please shout! The reform-emmc-bootstrap script is very new and it is not unlikely that there are still bugs.

3 Likes

@G3M did you already manage to migrate? If it makes no difference for you otherwise, consider using a system image built by this CI pipeline:

Those system images include the upcoming reform-tools release 1.69. If you find any bugs, Iā€™d love to hear about them. Thank you!

Thanks for the info and the followup. Iā€™ll probably be completing the migration this weekend. Iā€™ll let you know how it goes.

1 Like

Finally getting to the migration.

Hereā€™s where I am now. Iā€™ve swapped out the module and booted from an SD using the system image from the Gitlab link above. Iā€™m now booted into the SD card and have run reform-emmc-bootstrap Iā€™m running into this error after the script has run.

E: writting to eMMC not supported on MNT Pocket Reform with BPI-CM4 Module

Iā€™ve read that this is an issue with BPI-CM4

I have my OS installed on my NVME, does reform-emmc-bootstrap have an option to install the boot partition to my NVME or do I need to use a different tool?

Edit: Additional note
My OS is on the NVME, but my boot was on the old SOC. The /boot folder in my NVME is empty.

The reason for forbidding this is, that if something should go wrong and you flash a broken u-boot, then you soft-brick your device because A311D only loads u-boot from eMMC and since your u-boot is broken you cannot boot a rescue image to fix your u-boot. In that situation, you would use extra hardware to restore your A311D. If you are fine with that risk, you can edit /usr/share/reform-tools/machines/MNT Pocket Reform with BPI-CM4 Module.conf and replace EMMC_USE=false with EMMC_USE=true.

Having /boot on NVMe is only useful if u-boot is able to read from your NVMe which best to my knowledge it is not (yet).

Yes, because your u-boot on i.MX 8M+ also is unable to read your NVMe, so /boot was on eMMC and you need a folder in your root filesystem to mount the /boot partition into.

1 Like

I may be willing to do this, but have a few questions.

  1. Has anyone done this successfully?
  2. Is there documentation on how to restore the A311D u-boot with the additional hardware?
  3. If I change the EMMC_USE=false to true, will reform-emmc-boostrap do the heavy lifting and populate the A311Dā€™s EMMC with /boot?

Yes, I have an A311D in my classic Reform and have /boot and u-boot both on my eMMC. I did not use reform-emmc-bootstrap but the ā€œscaryā€ part is flashing u-boot and that is done by the reform-flash-uboot script (reform-emmc-bootstrap calls that) and I have used that to flash my u-boot.

Hrmā€¦ I thought somebody had written about this in this forum but I fail to find that postā€¦ Maybe somebody else knows?

Yes. reform-emmc-bootstrap will use parted to create a partition table and an ext4 formatted partition for /boot on it.

Okay, makes sense.

One clarification: I donā€™t need to run reform-flash-uboot because reform-emmc-boostrap will do it for me. Is that correct?

That is correct.

My post needs to be at least 20 charactersā€¦

1 Like

That worked perfectly! Thanks for your patience and all of the help.

2 Likes

OK I seem to have hosed my Pocket Reform.

I first did the generic stuff in the (outdated) guide (Migration Ā· Wiki Ā· Reform / reform-system-image Ā· GitLab), the upgrade, autoremove, and the preload apt get.

I swapped in the A311D module (and installed the new aluminum heatsink plate I got from JLCNC!), powered onā€¦ screen stayed black.

Reinstalled the i.mx8m board, now it does not boot, black screen. (Yes, HYPER and return to power on : - )

I take it the reform-emms-boostrap script was to be run on the i.mx8M cpu, in hindsight? The new document at (https://mntre.com/documentation/pocket-reform-rcm4-bpi-upgrade-manual.pdf) says ā€œprocessor modules come preinstalled with Debianā€ leading me to believe boot is on the CPU module. So I guess Iā€™m confused.

About the only thing that could go wrong physically is the tiny ribbon cable and itā€™s connector. Iā€™m experienced with electronics, have used these connectors before, I was abundantly delicate. Only the usual nominal small force needed to operate the latch (push/pull lateral for i.mx8m, tilt up for a311d).

Powering off was tricky, I ended up using the battery switch. Off then on seemed to reset the keyboard processor OK.

Any suggestions?

Sooo it depends when/where you got your A311D module from. If we recently sent it to you from MNT shop, then it has a system preinstalled and doesnā€™t need any prep just to test it out. Be sure not to have a MicroSD inserted at that point. On the other hand, you can try with a freshly imaged MicroSD card from http://mntre.com/system-image (pocket-reform-system-a311d.img.gz) as well. U-boot on the A311D moduleā€™s eMMC flash will pick that up.

If you got the module from Crowd Supply or Mouser or a long time ago from us, then it wonā€™t have an OS preinstalled, just an older u-boot IIRC. This then requires booting from MicroSD (same link to image above).

The next step would be serial debugging to see whatā€™s going on. For that you just need a USB-UART adapter with dupont leads and another computer with a terminal program like tio. You can connect the adapter (see Pocket Reform handbook) to the serial port 2 RX/TX/GND pins (leftmost IIRC) and do tio /dev/ttyACM0 -b 115200 on your other machine, then turn on Pocket Reform and report back what you see in the terminal.

Ahh, I got the A311D more than 6 months ago, so no boot. That explains that.

I downloaded that A311d system image and ddā€™d it onto a 64gb microSD as usual, and that is installed in the slot during my tests.

I ran the machine with A311D installed and the cover off, to watch LEDs. (I kept my finger on the chip to watch for temperature rise, it barely noticably warmed).

WITH microSD installed, on power-on green LED, one red LED lit. Approx ~2 seconds, two flashes on the SSD, another ~ 2 seconds the other red LED lit, and blinks OFF two times, and repeats. A diagnostic I assume.

So it looked like it was trying to bootā€¦ so I downloaded the image again (given itā€™s length, Iā€™d deleted it from ~/Downloads), repeated the dd on the same microSD, and now itā€™s booted.

(initramfs complains that /dev/mmcblk0p2 needs manual fsck but Iā€™ll take it from here.)

Thank you for the help!

I am reliably booting my Pocket with A311D, but only from /dev/mmcblk0 which is what itā€™s calling the microSD slot. It contains p1 as /boot and p2 as /. I can see also

/dev/mmcblk1boot0 (4 mb)
/dev/mmcblk1boot1 (4 mb)

reform-emmc-bootstrap complains:

mount: /tmp/reform-emmc-bootstrap.Us0ott5MM1/dev: mount point does not exist.

and will not proceed.

Iā€™ve read the entire thread here, and honestly, thereā€™s too many side stories to parse. I take it mmcblk1 is the internal small bootstrap device and from the dire warnings about a bad flash of it I am reluctant to poke about.

Is there a straightforward method from here to boot from emmc?

Iā€™m at a loss for ideas here. Hereā€™s lsblk:

root@pix:~# lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
mmcblk0      179:0    0  57.9G  0 disk 
ā”œā”€mmcblk0p1  179:1    0   488M  0 part /boot
ā””ā”€mmcblk0p2  179:2    0  57.4G  0 part /
nvme0n1      259:0    0 931.5G  0 disk 
ā””ā”€nvme0n1p1  259:1    0 931.5G  0 part 
mmcblk1      179:256  0  14.6G  0 disk 
mmcblk1boot0 179:512  0     4M  1 disk 
mmcblk1boot1 179:768  0     4M  1 disk 

I assume mmcblk1 is the EMMC. The partitions are bad; parted says the drive is ~16GB, what Iā€™d expect. The two 4MB parts canā€™t be mounted (ā€œwrong fs type, bad option, etcā€).

This is EMMC attached to the A311D board, right? And has not been partitioned and mkfs yet?

I canā€™t find mention of how to partition it, if indeed I should do it manually. /boot and /?

I know that if the EMMC /boot ā€œlooks bootableā€ but is not Iā€™ve soft-bricked the board, hence my hesitancy.

Iā€™d be just as happy booting from the nvme. reform-boot-config seems to offer microSD or emmc as options.

You can always check what is what by platform by looking into (in your case) /usr/share/reform-tools/machines/MNT Reform 2 with BPI-CM4 Module.conf. The value mmcblk1 is associated with the variable DEV_MMC, so yes, this is your eMMC.

That is how it looks like, yes.

  • you can run reform-flash-rescue which should get your eMMC back to ā€œfactoryā€ settings by downloading and flashing the latest image
  • you can manually create a partition on your eMMC, mount your SSD somewhere mount eMMC into boot, chroot into it, restore /boot etc
  • or automate the last point by running reform-emmc-bootstrap

In one of your last posts you write:

This sounds like what reform-emmc-bootstrap thinks is your rootfs does not actually contain a rootfs. Can you re-run reform-emmc-bootstrap with increased verbosity like this: sudo sh -x /usr/bin/reform-emmc-bootstrap and paste the output here to better understand what is going on?

I think itā€™s also very legitimate to start a new thread for your own problem to not get it mixed up with the others. It is also very hard for me to remember who had which problem and who was how far into solving it and what the special circumstances were each time.

No, you soft-bricked your a311d if your u-boot on eMMC looks bootable but actually does not do the right thing. If your u-boot on eMMC is not broken and thus does the wrong thing, then it will prefer booting the SD-card over eMMC. So even if you mess up the first partition of your eMMC, you can pop an SD-card back in and repair things.

You can always check what is what by platform by looking into (in your case) /usr/share/reform-tools/machines/MNT Reform 2 with BPI-CM4 Module.conf.

Thanks! Very useful!

Before I do reform-flash-rescue, here is the verbose run of reform-emmc-bootstrap:

root@pix:~# sh -x /usr/bin/reform-emmc-bootstrap 
+ set -eu
+ [ 0 -gt 0 ]
+ cat /proc/device-tree/model
+ [ -e ./machines/MNT Pocket Reform with BPI-CM4 Module.conf ]
+ cat /proc/device-tree/model
+ [ -e /usr/share/reform-tools/machines/MNT Pocket Reform with BPI-CM4 Module.conf ]
+ cat /proc/device-tree/model
+ . /usr/share/reform-tools/machines/MNT Pocket Reform with BPI-CM4 Module.conf
+ SYSIMAGE=pocket-reform-system-a311d
+ DTBPATH=amlogic/meson-g12b-bananapi-cm4-mnt-pocket-reform.dtb
+ EMMC_USE=warn
+ EMMC_BOOT=warn
+ SD_BOOT=true
+ DEV_MMC=mmcblk1
+ DEV_MMC_BOOT0=true
+ DEV_SD=mmcblk0
+ DEV_SSD=nvme0n1
+ DEV_USB=sda
+ UBOOT_SHA1=ae53c420713e4eeb976959a07a90739963f07da7
+ UBOOT_PROJECT=reform-a311d-uboot
+ UBOOT_TAG=2024-12-23
+ UBOOT_OFFSET=512
+ FLASHBIN_OFFSET=512
+ NEED_NONFREE=true
+ BOOTARGS=ro no_console_suspend cryptomgr.notests loglevel=3 console=ttyAML0,115200 pci=pcie_bus_perf libata.force=noncq nvme_core.default_ps_max_latency_us=0 console=tty1 fbcon=rotate:3
+ lsblk --noheadings --output=MOUNTPOINT /dev/mmcblk1
+ [ -n  ]
+ get_exclusive_write_lock /dev/mmcblk1
+ ret=0
+ python3 - /dev/mmcblk1
+ return 0
+ MOUNTROOT=
+ parted --json /dev/nvme0n1 print
+ jq --raw-output .disk.label
+ disk_label=gpt
+ parted --json /dev/nvme0n1 print
+ jq .disk.partitions | length
+ num_parts=1
+ DEV_SSD_BASE=nvme0n1
+ [ nvme0n1 != sda ]
+ DEV_SSD_BASE=nvme0n1p
+ main /dev/nvme0n1p1
+ ROOTPART=/dev/nvme0n1p1
+ trap cleanup EXIT INT TERM
+ lsblk --noheadings --output=MOUNTPOINT /dev/nvme0n1p1
+ MOUNTROOT=
+ [ -z  ]
+ get_exclusive_write_lock /dev/nvme0n1p1
+ ret=0
+ python3 - /dev/nvme0n1p1
+ return 0
+ mktemp --tmpdir --directory reform-emmc-bootstrap.XXXXXXXXXX
+ MOUNTROOT=/tmp/reform-emmc-bootstrap.sLB80Yg7M4
+ mount /dev/nvme0n1p1 /tmp/reform-emmc-bootstrap.sLB80Yg7M4
+ mount -o bind /dev /tmp/reform-emmc-bootstrap.sLB80Yg7M4/dev/
mount: /tmp/reform-emmc-bootstrap.sLB80Yg7M4/dev/: mount point does not exist.
       dmesg(1) may have more information after failed mount system call.
+ cleanup
+ [ -n /tmp/reform-emmc-bootstrap.sLB80Yg7M4 ]
+ mountpoint --quiet /tmp/reform-emmc-bootstrap.sLB80Yg7M4
+ umount --recursive /tmp/reform-emmc-bootstrap.sLB80Yg7M4
+ rmdir /tmp/reform-emmc-bootstrap.sLB80Yg7M4
+ is_current_root /dev/reformvg/root
+ findmnt --fstab --noheadings --evaluate --mountpoint / --output SOURCE
+ FSTAB_ROOT=/dev/mmcblk0p2
+ [ /dev/reformvg/root = /dev/mmcblk0p2 ]
+ [ -e /dev/reformvg ]
+ [ -e /dev/mapper/reform_crypt ]
root@pix:~# 

Ahh, so u-boot is stored outside of the emmc filesystem then. OK I should have figured that out. Alright, threat level has dropped : - )

Totally correct ā€“ it was bad thread hygiene for me to extend this thread.

OK now I see that the mktemp failedā€¦ the script was run from /rootā€¦ I donā€™t normally login root, always user then sudo. But given new system and no home mounted I logged in root.

Iā€™ll examine reform-flash-rescue and see what it does and maybe try it soon.

I see nothing that does the necessary partition and mkfs.

reform-bootstrap-emmc saw that you have a single partition on your SSD and assumed that to be your root file system. But there seems to be no /dev directory on that filesystem. Can you confirm?

mktemp did not fail. What failed is to bind-mount your /dev into the ā€œdevā€ directory of your root file system on the SSD. I will add some more checks to abort early with a more meaningful error message.

What do you mean?