how now handles the client system architecture (BIOS, UEFI x32, UEFI x64, etc …).


sir how Please tell can I handles the client system architecture (BIOS, UEFI x32, UEFI x64, etc …) wia TFTPD32 4.60 dhcp server
Or how configure it for multiple boot type like boot UEFI and Legacy bios pc with different boot file. Thanks

file attachments


hsharma2000 wrote Feb 4 at 12:49 PM

and like this

PhJounin wrote Feb 5 at 7:26 PM

You can configure DHCP to send a boot file name like "boot.$IP$.pxe".
Tftpd64 will substitute the "$IP$" string with the given IP address.
The $MAC$ keywork is also translated with the MAC address of the requesting device.

hsharma2000 wrote Feb 6 at 3:19 AM

thanks for reply but sir I want to this type of code in TFTPD32

For example, in the dhcp configuration file, something similar to the following conditions could be used:

; This one line must be outside any bracketed scope
option architecture-type code 93 = unsigned integer 16;

class "pxeclients" {
 match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";

 if option architecture-type = 0 {
     filename "path/to/BIOS/pxelinux.0";
 } elsif option architecture-type = 9 {
     filename "path/to/EFIx64/bootx64.efi";
 } elsif option architecture-type = 7 {
     filename "path/to/EFIx64/bootx64.efi";
 } elsif option architecture-type = 6 {
     filename "path/to/EFIia32/bootia32.efi";

panreyes wrote Mar 24 at 5:15 PM


I'm interested in this field too, and I made some progress on it doing some little "hacking" in bootpd*.c and bootpd*.h. I'm no good at C, but it seems to be working.

What I do is:
  1. Read the DHCP packet's options, looking for 93,2,0 and 9/7/6
  2. Depending on the architecture, I replace a variable in the boot file name with efi-x86, efi-x64 or bios-x86
I'll release those changes as soon as I'm sure they work, but I must say they're pretty dirty as C is not may native tongue :)

panreyes wrote Mar 30 at 12:02 AM

Hi again!

I've tried to do it, and got some results, but didn't get to make it work in the end:

in _services\bootpd_functions.h, added this global variable in the end:
char last_architecture[10];

in _services\bootpd.c, added this little code just below of case DHCPREQUEST:
        case DHCPREQUEST :
_           int i;
                if(pDhcpPkt->options[i]==93 && pDhcpPkt->options[i+1]==2 && pDhcpPkt->options[i+2]==0) {
                    if(pDhcpPkt->options[i+3]==7 || pDhcpPkt->options[i+3]==9) {
                        strcpy(last_architecture, "efi-x64");
                        LOG (5, "EFI ARCHITECTURE!!!!: %s ", last_architecture);
                    if(pDhcpPkt->options[i+3]==6) {
                        strcpy(last_architecture, "efi-x86");
                        LOG (0, "EFI ARCHITECTURE!!!!: %s ", last_architecture);
{BOOL bSERVER = FALSE;  // TRUE if Tftpd32 has assigned this address
With this we get the architecture of the last computer that did a "DHCPREQUEST".

And in function TranslateExp, in bootpd_util.c, I added this:
    else if ( (q=strstr (exp, "$MAC$")) != NULL )
       lstrcpyn (sz, exp, 1 + q - exp);
       lstrcat (sz, haddrtoa (tMac, 6, '.') );
       lstrcat (sz, q + sizeof "$MAC$" - 1);
       lstrcpyn (to, sz, DHCP_FILE_LEN - 1);
 __   else if ( (q=strstr (exp, "$ARCH$")) != NULL )
       lstrcpyn (sz, exp, 1 + q - exp);
       lstrcat (sz, last_architecture );
       lstrcat (sz, q + sizeof "$ARCH$" - 1);
       lstrcpyn (to, sz, DHCP_FILE_LEN - 1);
    else if ( (q=strstr (exp, "$BootFileName$")) != NULL )
Those changes make the boot filename to change depending the architecture. The problem is that it works fine if you're using syslinux and don't care about UEFI Secure Boot. If you try to use Windows BOOTMGR, it won't work along with BIOS boot as it looks for the BCD in the same place (\Boot\BCD).

One solution would be changing the way the TFTP works so it will serve from different folders depending on the architecture, but that was too complicated for me. I tried, but got "peer errors" and aborted connections for some reason...

Also, the "last architecture" is not the one of the current computer that asked for a file. If two computers of different boot architectures try to boot at the same time, the TFTP will serve the files randomly.
There should also be a MAC-Architecture relation table in order to serve the files correctly.

PS: Please excuse my bad english, as it's also not my native tongue ;)

hsharma2000 wrote Mar 30 at 3:50 AM

we can use option 252 (boot file name) if we got (arch) command in working mode
@arch\bcd (see pic in attachments).

panreyes wrote Mar 30 at 8:25 AM

Oh! I see...
I'll try that then and come back later with results. Thanks! :)