[ipxe-devel] Unable to load custom menu in gPXE / iPXE scripts chaining to pxelinux.0 with dhcp option 209

Chee-Yang Chau cychau at gmail.com
Sat Nov 19 01:41:33 UTC 2011


I have tried both syslinux 4.04 and 4.10's menu.c32, and it doesn't
work.   However Syslinux 3.86 works.  How is your configuration?

2011/11/19 Slawomir Latkowski <slawomir.latkowski at gmail.com>:
> Hi,
> The way i use it is the latest syslinux 4.04 menu.c32 and use menu.c32
> directly as follows boot.php:
>
> <?php
>
> header ( "Content-type: text/plain" );
>
> $uri=$_SERVER["REQUEST_URI"];
> $dir=substr ( $uri, 0, strrpos ($uri, "/") + 1);
>
> echo "#!gpxe\n";
> echo "imgfree\n";
> echo "login\n";
> echo "chain ".
>      "https://\${username:uristring}:\${password:uristring}@".
>      $_SERVER["HTTP_HOST"].$dir.
>      "menu.c32 menu.php\n";
> ?>
>
> menu.php needs small correction:
>
>   <?php
>
>   header ( "Content-type: text/plain" );
>
>   $username = $_SERVER["PHP_AUTH_USER"];
>   $password = $_SERVER["PHP_AUTH_PW"];
>
>   $index = 0;
>
>   function title ( $title ) {
>     global $username;
>     echo "menu title ".$title;
>     echo ( $username ? " for ".$username : "" )."\n";
>   }
>
>   function label ( $label ) {
>     global $index;
>     $index++;
>     echo "label item".$index."\n";
>     echo "  menu label ";
>     echo "^".( ( $index < 10 ) ? $index :
>                sprintf ( "%c", $index + ord ( 'A' ) - 10 ) )." ";
>     echo $label."\n";
>   }
>
>   function sanboot ( $label, $root_path ) {
>     label ( $label );
>     echo "  kernel cmd.c32\n";
>     echo "  append sanboot ".$root_path."\n";
>     echo "\n";
>   }
>
>   function uriboot ( $label, $uri, $args ) {
>     label ( $label );
>     echo "  kernel ".$uri."\n";
>     if ( $args )
>         echo "  append ".$args."\n";
>   }
>
>   function retry () {
>     echo "label failed\n";
>     echo "  menu label Authentication Failed\n";
>     echo "  menu disable\n";
>     uriboot ( "Try again", "boot.php", "" );
>   }
>
>   function authenticated () {
>     global $username;
>     global $password;
>
>     switch ( "$username:$password" ) {
>     case "mcb30:password":
>     case "guest:guest":
>       return 1;
>     default:
>       return 0;
>     }
>   }
>
>   ?>
>
>   menu background atlantis.png
>   prompt 0
>   timeout 100
>   allowoptions 0
>   menu timeoutrow 29
>   menu vshift 2
>   menu rows 8
>   menu color title  1;36;44   #ff8bc2ff #00000000 std
>   menu color unsel  37;44     #ff1069c5 #00000000 std
>   menu color sel    7;37;40   #ff000000 #ffff7518 all
>   menu color hotkey 1;37;44   #ffffffff #00000000 std
>   menu color hotsel 1;7;37;40 #ff000431 #ffff7518 all
>
>   <?php // <<<<<<<<<<<<<<<<<<<<<<< THIS PART IS MISSING
>
>   title ( "Secure Network Boot" );
>
>   if ( ! authenticated() ) {
>     retry();
>   } else {
>
>     if ( $username == "mcb30" ) {
>
>       sanboot ( "MS-DOS 6.22",
>                 "iscsi:chipmunk.tuntap::::iqn.2007-07.chipmunk:msdos622" );
>
>       sanboot ( "Windows 2k3",
>                 "iscsi:chipmunk.tuntap::::iqn.2007-07.chipmunk:win2k3" );
>
>     }
>
>     uriboot ( "Linux rescue shell",
>               "http://chipmunk.tuntap/images/uniboot/uniboot.php", "" );
>   }
>
>   ?>
>
> It works with me
> Hope it helps.
> Regards
> Slawek
> W dniu 18 listopada 2011 17:08 użytkownik Sven Dreyer <sven at dreyer-net.de>
> napisał:
>>
>> Am 18.11.2011 16:20, schrieb Chee-Yang Chau:
>>>
>>> Due to the lack of support of menu in iPXE, I force to use chain to
>>> PXELinux's menu.
>>
>> I'm also using a menu and doing it in a (as I think) simpler fashion:
>>
>> BIOS > NIC's PXE ROM > DHCP and TFTP > ipxe.kpxe > script (see below) >
>> menu.c32 > menu.cfg
>>
>> The script goes like this:
>> <SNIP>
>> #!ipxe
>> chain http://my-server/menu/menu.c32 http://my-server/menu.cfg
>> </SNIP>
>>
>> menu.c32 is from syslinux 3.86, later versions use a different module
>> format.
>> menu.cfg contains the menu's configuration
>>
>> Hope this helps,
>> Sven
>> _______________________________________________
>> ipxe-devel mailing list
>> ipxe-devel at lists.ipxe.org
>> https://lists.ipxe.org/mailman/listinfo/ipxe-devel
>
>



-- 
Best regards,
Chau Chee Yang



More information about the ipxe-devel mailing list