[gPXE-devel] [PATCH][lkrn] add cmdline and ramdisk support

Wu Fengguang fengguang.wu at intel.com
Wed Jun 2 10:32:21 EDT 2010


> How about this cmdline syntax:
> 
>         APPEND  #!gpxe; dhcp net0; kernel URL root=...; boot;
> 
> - the '#!gpxe' declares the start of a gPXE script (this will exclude
>   the BOOT_IMAGE=... added by GRUB)
> 
> - the followed ';' declares that the semicolon will be treated as
>   the DELIMITER (think about the '/' in :s/a/b/ for vim)
> 
> - each gPXE must end with the DELIMITER, ie. the last ';' is not
>   optional (this will exclude the BOOT_IMAGE=... appended by PXELinux)
> 
> > I'd really enjoy reading what the gPXE core developer usual suspects
> > have to offer. :)
> 
> The February 12th, 2009 incarnation[1] (not the original January incarnation) used ';' as command delimiter, so I don't disagree with you, there.  Since the boot-loader-appended ' BOOT_IMAGE= ' should fall after the last command (which should do some booting), it would favourably be ignored...  Unless the booting command should fail, of course.
> [1] http://sourceforge.net/mailarchive/message.php?msg_name=F0E5F8699DE1364584CDB894E99713551187F589%40YRDSB5.YRDSB.YRDSB.NET

Yeah that's close to the one I proposed above, except that you missed the point
that the delimiter is actually determined by user input (not hard coded to ';'
in code).

This code block illustrates the exact idea.

+       if ( linux_cmdline ) {                                                                                                       
+               char *p, *q, delimiter;                                                                                              
+                                                                                                                                    
+               DBG ( "Found cmdline at %lx: ", linux_cmdline );                                                                     
+               copy_from_user ( buf, phys_to_user( linux_cmdline ),                                                                 
+                                0, sizeof ( buf ) );                                                                                
+               buf[sizeof ( buf ) - 1] = '\0';                                                                                      
+                                                                                                                                    
+               p = strstr ( buf, "#!gpxe" );                                                                                        
+               if ( p ) {                                                                                                           
+                       for ( p += 6; *p == ' '; p++ )                                                                               
+                               ;                                                                                                    
+                       delimiter = *p;                                                                                              
+                       while ( ( q = strchr ( ++p , delimiter ) ) ) {                                                               
+                               *q = '\0';                                                                                           
+                               system ( p );                                                                                        
+                               p = q;                                                                                               
+                       }                                                                                                            
+               }                                                                                                                    
+       }                                                                                                                            

> To be honest, concerns around decisions regarding command syntax
> have been blocks against my submissions for initrd+cmdline and gPXE
> CLI/scripting enhancements, historically, as Stefan has just
> confirmed.

Agreed, the cmdline UI syntax is hard to get right.

Thanks,
Fengguang


More information about the gPXE-devel mailing list