Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Embedding a variable upon compile
2015-07-29, 16:07
Post: #1
Embedding a variable upon compile
I'm just curious if it's possible to embed a variable when compiling undionly.kpxe

We have a situation where we need multiple serial baud rates - we have the ability specify which version of undionly.kpxe to use for that specific baud rate/machine that netboots, but we need a way to pass through the baud rate to the next installer.

Currently we have the ability to alter the version setting (http://ipxe.org/cfg/version) during compile, but we'd rather not use that method. I'm curious if there are any other settings/variables that we can alter the contents of.

Thanks!
Find all posts by this user
Quote this message in a reply
2015-07-29, 18:25
Post: #2
RE: Embedding a variable upon compile
(2015-07-29 16:07)nappington Wrote:  I'm just curious if it's possible to embed a variable when compiling undionly.kpxe

We have a situation where we need multiple serial baud rates - we have the ability specify which version of undionly.kpxe to use for that specific baud rate/machine that netboots, but we need a way to pass through the baud rate to the next installer.

You could use an embedded script such as
Code:
#!ipxe
prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE command line... && shell ||
set serialspeed 19200
autoboot

it will set serialspeed variable and continue to boot.
or you can have this in the script based on mac or other options.

Use GitHub Discussions
VRAM bin
Visit this user's website Find all posts by this user
Quote this message in a reply
2015-07-30, 02:29 (This post was last modified: 2015-07-30 02:29 by nappington.)
Post: #3
RE: Embedding a variable upon compile
True that - however, that does require me to have a completely separate script for each serial speed variable and keep each of them up to date if I want to make any changes.

I would like to use a single embedded script so I'm wondering if there's any way to set it hardcoded into the binary itself, similar to how I can make changes to the 'version' setting on compilation.
Find all posts by this user
Quote this message in a reply
2015-08-01, 08:00
Post: #4
RE: Embedding a variable upon compile
You can create an setting that returns a separate value that you set on compile time.
But I don't see how that is easier than creating a build script..

Code:
#!/bin/bash
echo #!ipxe > embed.ipxe
echo set serialspeed $1 >> embed.ipxe
cat commonscript.ipxe >> embed.ipxe
make $2 EMBED=embed.ipxe

This will combine a variable and the base script when this buildscript is run.
So you will only have one script and the rest is still automatic.

adding an embeded script - is the same as setting it in the binary itself - just much easier then any alternative.

Use GitHub Discussions
VRAM bin
Visit this user's website Find all posts by this user
Quote this message in a reply
2015-08-02, 20:05
Post: #5
RE: Embedding a variable upon compile
Thanks for the answer - I wonder if there's an easier way to do it and if there's a way simply pull the baud rate directly from an iPXE shell? e.g. it's already in a variable somewhere that I can echo.
Find all posts by this user
Quote this message in a reply
Post Reply 




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