Well, when i started developing EFI applications, i found the same problem. How to send file on EFI environment? For now i know these ways:
1. USB storage device.
Probably the easiest way if you copy files not too often. Just put files on USB flash drive and connect it to virtual machine (VM).
To access file from EFI environment you need EFI shell or something like that. VMware already has integrated shell, while on other VMs you may need to obtain it. To do this you can use wonderful rEFInd Boot Manager, which contains shell. Unzip it, insert iso image in VM's CD-ROM and boot from it. In the rEFInd menu choose "Start EFI Shell". You will see command prompt, where all storage devices mapped as FS0, FS1,... If you see only FS0 (rEFInd file system), then you probably forgot to connect USB drive to VM.
Now to get your file just type commands like this:
fs1:
cd directory_with_file
All shell commands can be found by help
command.
2. Transfer via TFTP.
Longer to setup, faster to use. Nice if you send files often, while developing EFI applications for example. For this method you need TFTP server like tftpd-hpa working (it could be on your host machine), EFI Shell + TFTP client on your VM. There is plenty information about starting TFTP server, so you can find manual yourself. Also it is nice to have DHCP server (it is optional, but configuration will be much easier with DHCP).
TFTP client can be built from Tianocore sources or downloaded as x64 precompiled binary from my cloud (i dont know why Tianocore maintainers do not provide it in binary). Put tftp.efi
on your VM somewhere you can access it (USB drive or virtual HDD). Put your file in TFTP root directory (like /srv/tftp). Probably you should turn your VM's network adapter into bridge mode, so it has real ip, if you want to use DHCP. Start EFI shell VM as described above. When you see command prompt, type these commands.
ifconfig -s eth0 dhcp
fs1:
cd destination_directory
tftp 192.168.3.1 file_to_copy
Where:
eth0
is your network adapter, you can find required one with ifconfig -l
. Also you can use static ip instead of dhcp, see help ifconfig
fs1:
is your file system with tftp.efi
, it could be fs0:
or other depends on your booting device
tftp
is tftp.efi
app, 192.168.3.1
is ip address of TFTP server (host machine or real server)
Also you can write this commands in startup.nsh file in the root of your bootable file system to do it on VM loading. Or only last line in another *.nsh script file to download while EFI running.
3. QEMU virtual machine
It is very handy for simple testings, you do not need TFTP, DHCP, USB drive, etc. If it is ok to recreate VM each time you boot, there is wonderful article about creating and debugging EFI applications with QEMU on osdev.org.
1
In theory, yes. In practice, you'll need a complete TCP/IP stack, with everything from network card drivers up to a client or server for FTP, SSH, or some other protocol that can be used to transfer files. Most (maybe all) of the parts exist, but not necessarily for every system -- you might be thwarted by lack of a driver for your network hardware, for instance. Beyond that, you'll need to track down every piece, and I'm afraid I can't provide pointers to any of it, at least not in ready-to-use binary form. (TianoCore provides parts in source code form.)
– Rod Smith – 2017-03-07T14:22:04.343