imgfetch [--name <name>] [--timeout <timeout>] <uri> [<arguments>...]
or
module [--name <name>] [--timeout <timeout>] <uri> [<arguments>...]
or
initrd [--name <name>] [--timeout <timeout>] <uri> [<arguments>...]
imgfetch http://boot.ipxe.org/1mb
#!ipxe kernel vmlinuz initrd initrd.img initrd modules/6.0.16/e1000.ko /lib/modules/e1000.ko boot
Download an image from the specified URI. A name for the downloaded image can be specified using the --name option. A download progress timeout can be specified (in milliseconds) using the --timeout option. Any remaining arguments will be passed directly to the image.
If this command is executed from within an iPXE script, then the URI will be interpreted as being relative to the URI of the script itself. For example, if the script http://boot.ipxe.org/demo/boot.php contains the line
imgfetch initrd.img
then iPXE will download http://boot.ipxe.org/demo/initrd.img.
| Success | The image was successfully downloaded |
|---|---|
| Failure | The image was not successfully downloaded |
There is no difference between the commands imgfetch, module, and initrd.
When booting a Linux kernel, iPXE will construct a “magic initrd” by injecting downloaded files into the initial RAM filesystem image. Any argument supplied to the initrd command will be used as the pathname for that image within the initrd.magic initial RAM filesystem. For example, if you have the script
#!ipxe kernel vmlinuz initrd initrd.img initrd initscripts/deploy.sh /sbin/init mode=755 boot
then the file initrd.img will be treated as a normal initramfs filesystem image, and the file deploy.sh will appear as an extra executable file /sbin/init within this filesystem.
The optional mode parameter can be used to change the file mode, which defaults to 644. This can be useful for binaries that need to be executed.
The optional mkdir parameter can be used to create parent directories, if these do not already exist within the initramfs filesystem image. For example:
#!ipxe kernel vmlinuz initrd initrd.img initrd logo.png /opt/oem/logo.png mkdir=1 boot
For older kernels (before Linux 5.7), you will need to add the kernel command-line argument initrd=initrd.magic when booting in UEFI mode.