The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 807 - File: showthread.php PHP 7.3.15 (Linux)
File Line Function
/showthread.php 807 errorHandler->error





Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Disable options in menu based on CPU
2016-03-16, 18:30
Post: #1
Disable options in menu based on CPU
Hello,

I'm trying to write a dynamic boot menu using php.
However, since i'll have to support different CPU types and architectures, i'd like to remove certain menu options (or do not display) based on the CPU type.

I know that I can use CPUID --ext29 to check if the machine supports x64; and I already supply the machines with different ipxe versions (undionly.kpxe, ipxe_x86.efi and ipxe_x64.efi)

However, somehow I need to provide the architecture while calling the PHP script; or I need an if statement in ipxe to not display the item.

I've tried putting the following options in my DHCP:

Code:
if exists user-class and option user-class = "iPXE" {
    ## filename "http://10.168.51.5/bmenu.php?host=${serial}";
       if option arch = 00:06 {
                 filename "http://10.168.51.5/bmenu.php?host=${serial}&arch=Uefix86";
         } elsif option arch = 00:07 {
                  filename "http://10.168.51.5/bmenu.php?host=${serial}&arch=Uefix64";
         } elsif option arch = 00:00 {
                 filename "http://10.168.51.5/bmenu.php?host=${serial}&arch=Legx86";
        }  else {
                 filename "http://10.168.51.5/bmenu.php?host=${serial}&arch=unknown";
        }

} else {
        if option arch = 00:06 {
                filename "ipxe_x86.efi";
         } elsif option arch = 00:07 {
                 filename "ipxe_x64.efi";
         } elsif option arch = 00:00 {
                 filename "undionly.kpxe";
        }
  }
}

however, the x64 machines do receive the ipxe_x64.efi file (so the first time it requests the arch it is indeed 00:07; however, when booted to my boot menu, it display 'arch=unknown', so the 'arch=Uefix64' is not relevant

A machine booted to undionly.kpxe does display 'Legx86'.

Also, if there is a better way to pass the arch variable into the php url, please let me know. I'm using an if statement because that works in the first load-out of ipxe Smile
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Disable options in menu based on CPU - Fimlore - 2016-03-16 18:30



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