Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about building iPXE with named configuration
2018-08-16, 15:36 (This post was last modified: 2018-08-16 15:38 by pxe_curious.)
Post: #1
Question about building iPXE with named configuration
I have been building iPXE undionly.kpxe and snponly.efi binaries for a while now.
There are some features I need that are not in the default build and some features I really do not need.
To get the build I want, I have been modifying the console.h and general.h files in the src/config folder. I have to really keep two sets of the general.h file, one for PCBIOS and one for EFI.
I realized from the get-go that my manual workaround for this is cumbersome but didn't think to check if there is a better way to do this.
I recently saw the named_config article but am not really sure how to use it, though I think this would solve my issue.

My question specifically then is:
Should I copy the edited versions of console.h and general.h files into a named folder into the src/config/local folder and leave the originals untouched?
Or is it sufficient to place respective text files with just the changed lines in the named local folder?
Would I need to add an explicit #undef for features I do not want?
Find all posts by this user
Quote this message in a reply
2018-08-16, 17:55
Post: #2
RE: Question about building iPXE with named configuration
Never change the original config/*.h
instead add new files to config/local/*.h which you add the specific changes to.
So yes always keep originals untouched.

If you are certain that there is features that you want to remove from the default build then #undef those yes
However do not create copies of original files and just undef anything that you don't think that you need.

Only undef if you know that specific setting is causing you issues.
Only define if you know that specific setting is needed for your uses.

But I would like to back up a little... Could you share the specific configs you have? And especially the reason for why you need to have one for PCBIOS and one for EFI ?
And if we see that you really do need different configs here than we can jump into the "named configs" part, but for now try to just use config/local instead.

Read the FAQ before posting.
Did you include relevant ipxe.org error urls?
Visit this user's website Find all posts by this user
Quote this message in a reply
2018-08-16, 19:19
Post: #3
RE: Question about building iPXE with named configuration
(2018-08-16 17:55)NiKiZe Wrote:  Never change the original config/*.h
instead add new files to config/local/*.h which you add the specific changes to.
So yes always keep originals untouched.

Does the content of the local file supersede the content of the other files?
Or does the file itself supersede?
I.e. should I make a copy of the whole file from src/config and edit that or create a new file that only includes the specific lines I want changed?
What I am understanding is to copy the files and make changes to them in the local folder. Just want to confirm I have this right.

(2018-08-16 17:55)NiKiZe Wrote:  But I would like to back up a little... Could you share the specific configs you have? And especially the reason for why you need to have one for PCBIOS and one for EFI ?

For both PCBIOS and EFI I edit the console.h file and uncomment the #define CONSOLE_FRAMEBUFFER line so that I can use the console command.

In the general.h file I have been making the following changes:
- change #undef DOWNLOAD_PROTO_NFS to #define DOWNLOAD_PROTO_NFS, in case we want to use NFS
- comment out #define HTTP_AUTH_BASIC and #define HTTP_AUTH_DIGEST, we are not using that currently
- comment out #define CRYPTO_80211_* since we are not using wireless
- PCBIOS only: uncomment IMAGE_COMBOOT line, we want to be able to use COMBOOT modules
- comment out interface management commands for wireless, Infiniband and fiber channel
- uncomment the NSLOOKUP_CMD line
- PCBIOS only: uncomment the PXE_CMD line
- uncomment PING_CMD
- uncomment CONSOLE_CMD

For EFI, the PXE_CMD and IMAGE_COMBOOT lines won't work. That's why I think I need two separate versions of general.h.
Find all posts by this user
Quote this message in a reply
2018-08-16, 20:01 (This post was last modified: 2018-08-16 21:40 by NiKiZe.)
Post: #4
RE: Question about building iPXE with named configuration
(2018-08-16 19:19)pxe_curious Wrote:  Does the content of the local file supersede the content of the other files?
Or does the file itself supersede?
I.e. should I make a copy of the whole file from src/config and edit that or create a new file that only includes the specific lines I want changed?
What I am understanding is to copy the files and make changes to them in the local folder. Just want to confirm I have this right.
Your local file is loaded after the general one, just as described on the named_configs page, you can also read the includes in the existing files.
I would recommend to only add what you need in your local/*.h
For example if the only thing I want to change is to have HTTPS enabled then my local/general.h would only have
Code:
#define     DOWNLOAD_PROTO_HTTPS
and nothing else

(2018-08-16 19:19)pxe_curious Wrote:  For both PCBIOS and EFI I edit the console.h file and uncomment the #define CONSOLE_FRAMEBUFFER line so that I can use the console command.
So that goes into config/local/general.h regardless since it is common for your builds.

(2018-08-16 19:19)pxe_curious Wrote:  In the general.h file I have been making the following changes:
- change #undef DOWNLOAD_PROTO_NFS to #define DOWNLOAD_PROTO_NFS, in case we want to use NFS
- comment out #define HTTP_AUTH_BASIC and #define HTTP_AUTH_DIGEST, we are not using that currently
- comment out #define CRYPTO_80211_* since we are not using wireless
- PCBIOS only: uncomment IMAGE_COMBOOT line, we want to be able to use COMBOOT modules
- comment out interface management commands for wireless, Infiniband and fiber channel
- uncomment the NSLOOKUP_CMD line
- PCBIOS only: uncomment the PXE_CMD line
- uncomment PING_CMD
- uncomment CONSOLE_CMD

For EFI, the PXE_CMD and IMAGE_COMBOOT lines won't work. That's why I think I need two separate versions of general.h.

DOWNLOAD_PROTO_NFS works for both, don't enable until you need to use it, and it is seemed as insecure so not allowed for signed EFI binaries. (which is one reason to avoid it for now)
HTTP_AUTH_* Do you need to disable them for any particular reason?
No wireless devices is pulled in by unidonly or snponly builds - so no need to disable any of that since it isn't included anyway.
If you are using Comboot.. then that needs some special handling.
Again, are commands in the way and causing you issues?
What are you using PXE_CMD for (which is the undocumented "startpxe" and "stoppxe")?
PING and CONSOLE, yup nice to have, common for both EFI and PCBIOS so goes into common one.

The reason for not changing anything unless you "have to" is that you might break something. So again only change a setting if you get errors without changing it.

After this I think you end up with only needing special case for COMBOOT
one way to do this is to use something like
Code:
#ifdef CONSOLE_PCBIOS
#define IMAGE_COMBOOT
#endif
this works via defaults.h which is pulled in by most configs, which in turn pulls in defaults/{_platform}.h
and since our local/*.h files are pulled in after anything else and can override those settings, we can also use those settings to define different behavior.

By checking the last 6 or so lines of general.h you can see how the order of includes are generally done.

Read the FAQ before posting.
Did you include relevant ipxe.org error urls?
Visit this user's website Find all posts by this user
Quote this message in a reply
2018-08-16, 21:39
Post: #5
RE: Question about building iPXE with named configuration
Brilliant!

So essentially, considering your explanations of some of these options, my src/config/local/general.h file should look like this:
Code:
#define CONSOLE_FRAMEBUFFER

#define NSLOOKUP_CMD
#define PING_CMD
#define CONSOLE_CMD

#ifdef CONSOLE_PCBIOS
#define IMAGE_COMBOOT
#endif

I changed the #ifndef to an #ifdef since I do want COMBOOT support for BIOS builds.

This seems a lot simpler Wink

Thank you!
Find all posts by this user
Quote this message in a reply
2018-08-16, 21:41
Post: #6
RE: Question about building iPXE with named configuration
(2018-08-16 21:39)pxe_curious Wrote:  I changed the #ifndef to an #ifdef since I do want COMBOOT support for BIOS builds.
Right, sorry for the copy paste error, updated original post as to not create any confusion in the future.

Read the FAQ before posting.
Did you include relevant ipxe.org error urls?
Visit this user's website Find all posts by this user
Quote this message in a reply
2018-08-16, 22:32
Post: #7
RE: Question about building iPXE with named configuration
Just noticed that #define CONSOLE_FRAMEBUFFER has to go into src/config/local/console.h or it won't work. So the options have to go into their respective files in local.

Tested it and this works great!! Even though I am leaving some of the options enabled, it actually produced an even smaller binary.

Again, thank you NiKiZe, this was very enlightening.
Find all posts by this user
Quote this message in a reply
Post Reply 




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