[Etherboot-users] Using pxe with a single dhcp server
Brought to you by:
marty_connor,
stefanhajnoczi
From: John N. <jn...@it...> - 2003-11-26 23:26:59
|
This small patch for etherboot 5.3.4 will check to see if the DHCP supplied filename ends with ".zpxe". If it does then the extension is trimmed off. This allows pxe to load etherboot and then etherboot to load a different nbi without having to make the dhcp server check what the client is. This example works with ISC dhcp 2 group { host sb101-99 { fixed-address sb101-99; hardware ethernet 00:d0:b7:90:4a:11; filename "eepro100.zpxe"; next-server 192.168.5.41; } } In your tftp directory you need eepro100.zpxe - etherboot .zpxe image eepro100 - nbi that you want to boot The patch: diff -ruN etherboot-5.3.4/src/core/nic.c etherboot-5.3.4.jn/src/core/nic.c --- etherboot-5.3.4/src/core/nic.c Thu Aug 7 08:20:20 2003 +++ etherboot-5.3.4.jn/src/core/nic.c Thu Nov 27 09:51:11 2003 @@ -248,6 +248,7 @@ int eth_load(struct dev *dev __unused) { const char *kernel; + int i; printf("Me: %@, Server: %@", arptable[ARP_CLIENT].ipaddr.s_addr, arptable[ARP_SERVER].ipaddr.s_addr); @@ -271,6 +272,20 @@ #else kernel = KERNEL_BUF; #endif + i = 0; + while(kernel[i++]); + if(i > 5) + { + if(kernel[i - 6] == '.' && + kernel[i - 5] == 'z' && + kernel[i - 4] == 'p' && + kernel[i - 3] == 'x' && + kernel[i - 2] == 'e') + { + printf("Trimming file extension\n"); + kernel[i - 6] = 0; + } + } loadkernel(kernel); /* We don't return except on error */ printf("Unable to load file.\n"); interruptible_sleep(2); /* lay off the server for a while */ It probably needs some #defines so it can be make into a compile time option. John. -- Information Technology Innovation Group School of Information Technology Swinburne University of Technology Melbourne, Australia http://www.it.swin.edu.au/staff/jnewbigin |