iPXE discussion forum
Building ipxe with embedded script results in invalid image - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: Building ipxe with embedded script results in invalid image (/showthread.php?tid=7951)



Building ipxe with embedded script results in invalid image - testcs - 2016-02-09 20:22

Hi

I'm trying to boot an aoe disk from a diskless laptop.
I'm using PXE boot to load ipxe.

file: /tftpboot/pxelinux.cfg/default
LABEL ipxe
MENU LABEL iPXE - chainload iPXE
KERNEL ipxe/undionly.kpxe

After Ctrl+B I manually run the commands dhcp && sanboot aoe:e0.0
and the system boots up fine.

Now i would like to do this via an embedded script:
file: myscript.ipxe
#!ipxe
dhcp net0
sanboot aoe:e0.0

So I build the undionly.kpxe like this:
make undionly.kpxe EMBED=myscript.ipxe

Trying to boot the undionly.kpxe with embedded script results
in following error message:

Invalid or corrupt kernel image.

What else could I try from this point to get it booting without the need for typing commands?


RE: Building ipxe with embedded script results in invalid image - mcb30 - 2016-02-11 16:09

(2016-02-09 20:22)testcs Wrote:  So I build the undionly.kpxe like this:
make undionly.kpxe EMBED=myscript.ipxe

I'm pretty sure that wasn't the exact command you ran, since that would produce:

Code:
make: *** No rule to make target 'undionly.kpxe'.  Stop.

Could you post the exact commands that you ran, the exact contents of any relevant files, etc.

Thanks,

Michael


RE: Building ipxe with embedded script results in invalid image - testcs - 2016-02-16 13:13

Hi

Yes you are right I actually ran
make bin/undionly.kpxe EMBED=myscript.ipxe

me@darkstar:/install/ipxe# make bin/undionly.kpxe EMBED=myscript.ipxe
[DEPS] crypto/privkey.c
[DEPS] crypto/certstore.c
[DEPS] image/embedded.c
[BUILD] bin/__umoddi3.o
[BUILD] bin/__udivdi3.o
[BUILD] bin/__moddi3.o
[BUILD] bin/memcpy.o
[BUILD] bin/icc.o
[BUILD] bin/__divdi3.o
[BUILD] bin/__udivmoddi4.o
[BUILD] bin/init.o
[BUILD] bin/uart.o
[BUILD] bin/null_reboot.o
[BUILD] bin/lineconsole.o
[BUILD] bin/base64.o
[BUILD] bin/console.o
[BUILD] bin/pool.o
[BUILD] bin/getopt.o
[BUILD] bin/device.o
..........
[BUILD] bin/ehci.ids.o
[BUILD] bin/hvm.ids.o
[BUILD] bin/undi.ids.o
[AR] bin/blib.a
ar: creating bin/blib.a
[HOSTCC] util/zbin
[VERSION] bin/version.undionly.kpxe.o
[LD] bin/undionly.kpxe.tmp
[BIN] bin/undionly.kpxe.bin
[ZINFO] bin/undionly.kpxe.zinfo
[ZBIN] bin/undionly.kpxe.zbin
[FINISH] bin/undionly.kpxe
rm bin/undionly.kpxe.bin bin/version.undionly.kpxe.o bin/undionly.kpxe.zinfo bin/undionly.kpxe.zbin

Copied the bin/undionly.kpxe to my /tftpboot/ipxe directory
The /tftpboot/pxelinux.cfg/default file looks like this:

DEFAULT menu.c32
PROMPT 0
TIMEOUT 1200
ONTIMEOUT local

LABEL ipxe_aoe
MENU LABEL iPXE - Boot AoE
KERNEL ipxe/undionly.kpxe

After all this I still get following error message:

Invalid or corrupt kernel image.

What I'm trying to do is to directly boot my diskless laptop over the network (pxe) then load ipxe which executes the needed commands to boot over aoe.

If i build the undionly.kpxe without the embedded option that file works fine (no invalid kernel message). Of course in this case I have to use Ctrl+B and type in the needed commands.

Also the other two methods shown in http://ipxe.org/embed refer to grub but I don't have/use grub - I don't even have a disk.


RE: Building ipxe with embedded script results in invalid image - NiKiZe - 2016-02-16 22:21

(2016-02-16 13:13)testcs Wrote:  LABEL ipxe_aoe
MENU LABEL iPXE - Boot AoE
KERNEL ipxe/undionly.kpxe

After all this I still get following error message:

Invalid or corrupt kernel image.

What I'm trying to do is to directly boot my diskless laptop over the network (pxe) then load ipxe which executes the needed commands to boot over aoe.

If i build the undionly.kpxe without the embedded option that file works fine (no invalid kernel message). Of course in this case I have to use Ctrl+B and type in the needed commands.

Also the other two methods shown in http://ipxe.org/embed refer to grub but I don't have/use grub - I don't even have a disk.

Assuming that "Invalid or corrupt kernel image." is from PXELinux ...

I have seen that newer versions of PXELinux/Syslinux with config option KERNEL expects a linux kernel and not a PXE binary, you could try to swap out kernel to PXE instead.

An alternative could be to build bin/ipxe.lkrn which is a linux kernel, the difference is that it uses native ipxe drivers (which in most cases have better performance) instead of the PXE UNDI stack driver (which should always work) The possible downside with ipxe.lkrn being that it can't fallback to the UNDI PXE stack if no native ipxe driver is found.

I have a hard time believing that it works if you build bin/undionly.kpxe without EMBED=... while building with EMBED don't please double check that the files are the same on the server as from your build and that you everything else is the same. For example if it is an old undionly.kpxe it might actually be a renamed ipxe.lkrn.