skip unplugged network cards
|
2016-01-05, 15:39
(This post was last modified: 2016-01-05 15:40 by silver310.)
Post: #1
|
|||
|
|||
skip unplugged network cards
Hi, so after working with iPXE for the last few months and having a working environment the only thing that bugged me is having to wait for ipxe to try and configure every NIC that is present even if it's not connected.
So after getting a hint on the IRC channel i managed to make some modifications to the code and write a startup script that will skip unplugged NICs. Note: only after I finished this i discovered that undionly or snponly doesn't have this issue, since they only use the NIC that made the actual PXE boot, but undionly downloads a little slower (300Mb took 2 seconds with ipxe.kkkpxe and 6 seconds with undionly, snponly vs ipxe.efi both download at the same rate) So I figured I'll explain how to accomplish this so maybe it'll help others. First of all some code needs to be added in net/netdev_settings.c and include/ipxe/settings.h. netdev_settings.c: find the following comment /** Network device predefined settings */ below it add: Code: const struct setting link_setting __setting ( SETTING_NETDEV, link ) = { add the following function (i added it before store MAC settings) Code: /** find the following comment /** Network device settings */ and below it add Code: { &link_setting, NULL, netdev_fetch_link }, in settings.h somewhere between lines 420-460 add the following Code: extern const struct setting with those changes I can compile without any errors, now for the startup script (the script embedded with ipxe when building) I use the following one: Code: #!ipxe Now if you have multiple NICs or ports that are not connected, iPXE with skip those and only boot using the one that is up. My knowledge with C isn't all that great, so I'm pretty sure the code can be made batter, with those changes when you write "echo ${net0/link}" you'll get either 0x0 (link up) or a sequence of numbers (like 0x141215) meaning link is down, this can probably be changes to show "Up" or "Down, but for me the current state is fine. PS. I've tried using ipxe.pxe and couldn't even get a 100mb link, max is 10mb, and at that speed booting is extremely slow, would love to find out why. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
skip unplugged network cards - silver310 - 2016-01-05 15:39
RE: skip unplugged network cards - robinsmidsrod - 2016-11-02, 11:11
|
User(s) browsing this thread: 1 Guest(s)