Ah! Sorry; I should have been more clear.
Yes, I’m talking to the UART on pins 6, 8, and 10 of the GPIO header. (I highly recommend you pick up a USB-serial interface. They’re handy for talking to all sorts of devices. They’re dirt cheap on AliExpress, or in a hurry, Amazon carries AdaFruit’s version that the Chinese ones copy.)
You need to set in the U-Boot environment variables the location of the partition that contains the uEnv.txt file. The U-Boot variables are stored in the SPI flash (if I’m not mistaken).
There may be a way to write the U-Boot environment variables using some fancy flashcp
incantations, but that seems pretty risky. (If you mess up, you’ll have to boot over UART, and that’ll definitely require a USB UART dongle.) I’m not sure how else to set these variables.
Here’s what I did:
- Set up a bootable SD card. I used cwt’s Arch Linux image.
- Set up the GPT partition table on the eMMC device using fdisk.
- Copy the SD card’s partition 2 (
/dev/mmcblk1p2
) and 3 (/dev/mmcblk1p3
) to the eMMC device (/dev/mmcblk0p2
and/dev/mmcblk0p2
).
a. On the Arch image, there are multiple BTRFS subvolumes in partition 3, so there aren’t any more partitions. Nice and easy. Copy the rest if you have more.
b. I useddd
to copy the EFI partition (partition 2) because I set them to identical sizes, and I usedbtrfs send
/btrfs receive
to copy partition 3 to save time and not to have to worry about the slightly smaller partition size on my eMMC device. - Edit the
boot/extlinux/extlinux.conf
in the eMMC /boot partition. (This will likely be mounted on /mnt/boot/boot, if you do it similarly to how I did.) - You do not need to edit uEnv.txt. You just need to arrange for it to be read from the eMMC device. That’s what step 8 does.
- Reboot.
- Remove the SD card after it’s synced but before it starts up. (You could just shut down, remove the SD card, and power up again.)
- Using the UART port, interrupt the boot process by pressing any key early on. Then issue these commands to U-Boot:
a.setenv fatbootpart 0:2
b.saveenv
- Continue booting. (Type
boot
; hit the reset button; whatever.)
Now, all that said, I haven’t tried getting it to work with the EFI partition on NVMe. This may or may not work with the U-Boot currently in SPI flash. It’s easy enough to have your root filesystem on NVMe though; just use the appropriate root path in extlinux.conf. I’m doing that now.
Your uEnv.txt looks identical to mine. It probably doesn’t need to change.
However, your extlinux.conf file is a little different. Mine comes from the Arch build, as I noted. It looks like this:
default Arch-cwt6-server
menu title U-Boot menu
prompt 0
timeout 50
label Arch-cwt6-server
menu label Arch Linux 5.15.0-cwt6-server
linux /boot/vmlinuz-5.15.0-cwt6-server
initrd /boot/initrd.img-5.15.0-cwt6-server
fdtdir /boot/dtbs/
append root=/dev/nvme0n1p3 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 rootflags=defaults,discard=async,compress=lzo,user_subvol_rm_allowed,subvol=arch-minimal
label Arch-cwt6-server-single
menu label Arch Linux 5.15.0-cwt6-server (Single User Mode)
linux /boot/vmlinuz-5.15.0-cwt6-server
initrd /boot/initrd.img-5.15.0-cwt6-server
fdtdir /boot/dtbs/
append root=/dev/nvme0n1p3 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 rootflags=defaults,discard=async,compress=lzo,user_subvol_rm_allowed,subvol=arch-minimal single
I wonder how those ../../
paths work in yours to locate the boot image files. In any event, I think you’ll need to change the root boot parameter to root=/dev/nvme0n1p3
to have, say, the EFI boot partition on eMMC and root on NVMe.
Oh, and I’m using the latest build of U-Boot (2021.10) in SPI flash. That may or may not matter.