Enable SATA command in u-boot?

How would I go about adding the sata command to u-boot? I have tried adding the following to the u-boot defconfig file:

diff -Naur /home/build/oe-core/build/tmp/work/apalis_imx8-tdx-linux/u-boot-toradex/2018.03-r0/git/configs/apalis-imx8_defconfig git/configs/apalis-imx8_defconfig
--- /home/build/oe-core/build/tmp/work/apalis_imx8-tdx-linux/u-boot-toradex/2018.03-r0/git/configs/apalis-imx8_defconfig	2020-08-04 23:31:17.757010000 +0000
+++ git/configs/apalis-imx8_defconfig	2020-08-05 00:31:38.469762000 +0000
@@ -69,3 +69,10 @@
 CONFIG_VIDEO_IMX_HDP_LOAD=y
 CONFIG_OF_LIBFDT_OVERLAY=y
 # CONFIG_EFI_LOADER is not set
+CONFIG_AHCI=y
+CONFIG_SATA=y
+CONFIG_LIBATA=y
+CONFIG_SATA_IMX=y
+CONFIG_CMD_SATA=y
+CONFIG_SYS_SATA_MAX_DEVICE=1

and removed some errors that would occur in f_fastboot.c:

diff -Naur /home/build/oe-core/build/tmp/work/apalis_imx8-tdx-linux/u-boot-toradex/2018.03-r0/git/drivers/usb/gadget/f_fastboot.c git/drivers/usb/gadget/f_fastboot.c
--- /home/build/oe-core/build/tmp/work/apalis_imx8-tdx-linux/u-boot-toradex/2018.03-r0/git/drivers/usb/gadget/f_fastboot.c	2020-08-04 23:31:18.068010000 +0000
+++ git/drivers/usb/gadget/f_fastboot.c	2020-08-05 00:32:57.096856000 +0000
@@ -1390,7 +1390,7 @@
 static int _fastboot_parts_load_from_ptable(void)
 {
 	int i;
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_CMD_SATAx
 	int sata_device_no;
 #endif
 
@@ -1405,7 +1405,7 @@
 
 	/* sata case in env */
 	if (fastboot_devinfo.type == DEV_SATA) {
-#ifdef CONFIG_CMD_SATA
+#ifdef CONFIG_CMD_SATAx
 		puts("flash target is SATA\n");
 		if (sata_initialize())
 			return -1;

The resulting u-boot is functional, but any use of the sata command gives an error:

Apalis iMX8 # sata init
"Synchronous Abort" handler, esr 0x96000007
elr: 000000008004b0c8 lr : 0000000080031f90 (reloc)
elr: 00000000ffeb90c8 lr : 00000000ffe9ff90
x0 : 0000000000000000 x1 : 00000000fd699f80
x2 : 00000000fd699f80 x3 : 00000000fd697370
x4 : 000000000000000d x5 : 000000000000000d
x6 : 00000000fd698760 x7 : 0000000000000000
x8 : 00000000fd67e030 x9 : 0000000000000008
x10: 00000000ffffffd8 x11: 0000000000000006
x12: 000000000001869f x13: 000000000000c270
x14: 00000000fd67e24c x15: 0000000000000002
x16: 0000000000002080 x17: 0000000000000000
x18: 00000000fd68bda8 x19: 00000000fff0e000
x20: 0000000000000000 x21: 0000000000000000
x22: 0000000000000002 x23: 00000000fff25840
x24: 0000000000000002 x25: 0000000000000000
x26: 0000000000000000 x27: 0000000000000000
x28: 00000000fd698560 x29: 00000000fd67e0a0

Resetting CPU ...

resetting ...

What am I missing?

I don’t think we ever tried SATA in the boot loader. What exactly is it that you are trying to achieve?

I would like to be able to use SATA as the source for the kernel and root file system, in place of the MMC.

Root file system no problem as the Linux Kernel is taking care of that one. As for the kernel just load it from somewhere else for now.

I’m unclear what you mean by this. I similarly want to put the kernel and rootfs on a SATA drive but still use the u-boot on the eMMC to use the sataboot command. I’ve been told that the iMX8 module won’t recognize u-boot on anything other than an eMMC but I could at least put the kernel and rootfs on the SATA SSD.

1 Like

Hi @jonk4m,

Because this is a very old topic, could you please create a new topic in our community for us to better understand and help you with your problem?

Best Regards,
Hiago.

hi, @jonk4m
I’m trying to achieve the same result as you do, boot os kernel from SATA drive. Did you get it running? Any suggestions?

@d_makarenko

I managed to get TorizonCore to boot from an SSD by telling the initramfs to look for the TorizonCore partition on my SSD using the tdxargs U-Boot parameter.

It actually wasn’t that hard once I knew what I was doing, and I’ve gotten great performance so far.

I built Torizon in Yocto (standard build, absolutely nothing special) then edited the image.json file from the torizon-core-docker-blah-blah-Tezi-blah-blah.tar to only include the bootfs for the eMMC. I then used the same Yocto Tezi build to extract both the bootfs and rootfs to the SSD (you must be root when extracting).