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?

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?

(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.

(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?