Mailing List Archive

pxelinux bug's
Hello Peter,

The attached patch contains three small (although 2 of them are
fundamental :) fixes for pxelinux

1. Alignment error when more than one initramfs are loaded using initrd
- the alignment of the last disk is discarded in calculations but is
ALWAYS present when the loading procedure is called. As a result - the
second image (cpio) is not recognized.

2. On some platforms (vmware for example :), READING from the video memory
in the 32bit mode is impossible (causes an exeption). Taking in to account
that the scroll function in ilinux/arch/i386/boot/compressed/misc.c
works using a memcpy of the video memory, when the linux bootsector is given
control and the cursor is at the end of the screen (-1-2 lines) an exception is
arisen and in the presence of it's handler in the bootloader the system halts.
Both lilo and grub handle this situation - the cursor is always somewhere at the
middle of the screen when the control is given to the linux bootsector.
When using pxelinux taking in to account that the PXE bios prints out the
presence of the second initramfs which causes the screen to scroll and the bug
to appear :)
A very simple solution - the screen is cleared before giving control to the
linux bootsector (in the patch).

3. If more than one initramfs are loaded then before every "Loading..."
message (but the first) an extra new line is added. A small thingy but
anyway :)

--
Best regards,
Iouri mailto:bc-info@styx.cabel.net
Re: pxelinux bug's [ In reply to ]
Op 19-06-2007 om 00:31 schreef Iouri Kharon:
> Hello Peter,
>
> The attached patch contains three small (although 2 of them are
> fundamental :) fixes for pxelinux

Peter prefers patches created with git.



Mmm, that is way to short.
Now in other words:

The syslinux source code, which includes pxelinux,
is in a version control system called git.

Please provide patches generated by git.


Cheers
Geert Stappers

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: pxelinux bug's [ In reply to ]
Hi Geert!

Tuesday, June 19, 2007, you wrote:

>> The attached patch contains three small (although 2 of them are
>> fundamental :) fixes for pxelinux
GS> Peter prefers patches created with git.
Diff was created as -uP (old Linus style :). Ok, I'm recreate it with -up,
"not compress", and include inline :). But also attach is as text (included
attachment can't used for patch :).

Redescription:
1. Alignment error when more than one initramfs are loaded using initrd
- the alignment of the last disk is discarded in calculations but is
ALWAYS present when the loading procedure is called. As a result - the
second image (cpio) is not recognized.

2. On some platforms (vmware for example :), READING from the video memory
in the 32bit mode is impossible (causes an exeption). Taking in to account
that the scroll function in ilinux/arch/i386/boot/compressed/misc.c
works using a memcpy of the video memory, when the linux bootsector is given
control and the cursor is at the end of the screen (-1-2 lines) an exception is
arisen and in the presence of it's handler in the bootloader the system halts.
Both lilo and grub handle this situation - the cursor is always somewhere at the
middle of the screen when the control is given to the linux bootsector.
When using pxelinux taking in to account that the PXE bios prints out the
presence of the second initramfs which causes the screen to scroll and the bug
to appear :)
A very simple solution - the screen is cleared before giving control to the
linux bootsector (in the patch).

3. If more than one initramfs are loaded then before every "Loading..."
message (but the first) an extra new line is added. A small thingy but
anyway :)

Best regards,
Iouri mailto:bc-info@styx.cabel.net
-------------------------------------
--- syslinux-3.51/runkernel.inc.orig 2007-06-11 02:51:39.000000000 +0400
+++ syslinux-3.51/runkernel.inc 2007-06-19 12:19:37.000000000 +0400
@@ -472,6 +472,14 @@ kill_motor:
int 16h
%endif
;
+; MUST clear screen before jmp to linux boot sector:
+; some configuration can't read videomemory and 'scroll' in misc.c don't work
+;
+ mov ax,0fh
+ int 10h
+ mov ax,3
+ int 10h
+;
; Set up segment registers and the Linux real-mode stack
; Note: es == the real mode segment
;
@@ -600,11 +608,8 @@ loadinitrd:
mov es,ax

push ecx ; Bytes to load
- cmp dword [es:su_ramdisklen],0
- je .nopadding ; Don't pad the last initrd
add ecx,4095
and cx,0F000h
-.nopadding:
add [es:su_ramdisklen],ecx
mov edx,[HighMemSize] ; End of memory
dec edx
@@ -626,6 +631,11 @@ loadinitrd:
mov edi,edx ; initrd load address
push si
mov si,crlfloading_msg ; Write "Loading "
+ cmp ecx,[es:su_ramdisklen]
+ je .firstdisk
+ inc si ; Skip (doubling) CRLF on non first disk
+ inc si
+.firstdisk:
call cwritestr
mov si,InitRDCName ; Write ramdisk name
call cwritestr


--
Best regards,
Iouri mailto:bc-info@styx.cabel.net
Re: pxelinux bug's [ In reply to ]
Iouri Kharon wrote:
> Hello Peter,
>
> The attached patch contains three small (although 2 of them are
> fundamental :) fixes for pxelinux
>
> 1. Alignment error when more than one initramfs are loaded using initrd
> - the alignment of the last disk is discarded in calculations but is
> ALWAYS present when the loading procedure is called. As a result - the
> second image (cpio) is not recognized.

Ouch.

> 2. On some platforms (vmware for example :), READING from the video memory
> in the 32bit mode is impossible (causes an exeption). Taking in to account
> that the scroll function in ilinux/arch/i386/boot/compressed/misc.c
> works using a memcpy of the video memory, when the linux bootsector is given
> control and the cursor is at the end of the screen (-1-2 lines) an exception is
> arisen and in the presence of it's handler in the bootloader the system halts.
> Both lilo and grub handle this situation - the cursor is always somewhere at the
> middle of the screen when the control is given to the linux bootsector.
> When using pxelinux taking in to account that the PXE bios prints out the
> presence of the second initramfs which causes the screen to scroll and the bug
> to appear :)
> A very simple solution - the screen is cleared before giving control to the
> linux bootsector (in the patch).

This is a Vmware bug. It may need reworking in Linux, I don't know, but
I'm a bit reluctant to simply clear the screen in syslinux.

What version(s) of Vmware has this cockup in it?

> 3. If more than one initramfs are loaded then before every "Loading..."
> message (but the first) an extra new line is added. A small thingy but
> anyway :)

That should be fixed, though.

In the future, it would be better to get this as individual patches
rather than all baked together.

-hpa

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: pxelinux bug's [ In reply to ]
Iouri Kharon wrote:
>
> Redescription:
> 1. Alignment error when more than one initramfs are loaded using initrd
> - the alignment of the last disk is discarded in calculations but is
> ALWAYS present when the loading procedure is called. As a result - the
> second image (cpio) is not recognized.
>

I'm not sure this is correct (there is probably a bug, but this fix is
definitely incorrect.) In particular, any rounding of su_ramdisklen for
the case of a single file is not acceptable.

Could you be a bit more explicit what you mean with "he alignment of the
last disk is discarded in calculations but is ALWAYS present when the
loading procedure is called"?

-hpa

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: pxelinux bug's [ In reply to ]
Hi H.!

Thursday, June 21, 2007, you wrote:


>> A very simple solution - the screen is cleared before giving control to the
>> linux bootsector (in the patch).
HPA> This is a Vmware bug. It may need reworking in Linux, I don't know, but
HPA> I'm a bit reluctant to simply clear the screen in syslinux.

HPA> What version(s) of Vmware has this cockup in it?
Checked in latest (6.0), but bios not changed in 5.0/5.5/6.0

>> 3. If more than one initramfs are loaded then before every "Loading..."
>> message (but the first) an extra new line is added. A small thingy but
>> anyway :)
HPA> That should be fixed, though.
Thanks

HPA> In the future, it would be better to get this as individual patches
HPA> rather than all baked together.
Ok

Best regards,
Iouri mailto:bc-info@styx.cabel.net

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: pxelinux bug's [ In reply to ]
Could you try this patch and see if it solves your multi-initrd problem?

-hpa
Re: pxelinux bug's [ In reply to ]
I have pushed out a version 3.52-pre1 which has these workarounds
(untested) in it...

Please test it out and let me know if it does the job.

-hpa

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: pxelinux bug's [ In reply to ]
Hi H.!

Thursday, June 21, 2007, you wrote:

HPA> Could you be a bit more explicit what you mean with "he alignment of the
HPA> last disk is discarded in calculations but is ALWAYS present when the
HPA> loading procedure is called"?

Reference linenumber in 3.51 (runkernel.inc)

line 603 ('alignment discarded for last disk'; last(in mem) = first loaded):

cmp dword [es:su_ramdisklen], 0
je .nopadding
add ecx,4095
and cx,0F000h
.nopadding


line 617 ('ALWAYS present when called'):
mov dx,0FFFh
mov bx,load_dot
call load_high

:)
When load second disk, first disk aligned in load_high, but it size was not aligned
in line 603.

-----------------
Why align to page (not dword)? If see in linux/init/initramfs.c:unpack_to_rootfs()

while(...) {
if (*buf == '0' && !(this_header & 3)) { // e.g. aligned to 32bit
.....
}
if (!*buf) {
++buf;
--len;
++this_header;
continue;
}
// unpack and/or load cpio-archieve UNALIGNED

?


Best regards,
Iouri mailto:bc-info@styx.cabel.net

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: pxelinux bug's [ In reply to ]
Iouri Kharon wrote:
> Why align to page (not dword)? If see in linux/init/initramfs.c:unpack_to_rootfs()

Because the beginning has to be page-aligned, but the core loader
doesn't know a priori what the alignment will be. The C code is a lot
smarter.

-hpa

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: pxelinux bug's [ In reply to ]
Hi H.!

Thursday, June 21, 2007, you wrote:


HPA> Iouri Kharon wrote:
>> Why align to page (not dword)? If see in linux/init/initramfs.c:unpack_to_rootfs()

HPA> Because the beginning has to be page-aligned, but the core loader
Beginning - yes. But everyone (image)?

HPA> doesn't know a priori what the alignment will be. The C code is a lot
HPA> smarter.
Gm. Load with aling(dword), and after loading last (first im memory) disk,
memcpy all images if neded :).

Best regards,
Iouri mailto:bc-info@styx.cabel.net

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: pxelinux bug's [ In reply to ]
Iouri Kharon wrote:
> Hi H.!
>
> Thursday, June 21, 2007, you wrote:
>
>
> HPA> Iouri Kharon wrote:
>>> Why align to page (not dword)? If see in linux/init/initramfs.c:unpack_to_rootfs()
>
> HPA> Because the beginning has to be page-aligned, but the core loader
> Beginning - yes. But everyone (image)?
>
> HPA> doesn't know a priori what the alignment will be. The C code is a lot
> HPA> smarter.
> Gm. Load with aling(dword), and after loading last (first im memory) disk,
> memcpy all images if neded :).
>

There is no reason to do the extra copy, though, so we might as well not.

Anyway, does 3.52-pre1 work for you?

-hpa

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.