[ipxe-devel] ixpe cmdline not processing

Larry Brigman larry.brigman at gmail.com
Wed Aug 3 20:48:24 UTC 2011


On Tue, Aug 2, 2011 at 10:44 PM, Shao Miller <Shao.Miller at yrdsb.edu.on.ca>wrote:

> **
> On 8/3/2011 01:27, Larry Brigman wrote:
>
> On Tue, Aug 2, 2011 at 5:21 PM, Shao Miller <Shao.Miller at yrdsb.edu.on.ca>wrote:
>
>> On 8/2/2011 20:02, Andrew Stuart wrote:
>>
>>>  On 8/2/2011 2:13 PM, Larry Brigman wrote:
>>>
>>>> I have a grub line for ipxe but it's not processing the cmdline as it
>>>> thinks there is nothing there (see attached screen shot).
>>>> I'm using the main git repo with the last commit of:
>>>> commit 149b502306f7b5f7cc9d90cf2095f8dc6576375f
>>>> Author: Michael Brown <mcb30 at ipxe.org <mailto:mcb30 at ipxe.org>>
>>>> Date:   Sat Jul 16 01:29:20 2011 +0100
>>>>
>>>> Some clues on how to troubleshoot this issue?
>>>>
>>>
>>>  While I don't have any sound troubleshooting advise for you, I am
>>> curious if the following commit may have broke something (for you).
>>> My git-fu is non existent, but I am curious if you were to roll back
>>> previous to that commit, if it would change anything.
>>>
>>> Also, since it appears relevant to your use, it might indicate where you
>>> can add some extra debug information to see what's going on.
>>>
>>  I've added a little but it doesn't seem to tell me anything since it
> just says zero length.
>
>
> Just to clarify: You've responded to Andrew Stuart's post there, but also
> confirmed my guess down below.  Thanks. :)
>
>
>>> Mind you, I am a lurker/tinkerer. Doing as I suggest may very well kill
>>> your [cat|dog|fish|child|significant other].
>>>
>>>   ...
>>>
>>>
>>> commit be600ed9967d93f5012d5277d7ce8c e89d135918
>>> Author: Michael Brown <mcb30 at ipxe.org>
>>> Date:   Tue Jun 28 11:29:28 2011 +0100
>>>
>>>     [prefix] Cope with BOOT_IMAGE= anywhere within command line
>>>
>>>     Some bootloaders seem to add "BOOT_IMAGE=..." at the end of the
>>>    command line; some at the start.  Cope with either variation.
>>>  ...
>>>
>>
>> Woo-hoo!  What a nice feature. :)
>>
>> One of the files involved is ipxe/src/arch/i386/core/ cmdline.c.  Your
>> screen-shot, Larry, shows:
>>
>>   CMDLINE found ""
>>
>> which is a message that comes before the "BOOT_IMAGE=..." stripping.
>>
>> It might be interesting to add some temporary debugging code to show the
>> 'len':
>>
>>   static void cmdline_init ( void ) {
>>  ...
>>      size_t len;
>>
>>       /* Do nothing if no command line was specified */
>>      if ( ! cmdline_phys ) {
>>          DBGC ( image, "CMDLINE found no command line\n" );
>>          return;
>>      }
>>      cmdline_user = phys_to_user ( cmdline_phys );
>>      len = ( strlen_user ( cmdline_user, 0 ) + 1 /* NUL */ );
>>      DBGC ( image, "CMDLINE is %zd bytes\n", len );
>>
>>       /* Allocate and copy command line */
>>  ...
>>
>> However I would guess that it'd show 0.
>>
>
> That guess.
>
No it shows 1 but the +1 in the code is the reason it's not 0.

>
>
>> What version of GRUB and does a simple commandline work?:
>>
>>   kernel /ipxe.lkrn config
>>
>
>  Tried it with:
>
> kernel /ipxe.lkrn shell
>
> still not joy.
>
>
> Ok.  I was partly wondering if GRUB might've gotten jumbled up while
> parsing the command-line, either due to its length or due to the operators.
> I guess not (assuming "no joy" means "same debugging output"). :(
>
yes.

>
>  Grub version 0.97-13.5 from Centos 5.
>
>
> Well now it is hopefully reproducible by another person, at least.
>
> - Shao Miller
>

So how does this variable get set?
/** Command line physical address
 *
 * This can be set by the prefix.
 */
uint32_t __bss16 ( cmdline_phys );
#define cmdline_phys __use_data16 ( cmdline_phys )

I added the line with the info for both phy and virt addresses - here is the
output.

Didn't do a picture this time since I also have IPMI SOL to the box.
----------------------------
 Filesystem type is ext2fs, partition type
0x83
kernel /ipxe-debug.lkrn ifopen net4 && set net4/ip 134.242.160.142 && set
net4/
netmask 255.255.252.0 && set net4/gateway 134.242.160.254 && sanboot
http://10.
109.0.46/repo/RHEL6/rhel-server-6.0-x86_64-dvd.iso

   [Linux-zImage, setup=0x800,
size=0x4f889]


iPXE initialising devices...CMDLINE phy:99000 user:209fe740
len:1
CMDLINE found
""
CMDLINE using
""
CMDLINE freeing command
line
ok

----------------------------------
debug diff:
diff --git a/src/arch/i386/core/cmdline.c b/src/arch/i386/core/cmdline.c
index 595fdad..b65f581 100644
--- a/src/arch/i386/core/cmdline.c
+++ b/src/arch/i386/core/cmdline.c
@@ -78,6 +78,8 @@ static void cmdline_init ( void ) {
        cmdline_user = phys_to_user ( cmdline_phys );
        len = ( strlen_user ( cmdline_user, 0 ) + 1 /* NUL */ );

+        DBGC( image, "CMDLINE phy:%x user:%lx
len:%zd\n",cmdline_phys,cmdline_user,len);
+
        /* Allocate and copy command line */
        cmdline_copy = malloc ( len );
        if ( ! cmdline_copy ) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20110803/445da8fd/attachment.htm>


More information about the ipxe-devel mailing list