iPXE discussion forum

Full Version: Flashing Yocto Image using iPXE
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Guys,

How can i flash an hddimg or .wic yocto image over iPXE

Here is what I got working

The intel machine (Apollo lake SoC) gets it's ip over DHCP Server , loads ipxe.efi and then the test script (test.ipxe)

echo test
kernel bzImage
initrd initrd
imgargs bzImage rw root=/dev/ram0 initrd=initrd

Which loads the bzImage and initrd and then boots, it is working fine till here.

How can I transfer a dd image and flash it using dd command, is this possible using ipxe
You can always have iPXE load more files, and with some magic append it to the initrd.
However it will still be up to the scripts in your linux initrd to handle that
Do you have any example of appending a file to initrd, i am trying imgfetch but it is not showing in the initrd.

I just want to copy a dd image to ram file system which I can then do a 'dd' call using the script
I'm assuming this is PCBIOS (not EFI)
in that case use:
initrd http://server/file.dd /file.dd

the extra /file.dd should make sure that a cpio archive header is created, and all files are appended together.
This is called initrd argument in the documentation, and when booting a bzImage this magic happens.

In EFI mode this magic does not work, so there you need to add CPIO head on your own.
I am using EFI..You mean adding the dd image inside the initrd.. Will it not make initrd too large
"too large" depends on how much ram you have.

here is how you need to prepare the dd image for it to get CPIO header (copied from some notes of mine)
# ipxe does currently only support adding cpio headers on the fly to bzImage boots,
# but not efi, for now use preadded cpio header
# generate with: echo sysrcd.dat | cpio -H newc -o > sysrcd.dat.cpio
initrd sysrcd.dat.cpio

if RAM is less then double the dd image then you would want to use something else.
for example using curl or wget to download it from scripts within you linux - but again that then is an "disk imaging issue" rather than related to iPXE
What is the utility you suggest for tftp and dhcp, i am using tftpd32 which has both in it, the problem is I need to manually replace ipxe.efi with test.ipxe the test script after ipxe.efi is loaded else it will run in a loop of fetching ipxe.efi.. Can we make this two step process a single one
You can embed a script into iPXE during build, (see http://ipxe.org/embed or maybe start at http://ipxe.org/howto/chainloading#break...inite_loop )
But using a linux machine as DHCP and running ISC dhcpd is the most compatible way.
Thanks for all your help,

I got iPXE working on our setup after embedding iPXE script.

To compile, I run the following command

make bin-x86_64-efi/ipxe.efi EMBED=test.ipxe

And here is my test script.

set BootServer tftp://${dhcp-server}
echo ${BootServer}
kernel ${BootServer}/bzImage
initrd ${BootServer}/initrd.gz
imgargs bzImage rw root=/dev/ram0 initrd=initrd.gz
Reference URL's