I’ve successfully migrated from imx8 to a311d on my pocket reform, after already having migrated to encrypted nvme. Here’s a full sequence of how I did it, based on @josch’s instructions above. Take care with these instructions, it’s possible to get into a situation that may require another computer and some clever thinking to undo.
- Before taking out your original SoM, make sure that your system is fully upgraded.
- If a new kernel version got installed, reboot into that new kernel
- Clean your apt cache with
sudo apt clean
- Make sure that your apt cache contains the latest kernel image package by running this:
sudo apt-get --reinstall --download-only install linux-image-$(uname -r)
- Download and flash the latest rescue system for a311d to your sd-card. Find the latest pocket-reform-system-a311d.img.gz at https://mnt.re/system-image, flash it following the instructions in section 6.3 in the manual.
- You may want to mount one of the partitions of the sd card and paste the contents of this message into a text file there, so you can read it while you’re booted into that system easily.
- Power off, take out the old SOM and install the a311d SOM. For now, you can attach the antenna cable to the antenna connector closest to the a311d chip; that’s the wifi antenna connector.
- Boot. Hopefully you get a screen with a snowy wallpaper, and then the MNT setup wizard. Click the x in the top right corner to exit, and then type HYPER+Return to open a shell.
- First, you want to partition and format the new boot partition on emmc (assuming yours isn’t already partitioned; note that this will effectively wipe the emmc on the SOM). Here’s what I ran:
sfdisk /dev/mmcblk1 <<EOF
size=1048576, type=83
type=83
EOF
mkfs.ext4 /dev/mmcblk1p1
- Run the following steps to mount the nvme root partition at /mnt, with the new emmc boot partition at /mnt/boot. Pay attention to the output of each to make sure it’s all working!
umount /boot
cryptsetup luksOpen /dev/nvme0n1 reform_crypt
vgchange -ay reformvg
mount /dev/mapper/reformvg-root /mnt
mount "/dev/mmcblk1p1" /mnt/boot/
mount -o bind /dev /mnt/dev/
mount -t sysfs sys /mnt/sys/
mount -t proc proc /mnt/proc/
- chroot into that mountpoint to reinstall the kernel package you made sure to download earlier. This will generate a new image and populate the new boot partition:
chroot /mnt sh -c 'apt-get install --reinstall /var/cache/apt/archives/linux-image-*_arm64.deb'
- Edit /mnt/etc/fstab while you’re here, since the imx8 device names don’t match the a311d ones. Note that you’ll need to undo this if you ever want to switch back to imx8. Change
/dev/mmcblk2p1 /boot auto errors=remount-ro 0 1
to
/dev/mmcblk1p1 /boot auto errors=remount-ro 0 1
- Unmount it all:
umount /mnt --recursive
- Edit
reform-boot-config
to allow you to find /boot on emmc. I added this line right after the point where it sources the machine conf, near line 30:
EMMC_USE=true
Then run it:
reform-boot-config --emmc /dev/reformvg/root
- Unmount everything:
vgchange -an reformvg
cryptsetup luksClose reform_crypt
- At this point, the boot partition on the a311d emmc is valid, but uboot (still on the sd card) will prefer to mount the boot partition from the sd card. You can work around this by moving boot.scr:
mount /dev/mmcblk0p1 /boot
mv /boot/boot.scr /boot/boot.scr.back
If you ever need to boot to recovery again, you can slot this sd card into another device and move boot.scr.back to boot.scr.
- Reboot. You should get the disk encryption passphrase prompt. Note that at this point uboot is still on the sd card, and you’ll need to keep it in to boot.