Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flashing Yocto Image using iPXE
2018-11-22, 07:59
Post: #1
Flashing Yocto Image using iPXE
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)

#!ipxe
echo test
kernel bzImage
initrd initrd
imgargs bzImage rw root=/dev/ram0 initrd=initrd
boot

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
Find all posts by this user
Quote this message in a reply
2018-11-28, 15:58
Post: #2
RE: Flashing Yocto Image 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

Use GitHub Discussions
VRAM bin
Visit this user's website Find all posts by this user
Quote this message in a reply
2018-11-30, 11:04
Post: #3
RE: Flashing Yocto Image using iPXE
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
Find all posts by this user
Quote this message in a reply
2018-11-30, 16:30
Post: #4
RE: Flashing Yocto Image using iPXE
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.

Use GitHub Discussions
VRAM bin
Visit this user's website Find all posts by this user
Quote this message in a reply
2018-11-30, 18:14 (This post was last modified: 2018-11-30 18:14 by mm185399.)
Post: #5
RE: Flashing Yocto Image using iPXE
I am using EFI..You mean adding the dd image inside the initrd.. Will it not make initrd too large
Find all posts by this user
Quote this message in a reply
2018-11-30, 18:19
Post: #6
RE: Flashing Yocto Image using iPXE
"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)
Code:
# 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

Use GitHub Discussions
VRAM bin
Visit this user's website Find all posts by this user
Quote this message in a reply
2018-12-03, 11:58
Post: #7
RE: Flashing Yocto Image using 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
Find all posts by this user
Quote this message in a reply
2018-12-03, 16:29
Post: #8
RE: Flashing Yocto Image using iPXE
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.

Use GitHub Discussions
VRAM bin
Visit this user's website Find all posts by this user
Quote this message in a reply
2018-12-04, 10:21
Post: #9
RE: Flashing Yocto Image using iPXE
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.

#!ipxe
dhcp
set BootServer tftp://${dhcp-server}
echo ${BootServer}
kernel ${BootServer}/bzImage
initrd ${BootServer}/initrd.gz
imgargs bzImage rw root=/dev/ram0 initrd=initrd.gz
boot
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)