-1

I want to copy files to mmc device over the network using TFTP.

I know that we can switch to the mmc device using "mmc dev" command at U-boot prompt. After switching to the mmc device, I need to copy the files to the mmc device over the network using tftp from U-bot prompt.

Ravi A
  • 421
  • 2
  • 9
  • 21
  • Writing to a MMC device as raw blocks is a standard U-Boot capability. But creating & writing to a file (e.g. in FAT or ext4 filesystem) is a configuration option that needs explicit enabling. – sawdust Sep 03 '22 at 18:02
  • Can you help about the configuration option that needs to be enabled and example commands. – Ravi A Sep 04 '22 at 03:47
  • @sawdust I have loaded file from Ubuntu TFTP server using `tftp ${loadaddr} `. Now I need to copy this file to mmc device(mmc 0:2). Earlier I used to load file from mmc device using `ext2load mmc 0:2 ${loadaddr} ` command. Can you guide on this. – Ravi A Sep 08 '22 at 05:08
  • There's an (optional) `ext4write` command in U-Boot, but no `ext2write`. See https://github.com/ARM-software/u-boot/blob/master/doc/README.ext4 – sawdust Sep 09 '22 at 01:11

1 Answers1

0

You cannot directly copy from MMC to TFTP.

Go through these step instead:

Setup network:

setenv autoload no
dhcp

Load the file to memory:

load mmc 0:1 $loadaddr /test.txt

The load command set environment variable filesize.

TFTP put:

tftpput $loadaddr $filesize 192.168.1.3:/upload/test.txt

Of course you should adjust the server IP address and the file paths.

In your U-Boot configuration you need:

CONFIG_CMD_DHCP=y
CONFIG_CMD_TFTPPUT=y
Xypron
  • 2,215
  • 1
  • 12
  • 24
  • In the above commands how the `filesize` in the `tftpput` command will be updated? I mean after executing the load command the `filesize` will be updated based on the no.of bytes transferred from `file(test.txt)` to `memory(loadaddr)`. Actually, my requirement is copying the file `from TFTP to MMC`. I can run `tftp ${loadaddr} test.txt` to load the file to memory from tftp server, after that how I can send the file from memory to the mmc device with the exact size. – Ravi A Sep 03 '22 at 13:36
  • As described in https://u-boot.readthedocs.io/en/latest/usage/cmd/load.html the load command sets environment variable `filesize`. I have created a patch for a tftpput man-page https://lists.denx.de/pipermail/u-boot/2022-September/493705.html which should soon get merged. By the way if you ever want to read from a TFTP server: This is done with the `tftpboot` or the `dhcp` command. – Xypron Sep 04 '22 at 15:27