Add support for "pseudo-kernels" < 64K in size.
authorhpa <hpa>
Mon, 10 Dec 2001 07:38:23 +0000 (07:38 +0000)
committerhpa <hpa>
Mon, 10 Dec 2001 07:38:23 +0000 (07:38 +0000)
NEWS
isolinux.asm
ldlinux.asm
pxelinux.asm

diff --git a/NEWS b/NEWS
index f18dc3e..6c30706 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ Changes in 1.65:
          correctly; unfortunately many BIOSes apparently don't.
        * Support Linux boot protocol version 2.03 (explicitly
          specify the initrd address limit.)
+       * Handle small "pseudo-kernels"; images that use the Linux
+         kernel boot protocols but are less than 64K in size.
 
 Changes in 1.64:
        * Limited support for hardware flow control when using a
index 5aaa3d0..1c165bc 100644 (file)
@@ -1726,14 +1726,20 @@ kernel_good:
 ; kernel code. The boot sector is never executed when using an external
 ; booting utility, but it contains some status bytes that are necessary.
 ;
-; First check that our kernel is at least 64K and less than 8M (if it is
+; First check that our kernel is at least 1K and less than 8M (if it is
 ; more than 8M, we need to change the logic for loading it anyway...)
 ;
+; We used to require the kernel to be 64K or larger, but it has gotten
+; popular to use the Linux kernel format for other things, which may
+; not be so large.
+;
 is_linux_kernel:
                 cmp dx,80h                     ; 8 megs
                ja kernel_corrupt
                and dx,dx
-               jz kernel_corrupt
+               jnz kernel_sane
+               cmp ax,1024                     ; Bootsect + 1 setup sect
+               jb near kernel_corrupt
 kernel_sane:   push ax
                push dx
                push si
@@ -1775,6 +1781,10 @@ kernel_sane:     push ax
                call abort_check                ; Check for abort key
                mov cx,[ClustPerMoby]
                shr cx,1                        ; Half a moby
+               cmp cx,[KernelClust]
+               jna .normalkernel
+               mov cx,[KernelClust]
+.normalkernel:
                sub [KernelClust],cx
                xor bx,bx
                 pop si                          ; Cluster pointer on stack
@@ -2016,6 +2026,8 @@ high_load_loop:
                 call cwritestr
                 call abort_check
                 mov cx,[KernelClust]
+               and cx,cx
+               jz high_load_done               ; Zero left (tiny kernel?)
                cmp cx,[ClustPerMoby]
                jna high_last_moby
                mov cx,[ClustPerMoby]
index 6b5a9ba..eabc312 100644 (file)
@@ -1774,14 +1774,20 @@ kernel_good:
 ; stuff means 512 bytes *no matter what*, so here I am using that piece
 ; of knowledge.
 ;
-; First check that our kernel is at least 64K and less than 8M (if it is
+; First check that our kernel is at least 1K and less than 8M (if it is
 ; more than 8M, we need to change the logic for loading it anyway...)
 ;
+; We used to require the kernel to be 64K or larger, but it has gotten
+; popular to use the Linux kernel format for other things, which may
+; not be so large.
+;
 is_linux_kernel:
                 cmp dx,80h                     ; 8 megs
                ja kernel_corrupt
                and dx,dx
-               jz kernel_corrupt
+               jnz kernel_sane
+               cmp ax,1024                     ; Bootsect + 1 setup sect
+               jb kernel_corrupt
 kernel_sane:   push ax
                push dx
                push si
@@ -1823,6 +1829,10 @@ kernel_sane:     push ax
                call abort_check                ; Check for abort key
                mov cx,[ClustPerMoby]
                shr cx,1                        ; Half a moby
+               cmp cx,[KernelClust]
+               jna .normalkernel
+               mov cx,[KernelClust]
+.normalkernel:
                sub [KernelClust],cx
                xor bx,bx
                 pop si                          ; Cluster pointer on stack
@@ -2121,6 +2131,8 @@ high_load_loop:
                 call cwritestr
                 call abort_check
                 mov cx,[KernelClust]
+               and cx,cx
+               jz high_load_done               ; Zero left (tiny kernel?)
                cmp cx,[ClustPerMoby]
                jna high_last_moby
                mov cx,[ClustPerMoby]
index 1bf8060..3dfdfa4 100644 (file)
@@ -1523,14 +1523,20 @@ kernel_good:
 ; kernel code. The boot sector is never executed when using an external
 ; booting utility, but it contains some status bytes that are necessary.
 ;
-; First check that our kernel is at least 64K and less than 8M (if it is
+; First check that our kernel is at least 1K and less than 8M (if it is
 ; more than 8M, we need to change the logic for loading it anyway...)
 ;
+; We used to require the kernel to be 64K or larger, but it has gotten
+; popular to use the Linux kernel format for other things, which may
+; not be so large.
+;
 is_linux_kernel:
                 cmp dx,80h                     ; 8 megs
                ja kernel_corrupt
                and dx,dx
-               jz kernel_corrupt
+               jnz kernel_sane
+               cmp ax,1024                     ; Bootsect + 1 setup sect
+               jb kernel_corrupt
 kernel_sane:   push ax
                push dx
                push si
@@ -1572,6 +1578,10 @@ kernel_sane:     push ax
                call abort_check                ; Check for abort key
                mov cx,[ClustPerMoby]
                shr cx,1                        ; Half a moby
+               cmp cx,[KernelClust]
+               jna .normalkernel
+               mov cx,[KernelClust]
+.normalkernel:
                sub [KernelClust],cx
                xor bx,bx
                 pop si                          ; Cluster pointer on stack
@@ -1821,6 +1831,8 @@ high_load_loop:
                 call cwritestr
                 call abort_check
                 mov cx,[KernelClust]
+               and cx,cx
+               jz high_load_done               ; Zero left (tiny kernel?)
                cmp cx,[ClustPerMoby]
                jna high_last_moby
                mov cx,[ClustPerMoby]