summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--com32/modules/chain.c3
-rw-r--r--core/Makefile13
-rw-r--r--core/comboot.inc10
-rw-r--r--core/diskfs.inc186
-rw-r--r--core/diskstart.inc24
-rw-r--r--core/ext2.c2
-rw-r--r--core/extlinux.asm178
-rw-r--r--core/fat.c6
-rw-r--r--core/graphics.inc71
-rw-r--r--core/include/core.h5
-rw-r--r--core/include/pxe.h1
-rw-r--r--core/iso9660.c2
-rw-r--r--core/ldlinux.asm189
-rw-r--r--core/parsecmd.inc4
-rw-r--r--core/pxe.c2
-rw-r--r--core/pxelinux.asm2
-rw-r--r--core/symbols.S5
-rw-r--r--memdisk/memdisk.inc119
-rw-r--r--memdisk/setup.c56
-rw-r--r--modules/gfxboot.asm149
-rw-r--r--utils/isohybrid.in2
22 files changed, 547 insertions, 487 deletions
diff --git a/NEWS b/NEWS
index b6c37f1c..735bed73 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,11 @@ Changes in 3.83:
NBP. This may help avoid a bug in Windows RIS.
* PXELINUX: fix localboot after NBP chainloading on certain
BIOSes (including ASUS A8N-E, but possibly others.)
+ * chain.c32: support chainloaded bootloaders on ISOLINUX.
+ * PXELINUX: allow filenames up to 251 characters.
+ * MEMDISK: fix problems booting from USB on Thinkpads, and
+ possibly other machines or hardware combinations.
+ * isohybrid: fix the -id option.
Changes in 3.82:
* isohybrid: fix the -partok logic for loading from a partition.
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index ceb5470a..bdeb82d5 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -676,8 +676,7 @@ int main(int argc, char *argv[])
} else if (!strcmp(drivename, "boot")) {
const union syslinux_derivative_info *sdi;
sdi = syslinux_derivative_info();
- if (sdi->c.filesystem == SYSLINUX_FS_PXELINUX ||
- sdi->c.filesystem == SYSLINUX_FS_ISOLINUX)
+ if (sdi->c.filesystem == SYSLINUX_FS_PXELINUX)
drive = 0x80; /* Boot drive not available */
else
drive = sdi->disk.drive_number;
diff --git a/core/Makefile b/core/Makefile
index 2f1418c0..7b03ef6a 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -41,7 +41,7 @@ BTARGET = kwdhash.gen \
NASMSRC := $(wildcard *.asm)
NASMHDR := $(wildcard *.inc)
CSRC := $(wildcard *.c)
-SSRC := $(filter-out symbols.S,$(wildcard *.S lzo/*.S))
+SSRC := $(wildcard *.S lzo/*.S)
CHDR := $(wildcard *.h)
OTHERSRC := keywords
ALLSRC = $(NASMSRC) $(NASMHDR) $(CSRC) $(SSRC) $(CHDR) $(OTHERSRC)
@@ -86,16 +86,9 @@ kwdhash.gen: keywords genhash.pl
-DHEXDATE="$(HEXDATE)" \
-l $(@:.o=.lsr) -o $@ -MP -MD .$@.d $<
-%.elf: %.o $(LIBS) syslinux.ld symbols.S
- $(LD) $(LDFLAGS) -T syslinux.ld -o $*.elf.tmp $< $(LIBS)
- $(OBJCOPY) -x --extract-symbol $*.elf.tmp $*.sym
- $(CC) $(CFLAGS) -DSYMFILE=\"$*.sym\" -c -o $*.sym.o symbols.S
- $(LD) $(LDFLAGS) -T syslinux.ld -o $*.elf.tmp $< $*.sym.o $(LIBS)
- $(OBJCOPY) -x --extract-symbol $*.elf.tmp $*.sym
- $(CC) $(CFLAGS) -DSYMFILE=\"$*.sym\" -c -o $*.sym.o symbols.S
- $(LD) $(LDFLAGS) -T syslinux.ld -M -o $@ $< $*.sym.o $(LIBS) \
+%.elf: %.o $(LIBS) syslinux.ld
+ $(LD) $(LDFLAGS) -T syslinux.ld -M -o $@ $< $(LIBS) \
> $(@:.elf=.map)
- -rm -f $*.elf.tmp
$(OBJDUMP) -h $@ > $(@:.elf=.sec)
$(PERL) lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst)
diff --git a/core/comboot.inc b/core/comboot.inc
index 7c2b6e66..da3c2399 100644
--- a/core/comboot.inc
+++ b/core/comboot.inc
@@ -942,15 +942,7 @@ comapi_readdir equ comapi_err
;
; INT 22h AX=0022h Close directory
;
-%if IS_SYSLINUX
-comapi_closedir:
- mov si,P_SI
- call close_dir
- clc
- ret
-%else
-comapi_closedir equ comapi_err
-%endif
+comapi_closedir equ comapi_close
;
; INT 22h AX=0023h Query shuffler size
diff --git a/core/diskfs.inc b/core/diskfs.inc
new file mode 100644
index 00000000..87e1bfe7
--- /dev/null
+++ b/core/diskfs.inc
@@ -0,0 +1,186 @@
+; -*- fundamental -*- (asm-mode sucks)
+; -----------------------------------------------------------------------
+;
+; Copyright 1994-2009 H. Peter Anvin - All Rights Reserved
+; Copyright 2009 Intel Corporation; author: H. Peter Anvin
+;
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License as published by
+; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+; Boston MA 02110-1301, USA; either version 2 of the License, or
+; (at your option) any later version; incorporated herein by reference.
+;
+; -----------------------------------------------------------------------
+
+;
+; diskfs.inc
+;
+; Common code for conventional disk-based filesystems
+;
+
+;
+; Some semi-configurable constants... change on your own risk.
+;
+FILENAME_MAX equ (1 << FILENAME_MAX_LG2) ; Max mangled filename size
+NULLFILE equ 0 ; Null character == empty filename
+NULLOFFSET equ 0 ; Position in which to look
+retry_count equ 16 ; How patient are we with the disk?
+%assign HIGHMEM_SLOP 0 ; Avoid this much memory near the top
+LDLINUX_MAGIC equ 0x3eb202fe ; A random number to identify ourselves with
+
+MAX_OPEN_LG2 equ 6 ; log2(Max number of open files)
+MAX_OPEN equ (1 << MAX_OPEN_LG2)
+
+SECTOR_SHIFT equ 9
+SECTOR_SIZE equ (1 << SECTOR_SHIFT)
+
+;
+; The following structure is used for "virtual kernels"; i.e. LILO-style
+; option labels. The options we permit here are `kernel' and `append
+; Since there is no room in the bottom 64K for all of these, we
+; stick them in high memory and copy them down before we need them.
+;
+ struc vkernel
+vk_vname: resb FILENAME_MAX ; Virtual name **MUST BE FIRST!**
+vk_rname: resb FILENAME_MAX ; Real name
+vk_appendlen: resw 1
+vk_type: resb 1 ; Type of file
+ alignb 4
+vk_append: resb max_cmd_len+1 ; Command line
+ alignb 4
+vk_end: equ $ ; Should be <= vk_size
+ endstruc
+
+
+
+; ---------------------------------------------------------------------------
+; BEGIN CODE
+; ---------------------------------------------------------------------------
+
+;
+; Memory below this point is reserved for the BIOS and the MBR
+;
+ section .earlybss
+ global trackbuf
+trackbufsize equ 8192
+trackbuf resb trackbufsize ; Track buffer goes here
+ ; ends at 2800h
+
+;
+; Common bootstrap code for disk-based derivatives
+;
+%include "diskstart.inc"
+
+
+;
+; Now, everything is "up and running"... patch kaboom for more
+; verbosity and using the full screen system
+;
+ ; E9 = JMP NEAR
+ mov di,kaboom.patch
+ mov al,0e9h
+ stosb
+ mov ax,kaboom2-2
+ sub ax,di
+ stosw
+
+;
+; Now we're all set to start with our *real* business. First load the
+; configuration file (if any) and parse it.
+;
+; In previous versions I avoided using 32-bit registers because of a
+; rumour some BIOSes clobbered the upper half of 32-bit registers at
+; random. I figure, though, that if there are any of those still left
+; they probably won't be trying to install Linux on them...
+;
+; The code is still ripe with 16-bitisms, though. Not worth the hassle
+; to take'm out. In fact, we may want to put them back if we're going
+; to boot ELKS at some point.
+;
+
+;
+; Load configuration file
+;
+ pm_call load_config
+ jz no_config_file
+
+;
+; Now we have the config file open. Parse the config file and
+; run the user interface.
+;
+%include "ui.inc"
+
+;
+;
+; kaboom2: once everything is loaded, replace the part of kaboom
+; starting with "kaboom.patch" with this part
+
+kaboom2:
+ mov si,err_bootfailed
+ call writestr
+ cmp byte [kaboom.again+1],18h ; INT 18h version?
+ je .int18
+ call getchar
+ call vgaclearmode
+ int 19h ; And try once more to boot...
+.norge: jmp short .norge ; If int 19h returned; this is the end
+.int18:
+ call vgaclearmode
+ int 18h
+.noreg: jmp short .noreg ; Nynorsk
+
+; -----------------------------------------------------------------------------
+; Common modules
+; -----------------------------------------------------------------------------
+
+%include "common.inc" ; Universal modules
+%include "plaincon.inc" ; writechr
+%include "writestr.inc" ; String output
+%include "writehex.inc" ; Hexadecimal output
+%include "localboot.inc" ; Disk-based local boot
+
+; -----------------------------------------------------------------------------
+; Begin data section
+; -----------------------------------------------------------------------------
+
+ section .data16
+copyright_str db ' Copyright (C) 1994-'
+ asciidec YEAR
+ db ' H. Peter Anvin et al', CR, LF, 0
+err_bootfailed db CR, LF, 'Boot failed: please change disks and press '
+ db 'a key to continue.', CR, LF, 0
+
+;
+; Config file keyword table
+;
+%include "keywords.inc"
+
+;
+; Extensions to search for (in *forward* order).
+;
+ alignz 4
+exten_table: db '.cbt' ; COMBOOT (specific)
+%if IS_SYSLINUX
+ db '.bss' ; Boot sector (add superblock)
+%endif
+ db '.bs', 0 ; Boot sector
+ db '.com' ; COMBOOT (same as DOS)
+ db '.c32' ; COM32
+exten_table_end:
+ dd 0, 0 ; Need 8 null bytes here
+
+;
+; Misc initialized (data) variables
+;
+%ifdef debug ; This code for debugging only
+debug_magic dw 0D00Dh ; Debug code sentinel
+%endif
+
+ alignz 4
+BufSafe dw trackbufsize/SECTOR_SIZE ; Clusters we can load into trackbuf
+BufSafeBytes dw trackbufsize ; = how many bytes?
+%ifndef DEPEND
+%if ( trackbufsize % SECTOR_SIZE ) != 0
+%error trackbufsize must be a multiple of SECTOR_SIZE
+%endif
+%endif
diff --git a/core/diskstart.inc b/core/diskstart.inc
index c160c8d5..36d513ed 100644
--- a/core/diskstart.inc
+++ b/core/diskstart.inc
@@ -722,26 +722,12 @@ expand_super:
pushad
-%if IS_PXELINUX
- extern pxe_fs_ops
- mov eax,pxe_fs_ops
-%else
- %if IS_EXTLINUX
- extern ext2_fs_ops
- mov eax,ext2_fs_ops
- %elif IS_SYSLINUX
- extern vfat_fs_ops
- mov eax,vfat_fs_ops
- %elif IS_ISOLINUX
- extern iso_fs_ops
- mov eax,iso_fs_ops
- %endif
- mov dl,[DriveNumber]
- mov dh,0 ; we are boot from disk not CDROM
- mov ecx,[bsHidden]
- mov ebx,[bsHidden+4]
+ mov eax,ROOT_FS_OPS
+ movzx dx,byte [DriveNumber]
+ ; DH = 0: we are boot from disk not CDROM
+ mov ecx,[bsHidden]
+ mov ebx,[bsHidden+4]
mov si,[bsHeads]
mov di,[bsSecPerTrack]
-%endif
pm_call fs_init
popad
diff --git a/core/ext2.c b/core/ext2.c
index 66255561..787a6f18 100644
--- a/core/ext2.c
+++ b/core/ext2.c
@@ -26,6 +26,8 @@ struct open_file_t {
uint32_t pad[3]; /* pad to 2^5 == 0x20 bytes */
};
+static struct open_file_t __bss16 Files[MAX_OPEN];
+
static char SymlinkBuf[SYMLINK_SECTORS * SECTOR_SIZE + 64];
static struct ext2_inode this_inode;
diff --git a/core/extlinux.asm b/core/extlinux.asm
index d5b9e016..fd9cfdd2 100644
--- a/core/extlinux.asm
+++ b/core/extlinux.asm
@@ -23,179 +23,9 @@
; Some semi-configurable constants... change on your own risk.
;
my_id equ extlinux_id
-; NASM 0.98.38 croaks if these are equ's rather than macros...
-FILENAME_MAX_LG2 equ 8 ; log2(Max filename size Including final null)
-FILENAME_MAX equ (1 << FILENAME_MAX_LG2) ; Max mangled filename size
-NULLFILE equ 0 ; Null character == empty filename
-NULLOFFSET equ 0 ; Position in which to look
-retry_count equ 16 ; How patient are we with the disk?
-%assign HIGHMEM_SLOP 0 ; Avoid this much memory near the top
-LDLINUX_MAGIC equ 0x3eb202fe ; A random number to identify ourselves with
+FILENAME_MAX_LG2 equ 8 ; log2(Max filename size Including final null)
-; The size of open_file_t in extlinux is double of in others
-MAX_OPEN_LG2 equ (6 - 1) ; log2(Max number of open files)
-MAX_OPEN equ (1 << MAX_OPEN_LG2)
+ extern ext2_fs_ops
+ROOT_FS_OPS equ ext2_fs_ops
-SECTOR_SHIFT equ 9
-SECTOR_SIZE equ (1 << SECTOR_SHIFT)
-
-;
-; The following structure is used for "virtual kernels"; i.e. LILO-style
-; option labels. The options we permit here are `kernel' and `append
-; Since there is no room in the bottom 64K for all of these, we
-; stick them in high memory and copy them down before we need them.
-;
- struc vkernel
-vk_vname: resb FILENAME_MAX ; Virtual name **MUST BE FIRST!**
-vk_rname: resb FILENAME_MAX ; Real name
-vk_appendlen: resw 1
-vk_type: resb 1 ; Type of file
- alignb 4
-vk_append: resb max_cmd_len+1 ; Command line
- alignb 4
-vk_end: equ $ ; Should be <= vk_size
- endstruc
-
-
-
-; ---------------------------------------------------------------------------
-; BEGIN CODE
-; ---------------------------------------------------------------------------
-
-;
-; Memory below this point is reserved for the BIOS and the MBR
-;
- section .earlybss
- global trackbuf
-trackbufsize equ 8192
-trackbuf resb trackbufsize ; Track buffer goes here
- ; ends at 2800h
-
- section .bss16
- alignb 32
- global Files
-Files resb MAX_OPEN*32 ; 32 == open_file_t_size
-
-;
-; Common bootstrap code for disk-based derivatives
-;
-%include "diskstart.inc"
-
-
-;
-; Now, everything is "up and running"... patch kaboom for more
-; verbosity and using the full screen system
-;
- ; E9 = JMP NEAR
- mov di,kaboom.patch
- mov al,0e9h
- stosb
- mov ax,kaboom2-2
- sub ax,di
- stosw
-
-;
-; Now we're all set to start with our *real* business. First load the
-; configuration file (if any) and parse it.
-;
-; In previous versions I avoided using 32-bit registers because of a
-; rumour some BIOSes clobbered the upper half of 32-bit registers at
-; random. I figure, though, that if there are any of those still left
-; they probably won't be trying to install Linux on them...
-;
-; The code is still ripe with 16-bitisms, though. Not worth the hassle
-; to take'm out. In fact, we may want to put them back if we're going
-; to boot ELKS at some point.
-;
-
-;
-; Load configuration file
-;
- pm_call load_config
- jz no_config_file
-
-;
-; Now we have the config file open. Parse the config file and
-; run the user interface.
-;
-%include "ui.inc"
-
-;
-;
-; kaboom2: once everything is loaded, replace the part of kaboom
-; starting with "kaboom.patch" with this part
-
-kaboom2:
- mov si,err_bootfailed
- call writestr
- cmp byte [kaboom.again+1],18h ; INT 18h version?
- je .int18
- call getchar
- call vgaclearmode
- int 19h ; And try once more to boot...
-.norge: jmp short .norge ; If int 19h returned; this is the end
-.int18:
- call vgaclearmode
- int 18h
-.noreg: jmp short .noreg ; Nynorsk
-
-
-
-build_curdir_str:
- ret
-
-; -----------------------------------------------------------------------------
-; Common modules
-; -----------------------------------------------------------------------------
-
-%include "common.inc" ; Universal modules
-%include "plaincon.inc" ; writechr
-%include "writestr.inc" ; String output
-%include "writehex.inc" ; Hexadecimal output
-%include "strecpy.inc" ; strcpy with end pointer check
-%include "localboot.inc" ; Disk-based local boot
-
-; -----------------------------------------------------------------------------
-; Begin data section
-; -----------------------------------------------------------------------------
-
- section .data16
-copyright_str db ' Copyright (C) 1994-'
- asciidec YEAR
- db ' H. Peter Anvin et al', CR, LF, 0
-err_bootfailed db CR, LF, 'Boot failed: please change disks and press '
- db 'a key to continue.', CR, LF, 0
-config_name db 'extlinux.conf',0 ; Unmangled form
-
-;
-; Config file keyword table
-;
-%include "keywords.inc"
-
-;
-; Extensions to search for (in *forward* order).
-;
- alignz 4
-exten_table: db '.cbt' ; COMBOOT (specific)
- db '.img' ; Disk image
- db '.bs', 0 ; Boot sector
- db '.com' ; COMBOOT (same as DOS)
- db '.c32' ; COM32
-exten_table_end:
- dd 0, 0 ; Need 8 null bytes here
-
-;
-; Misc initialized (data) variables
-;
-%ifdef debug ; This code for debugging only
-debug_magic dw 0D00Dh ; Debug code sentinel
-%endif
-
- alignz 4
-BufSafe dw trackbufsize/SECTOR_SIZE ; Clusters we can load into trackbuf
-BufSafeBytes dw trackbufsize ; = how many bytes?
-%ifndef DEPEND
-%if ( trackbufsize % SECTOR_SIZE ) != 0
-%error trackbufsize must be a multiple of SECTOR_SIZE
-%endif
-%endif
+%include "diskfs.inc"
diff --git a/core/fat.c b/core/fat.c
index c84d6c92..57278d03 100644
--- a/core/fat.c
+++ b/core/fat.c
@@ -20,6 +20,8 @@ struct open_file_t {
uint32_t file_left; /* number of sectors left */
};
+static struct open_file_t __bss16 Files[MAX_OPEN];
+
extern uint8_t SecPerClust;
@@ -62,12 +64,12 @@ static struct fs_info *this_fs = NULL;
* @return: if successful return the file pointer, or return NULL
*
*/
-static struct open_file_t *allocate_file()
+static struct open_file_t *allocate_file(void)
{
struct open_file_t *file;
int i = 0;
- file = (struct open_file_t *)Files;
+ file = Files;
for (; i < MAX_OPEN; i ++ ) {
if ( file->file_sector == 0 ) /* found it */
diff --git a/core/graphics.inc b/core/graphics.inc
index d530193f..a8d28515 100644
--- a/core/graphics.inc
+++ b/core/graphics.inc
@@ -75,22 +75,26 @@ vgadisplayfile:
mov di,VGARowBuffer
; Pre-clear the row buffer
push di
+ push di
mov cx,640/4
xor eax,eax
rep stosd
pop di
- push di
mov cx,[GraphXSize]
call rledecode ; Decode one row
pop si
+ mov di,VGAPlaneBuffer
+ push di
+ mov bp,640
+ call packedpixel2vga
+ pop si
push es
mov di,0A000h ; VGA segment
mov es,di
mov di,[VGAPos]
- mov bp,640
- call packedpixel2vga
- add word [VGAPos],80
+ call outputvga
pop es
+ add word [VGAPos],640/8
pop cx
loop .drawpixelrow
@@ -160,39 +164,57 @@ rledecode:
;
; DS:SI -> packed pixel string
; BP -> pixel count (multiple of 8)
-; ES:DI -> output
+; DS:DI -> output (four planes)
;
packedpixel2vga:
- mov dx,3C4h ; VGA Sequencer Register select port
- mov al,2 ; Sequencer mask
- out dx,al ; Select the sequencer mask
- inc dx ; VGA Sequencer Register data port
- mov al,1
- mov bl,al
+ xor cx,cx
.planeloop:
- pusha
- out dx,al
+ inc cx
+ push si
+ push bp
.loop1:
- mov cx,8
+ mov bx,8
.loop2:
- xchg cx,bx
lodsb
shr al,cl
- rcl ch,1 ; VGA is bigendian. Sigh.
- xchg cx,bx
- loop .loop2
- mov al,bh
- stosb
+ rcl dl,1 ; VGA is bigendian. Sigh.
+ dec bx
+ jnz .loop2
+ mov [di],dl
+ inc di
sub bp,byte 8
ja .loop1
- popa
- inc bl
- shl al,1
- cmp bl,4
+ pop bp
+ pop si
+ cmp cl,3
jbe .planeloop
ret
;
+; outputvga:
+; Output four subsequent lines of VGA data
+;
+; DS:SI -> four planes @ 640/8=80 bytes
+; ES:DI -> pointer into VGA memory
+;
+outputvga:
+ mov dx,3C4h ; VGA Sequencer Register select port
+ mov al,2 ; Sequencer mask
+ out dx,al ; Select the sequencer mask
+ inc dx ; VGA Sequencer Register data port
+ dec ax ; AL <- 1
+.loop1:
+ out dx,al ; Select the bit plane to write
+ push di
+ mov cx,640/32
+ rep movsd
+ pop di
+ add ax,ax
+ cmp al,8
+ jbe .loop1
+ ret
+
+;
; vgasetmode:
; Enable VGA graphics, if possible; return ZF=1 on success
; DS must be set to the base segment; ES is set to DS.
@@ -328,3 +350,4 @@ VGAFileMBuf resb FILENAME_MAX ; Mangled VGA image name
alignb 4
VGARowBuffer resb 640+80 ; Decompression buffer
+VGAPlaneBuffer resb (640/8)*4 ; Plane buffers
diff --git a/core/include/core.h b/core/include/core.h
index 236f8c01..12ec37ea 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -7,7 +7,6 @@
extern char core_xfer_buf[65536];
extern char core_cache_buf[65536];
extern char trackbuf[];
-extern char Files[];
extern char CurrentDirName[];
extern char ConfigName[];
@@ -28,7 +27,11 @@ int __cdecl core_cfarcall(uint32_t, const void *, uint32_t);
void call16(void (*)(void), const com32sys_t *, com32sys_t *);
+/*
+ * __lowmem is in the low 1 MB; __bss16 in the low 64K
+ */
#define __lowmem __attribute((nocommon,section(".lowmem")))
+#define __bss16 __attribute((nocommon,section(".bss16")))
/*
* externs for pxelinux
diff --git a/core/include/pxe.h b/core/include/pxe.h
index 1aa05068..76fcf14a 100644
--- a/core/include/pxe.h
+++ b/core/include/pxe.h
@@ -237,7 +237,6 @@ struct open_file_t {
uint8_t tftp_unused[3]; /* Currently unused */
uint16_t tftp_pktbuf; /* Packet buffer offset */
} __attribute__ ((packed));
-extern char Files[];
struct pxe_udp_write_pkt {
uint16_t status;
diff --git a/core/iso9660.c b/core/iso9660.c
index 61179c3f..b1fe64eb 100644
--- a/core/iso9660.c
+++ b/core/iso9660.c
@@ -24,6 +24,8 @@ struct open_file_t {
uint32_t file_left;
};
+static struct open_file_t __bss16 Files[MAX_OPEN];
+
struct dir_t {
uint32_t dir_lba; /* Directory start (LBA) */
uint32_t dir_len; /* Length in bytes */
diff --git a/core/ldlinux.asm b/core/ldlinux.asm
index b2c4070a..b8b86b2e 100644
--- a/core/ldlinux.asm
+++ b/core/ldlinux.asm
@@ -22,9 +22,7 @@
;
; ****************************************************************************
-%ifndef IS_MDSLINUX
%define IS_SYSLINUX 1
-%endif
%include "head.inc"
;
@@ -32,189 +30,8 @@
;
my_id equ syslinux_id
FILENAME_MAX_LG2 equ 6 ; log2(Max filename size Including final null)
-FILENAME_MAX equ (1<<FILENAME_MAX_LG2) ; Max mangled filename size
-NULLFILE equ 0 ; First char space == null filename
-NULLOFFSET equ 0 ; Position in which to look
-retry_count equ 16 ; How patient are we with the disk?
-%assign HIGHMEM_SLOP 0 ; Avoid this much memory near the top
-LDLINUX_MAGIC equ 0x3eb202fe ; A random number to identify ourselves with
-MAX_OPEN_LG2 equ 6 ; log2(Max number of open files)
-MAX_OPEN equ (1 << MAX_OPEN_LG2)
+ extern vfat_fs_ops
+ROOT_FS_OPS equ vfat_fs_ops
-SECTOR_SHIFT equ 9
-SECTOR_SIZE equ (1 << SECTOR_SHIFT)
-
-
-
-;
-; The following structure is used for "virtual kernels"; i.e. LILO-style
-; option labels. The options we permit here are `kernel' and `append
-; Since there is no room in the bottom 64K for all of these, we
-; stick them in high memory and copy them down before we need them.
-;
- struc vkernel
-vk_vname: resb FILENAME_MAX ; Virtual name **MUST BE FIRST!**
-vk_rname: resb FILENAME_MAX ; Real name
-vk_appendlen: resw 1
-vk_type: resb 1 ; Type of file
- alignb 4
-vk_append: resb max_cmd_len+1 ; Command line
- alignb 4
-vk_end: equ $ ; Should be <= vk_size
- endstruc
-
-
-
-; ---------------------------------------------------------------------------
-; BEGIN CODE
-; ---------------------------------------------------------------------------
-
-;
-; Memory below this point is reserved for the BIOS and the MBR
-;
- section .earlybss
- global trackbuf
-trackbufsize equ 8192
-trackbuf resb trackbufsize ; Track buffer goes here
- ; ends at 2800h
-
- section .bss16
- alignb 16
- global Files
-Files resb MAX_OPEN*16 ; 16 == open_file_t_size
-
-;
-; Common bootstrap code for disk-based derivatives
-;
-%include "diskstart.inc"
-
-
-
-;
-; Now, everything is "up and running"... patch kaboom for more
-; verbosity and using the full screen system
-;
- ; E9 = JMP NEAR
- mov di,kaboom.patch
- mov al,0e9h
- stosb
- mov ax,kaboom2-2
- sub ax,di
- stosw
-
-;
-; Now we're all set to start with our *real* business. First load the
-; configuration file (if any) and parse it.
-;
-; In previous versions I avoided using 32-bit registers because of a
-; rumour some BIOSes clobbered the upper half of 32-bit registers at
-; random. I figure, though, that if there are any of those still left
-; they probably won't be trying to install Linux on them...
-;
-; The code is still ripe with 16-bitisms, though. Not worth the hassle
-; to take'm out. In fact, we may want to put them back if we're going
-; to boot ELKS at some point.
-;
-
-;
-; Load configuration file
-;
- pm_call load_config
- jz no_config_file
-
-;
-; Now we have the config file open. Parse the config file and
-; run the user interface.
-;
-%include "ui.inc"
-
-
-;
-; close_dir:
-; Deallocates a directory structure (pointer in SI)
-; Assumes CS == DS.
-;
-close_dir:
- and si,si
- jz .closed
- mov dword [si],0 ; First dword == file_sector
- xor si,si
-.closed: ret
-
-
-
-;
-;
-; kaboom2: once everything is loaded, replace the part of kaboom
-; starting with "kaboom.patch" with this part
-
-kaboom2:
- mov si,err_bootfailed
- call writestr
- cmp byte [kaboom.again+1],18h ; INT 18h version?
- je .int18
- call getchar
- call vgaclearmode
- int 19h ; And try once more to boot...
-.norge: jmp short .norge ; If int 19h returned; this is the end
-.int18:
- call vgaclearmode
- int 18h
-.noreg: jmp short .noreg ; Nynorsk
-
-
-
-
-
-; -----------------------------------------------------------------------------
-; Common modules
-; -----------------------------------------------------------------------------
-
-%include "common.inc" ; Universal modules
-%include "plaincon.inc" ; writechr
-%include "writestr.inc" ; String output
-%include "writehex.inc" ; Hexadecimal output
-%include "localboot.inc" ; Disk-based local boot
-
-; -----------------------------------------------------------------------------
-; Begin data section
-; -----------------------------------------------------------------------------
-
- section .data16
-copyright_str db ' Copyright (C) 1994-'
- asciidec YEAR
- db ' H. Peter Anvin et al', CR, LF, 0
-err_bootfailed db CR, LF, 'Boot failed: please change disks and press '
- db 'a key to continue.', CR, LF, 0
-;
-; Config file keyword table
-;
-%include "keywords.inc"
-
-;
-; Extensions to search for (in *forward* order).
-;
-exten_table: db '.cbt' ; COMBOOT (specific)
- db '.bss' ; Boot Sector (add superblock)
- db '.bs', 0 ; Boot Sector
- db '.com' ; COMBOOT (same as DOS)
- db '.c32' ; COM32
-exten_table_end:
- dd 0, 0 ; Need 8 null bytes here
-
-;
-; Misc initialized (data) variables
-;
-%ifdef debug ; This code for debugging only
-debug_magic dw 0D00Dh ; Debug code sentinel
-%endif
-
- alignz 4
-BufSafe dw trackbufsize/SECTOR_SIZE ; Clusters we can load into trackbuf
-BufSafeBytes dw trackbufsize ; = how many bytes?
-%ifndef DEPEND
-%if ( trackbufsize % SECTOR_SIZE ) != 0
-%error trackbufsize must be a multiple of SECTOR_SIZE
-%endif
-%endif
+%include "diskfs.inc"
diff --git a/core/parsecmd.inc b/core/parsecmd.inc
index 7e0ac5c0..ab5a7df9 100644
--- a/core/parsecmd.inc
+++ b/core/parsecmd.inc
@@ -118,6 +118,8 @@ VKernelBuf: resb vk_size ; "Current" vkernel
AppendBuf resb max_cmd_len+1 ; append=
Ontimeout resb max_cmd_len+1 ; ontimeout
Onerror resb max_cmd_len+1 ; onerror
+ ; This could be in .uibss but that makes PXELINUX overflow
+ section .bss16
KbdMap resb 256 ; Keyboard map
FKeyName resb MAX_FKEYS*FILENAME_MAX ; File names for F-key help
KernelCNameLen resw 1 ; Length of unmangled kernel name
@@ -133,3 +135,5 @@ InitRDCName resb FILENAME_MAX ; Unmangled initrd name
%endif
MNameBuf resb FILENAME_MAX
InitRD resb FILENAME_MAX
+
+ section .text16
diff --git a/core/pxe.c b/core/pxe.c
index 96c91ec5..997d6c95 100644
--- a/core/pxe.c
+++ b/core/pxe.c
@@ -15,6 +15,8 @@
#define GPXE 1
#define USE_PXE_PROVIDED_STACK 0
+static struct open_file_t __bss16 Files[MAX_OPEN];
+
static char *err_nopxe = "No !PXE or PXENV+ API found; we're dead...\n";
static char *err_pxefailed = "PXE API call failed, error ";
static char *err_udpinit = "Failed to initialize UDP stack\n";
diff --git a/core/pxelinux.asm b/core/pxelinux.asm
index b226a316..cfaf5db6 100644
--- a/core/pxelinux.asm
+++ b/core/pxelinux.asm
@@ -29,7 +29,7 @@
; Some semi-configurable constants... change on your own risk.
;
my_id equ pxelinux_id
-FILENAME_MAX_LG2 equ 7 ; log2(Max filename size Including final null)
+FILENAME_MAX_LG2 equ 8 ; log2(Max filename size Including final null)
FILENAME_MAX equ (1 << FILENAME_MAX_LG2)
NULLFILE equ 0 ; Zero byte == null file name
NULLOFFSET equ 4 ; Position in which to look
diff --git a/core/symbols.S b/core/symbols.S
deleted file mode 100644
index 00cd3e80..00000000
--- a/core/symbols.S
+++ /dev/null
@@ -1,5 +0,0 @@
- .section ".dynlink","a"
-_dynamic_symbols:
- .globl _dynamic_symbols
- .incbin SYMFILE
- .size _dynamic_symbols, .-_dynamic_symbols
diff --git a/memdisk/memdisk.inc b/memdisk/memdisk.inc
index 00537a83..3c79b624 100644
--- a/memdisk/memdisk.inc
+++ b/memdisk/memdisk.inc
@@ -27,11 +27,47 @@
call debug_tracer
db %1
%endmacro
+%macro WRITEHEX2 0-1 al
+%ifnidni %1,al
+ push ax
+ mov al,%1
+ call writehex2
+ pop ax
+%else
+ call writehex2
+%endif
+%endmacro
+%macro WRITEHEX4 0-1 ax
+%ifnidni %1,ax
+ push ax
+ mov ax,%1
+ call writehex4
+ pop ax
+%else
+ call writehex4
+%endif
+%endmacro
+%macro WRITEHEX8 0-1 eax
+%ifnidni %1,eax
+ push eax
+ mov eax,%1
+ call writehex8
+ pop eax
+%else
+ call writehex8
+%endif
+%endmacro
%else ; DEBUG_TRACERS
%macro TRACER 1
%endmacro
+%macro WRITEHEX2 0-1
+%endmacro
+%macro WRITEHEX4 0-1
+%endmacro
+%macro WRITEHEX8 0-1
+%endmacro
%endif ; DEBUG_TRACERS
@@ -89,11 +125,13 @@ Pointers: dw Int13Start
IretPtr equ Int13Start.iret
Int13Start:
+ cmp word [cs:Recursive],0
+ jne recursive
+
; Swap stack
mov [cs:Stack],esp
+ mov [cs:Stack+4],ss
mov [cs:SavedAX],ax
- mov ax,ss
- mov [cs:Stack+4],ax
mov ax,cs
mov ss,ax
mov sp,[cs:MyStack]
@@ -106,24 +144,28 @@ Int13Start:
js .nomatch ; If SF=0, we have a class match here
; 0x00 the sign bit for FD
; 0x80 the sign bit for HD
- jz .our_drive ; If ZF=1, we have an exact match
+ jz our_drive ; If ZF=1, we have an exact match
cmp dl,[cs:DriveNo]
jb .nomatch ; Drive < Our drive
dec dl ; Drive > Our drive, adjust drive #
.nomatch:
+ TRACER '!'
+ WRITEHEX2 dl
+ TRACER ','
mov ax,[cs:SavedAX]
+ WRITEHEX4
+ inc word [cs:Recursive]
pushf
call far [cs:OldInt13]
pushf
+ dec word [cs:Recursive]
push bp
mov bp,sp
cmp byte [cs:SavedAX+1],08h ; Get drive params function?
- je .norestoredl
+ je .norestoredl ; DL = number of drives
cmp byte [cs:SavedAX+1],15h ; Get disk type function?
- jne .restoredl
- test byte [bp+4],80h ; Hard disk?
- jnz .norestoredl
-.restoredl: ; DL should have number of drives
+ je .norestoredl ; CX:DX = size of device
+.restoredl:
mov dl,[bp+4]
.norestoredl:
push ax
@@ -139,7 +181,12 @@ Int13Start:
lss esp,[cs:Stack]
.iret: iret
-.our_drive:
+recursive:
+ TRACER '@'
+jmp_oldint13:
+ jmp far [cs:OldInt13]
+
+our_drive:
; Set up standard entry frame
push ds
push es
@@ -149,7 +196,8 @@ Int13Start:
pushad
mov bp,sp ; Point BP to the entry stack frame
TRACER 'F'
- ; Note: AH == P_AH here
+ WRITEHEX4
+ ; Note: AX == P_AX here
cmp ah,Int13FuncsCnt-1
ja Invalid_jump
xor al,al ; AL = 0 is standard entry condition
@@ -208,7 +256,7 @@ Reset:
pop ds
lss esp,[cs:Stack] ; Restore the stack
and dl,80h ; Clear all but the type bit
- jmp far [cs:OldInt13]
+ jmp jmp_oldint13
Invalid:
@@ -222,7 +270,9 @@ GetDriveType:
test byte [DriveNo],80h
mov bl,02h ; Type 02h = floppy with changeline
jz .floppy
- ; Hard disks only...
+ ; Hard disks only! DO NOT set CX:DX for floppies...
+ ; it apparently causes Win98SE DOS to go into an loop
+ ; resetting the drive over and over. Sigh.
inc bx ; Type = 03h
mov dx,[DiskSize] ; Return the disk size in sectors
mov P_DX,dx
@@ -792,6 +842,39 @@ debug_tracer: pushad
popfd
popad
ret
+
+writehex2: pushad
+ pushfd
+ mov cx,2
+ ror eax,4
+ jmp writehex_common
+writehex4: pushad
+ pushfd
+ mov cx,4
+ ror eax,12
+ jmp writehex_common
+writehex8: pushad
+ pushfd
+ mov cx,8
+ ror eax,28
+writehex_common:
+.loop: push cx
+ push eax
+ and al,0Fh
+ cmp al,10
+ jb .isdec
+ add al,'a'-'0'-10
+.isdec: add al,'0'
+ mov ah,0Eh
+ mov bx,7
+ int 10h
+ pop eax
+ rol eax,4
+ pop cx
+ loop .loop
+ popfd
+ popad
+ ret
%endif
section .data
@@ -964,13 +1047,25 @@ EDD_DPT:
.totalsize dd 0, 0 ; Filled in by installer
.bytespersec dw SECTORSIZE
.eddtable dw -1, -1 ; Invalid DPTE pointer
+.dpikey dw 0BEDDh ; Device Path Info magic
+.dpilen db 2ch ; DPI len
+.res1 db 0 ; Reserved
+.res2 dw 0 ; Reserved
+.bustype dd 'MEM ' ; Host bus type (4 bytes, space padded)
+.inttype dd 'MEMORY ' ; Interface type (8 bytes, spc. padded)
+.intpath dd 0, 0 ; Interface path
+.devpath dd 0, 0, 0, 0 ; Device path
+.res3 db 0 ; Reserved
+.chksum db 0 ; DPI checksum
%endif
; End patch area
+ alignb 4, db 0
Stack dd 0 ; Saved SS:ESP on invocation
dw 0
SavedAX dw 0 ; AX saved on invocation
+Recursive dw 0 ; Recursion counter
alignb 4, db 0 ; We *MUST* end on a dword boundary
diff --git a/memdisk/setup.c b/memdisk/setup.c
index 98c4b69d..caee377a 100644
--- a/memdisk/setup.c
+++ b/memdisk/setup.c
@@ -80,7 +80,17 @@ struct edd_dpt {
uint64_t sectors; /* Total sectors */
uint16_t bytespersec; /* Bytes/sector */
uint16_t dpte_off, dpte_seg; /* DPTE pointer */
-};
+ uint16_t dpikey; /* Device Path Info magic */
+ uint8_t dpilen; /* Device Path Info length */
+ uint8_t res1; /* Reserved */
+ uint16_t res2; /* Reserved */
+ uint8_t bustype[4]; /* Host bus type */
+ uint8_t inttype[8]; /* Interface type */
+ uint64_t intpath; /* Interface path */
+ uint64_t devpath[2]; /* Device path (double QuadWord!) */
+ uint8_t res3; /* Reserved */
+ uint8_t chksum; /* DPI checksum */
+} __attribute__((packed));
struct patch_area {
uint32_t diskbuf;
@@ -121,7 +131,7 @@ struct patch_area {
dpt_t dpt;
struct edd_dpt edd_dpt;
-};
+} __attribute__((packed));
/* Access to high memory */
@@ -708,6 +718,17 @@ static void relocate_rm_code(uint32_t newbase)
sti();
}
+static uint8_t checksum_buf(const void *buf, int count)
+{
+ const uint8_t *p = buf;
+ uint8_t c;
+
+ while (count--)
+ c += *p++;
+
+ return c;
+}
+
#define STACK_NEEDED 512 /* Number of bytes of stack */
struct real_mode_args rm_args;
@@ -886,19 +907,24 @@ void setup(const struct real_mode_args *rm_args_ptr)
}
/* Set up an EDD drive parameter table */
- pptr->edd_dpt.sectors = geometry->sectors;
- /* The EDD spec has this as <= 15482880 sectors (1024x240x63);
- this seems to make very little sense. Try for something saner. */
- if (geometry->c <= 1024 && geometry->h <= 255 && geometry->s <= 63) {
- pptr->edd_dpt.c = geometry->c;
- pptr->edd_dpt.h = geometry->h;
- pptr->edd_dpt.s = geometry->s;
- pptr->edd_dpt.flags |= 0x0002; /* Geometry valid */
- }
- if (!(geometry->driveno & 0x80)) {
- /* Floppy drive. Mark it as a removable device with
- media change notification; media is present. */
- pptr->edd_dpt.flags |= 0x0014;
+ if (do_edd) {
+ pptr->edd_dpt.sectors = geometry->sectors;
+ /* The EDD spec has this as <= 15482880 sectors (1024x240x63);
+ this seems to make very little sense. Try for something saner. */
+ if (geometry->c <= 1024 && geometry->h <= 255 && geometry->s <= 63) {
+ pptr->edd_dpt.c = geometry->c;
+ pptr->edd_dpt.h = geometry->h;
+ pptr->edd_dpt.s = geometry->s;
+ pptr->edd_dpt.flags |= 0x0002; /* Geometry valid */
+ }
+ if (!(geometry->driveno & 0x80)) {
+ /* Floppy drive. Mark it as a removable device with
+ media change notification; media is present. */
+ pptr->edd_dpt.flags |= 0x0014;
+ }
+
+ pptr->edd_dpt.devpath[0] = pptr->diskbuf;
+ pptr->edd_dpt.chksum = -checksum_buf(&pptr->edd_dpt.dpikey, 73-30);
}
/* The size is given by hptr->total_size plus the size of the E820
diff --git a/modules/gfxboot.asm b/modules/gfxboot.asm
index c9fdd1b6..5c7b118b 100644
--- a/modules/gfxboot.asm
+++ b/modules/gfxboot.asm
@@ -144,7 +144,15 @@ got_config_file:
push cs
pop es
call parse_config
+ cmp word [label_cnt],0
+ ja labels_defined
+ mov bx,msg_no_labels_defined
+ mov ax,2
+ int 22h
+ ret
+
+labels_defined:
; get_gfx_file
mov ax,cs
add ax,2000h
@@ -417,6 +425,14 @@ gfx_read_file:
mov si,pspCmdArg+1
int 22h
jnc gfx_file_read
+
+ mov ax,2
+ mov bx,pspCmdArg+1
+ int 22h
+
+ mov ax,2
+ mov bx,msg_not_found
+ int 22h
stc
ret
@@ -641,8 +657,7 @@ gfx_input:
shl edi,4
add edi, command_line ; buffer (0: no buffer)
mov ecx, max_cmd_len ; buffer size
-; xor eax,eax ; timeout value (0: no timeout)
- mov eax,100 ; timeout value (0: no timeout)
+ mov eax,[menu_timeout] ; timeout value (0: no timeout)
call far [gfx_bc_input]
ret
@@ -699,33 +714,39 @@ parse_config:
mov bx, msg_crlf
int 22h
%endif
+ mov bx,keywords
+ mov cx,[keyword_cnt]
+.keywords_loop:
+ push cx
push si
push di
- xor ecx,ecx
+ xor cx,cx
mov si,configbuf
- mov di,label_keyword+1
- mov cl, byte [label_keyword]
+ mov di,[bx]
+ mov cl,byte [di]
+ inc di
call memcmp
pop di
pop si
- jz .do_label
+ jnz .not_found
+ pop cx
+ call [bx+2] ; call keyword handler
+ jmp .read
- push si
- push di
- xor ecx,ecx
- mov si,configbuf
- mov di,default_keyword+1
- mov cl, byte [default_keyword]
- call memcmp
- pop di
- pop si
- jz .do_default
+.not_found:
+ add bx,4
+ pop cx
+ loop .keywords_loop
.nextline:
call skipline
jmp .read
-.do_label:
+.eof:
+.noparm:
+ ret
+
+do_label:
call skipspace
jz .eof
jc .noparm
@@ -742,10 +763,11 @@ parse_config:
pop di
pop es
inc word [label_cnt]
+.eof:
+.noparm:
+ ret
- jmp .read
-
-.do_default:
+do_default:
call skipspace
jz .eof
jc .noparm
@@ -759,8 +781,42 @@ parse_config:
pop di
pop es
- jmp .read
+.eof:
+.noparm:
+ ret
+do_timeout:
+ call skipspace
+ jz .eof
+ jc .noparm
+ call ungetc
+ push es
+ push di
+ push cs
+ pop es
+ mov di,NumBuf
+.getnum:
+ cmp di,NumBufEnd
+ jae .loaded
+ call getc
+ stosb
+ cmp al,'-'
+ jnb .getnum
+ call ungetc
+ dec di
+.loaded:
+ mov byte [di],0
+ pop di
+ pop es
+ push cs
+ pop ds
+ mov si,NumBuf
+ push ebx
+ call parseint
+ jc .err
+ mov [menu_timeout],ebx
+.err:
+ pop ebx
.eof:
.noparm:
ret
@@ -876,23 +932,63 @@ memcmp:
pop si
ret
- section .data
-label_keyword db 6,'label',0
-default_keyword db 7,'default',0
+parseint:
+ push eax
+ push ecx
+ xor eax,eax
+ xor ebx,ebx
+ xor ecx,ecx
+ mov cl,10
+.loop:
+ lodsb
+ and al,al
+ jz .done
+ cmp al,'0'
+ jb .err
+ cmp al,'9'
+ ja .err
+ sub al,'0'
+ imul ebx,ecx
+ add ebx,eax
+ jmp short .loop
+.done:
+ clc
+.ret:
+ pop ecx
+ pop eax
+ ret
+.err:
+ stc
+ jmp short .ret
+ section .data
msg_progname db 'gfxboot: ',0
msg_config_file db 'Configuration file',0
msg_missing db 'missing',0
msg_usage db 'Usage: gfxboot.com <bootlogo>',0dh,0ah,0
msg_memory db 'Could not detect available memory size',0dh,0ah,0
msg_bootlogo_toobig db 'bootlogo file too big',0dh,0ah,0
-msg_pxelinux db 'pxelinux is not supported',0dh,0ah,0
msg_unknown_file_size db 'unknown file size',0dh,0ah,0
+msg_not_found db ' not found',0dh,0ah,0
+msg_no_labels_defined db 'No labels defined in config file',0dh,0ah,0
msg_space db ' ',0
msg_crlf db 0dh,0ah,0
gfx_slash db '/', 0
db0 db 0
+menu_timeout dd 100
+
+keyword_text_label db 6,'label',0
+keyword_text_default db 7,'default',0
+keyword_text_timeout db 7,'timeout',0
+keywords equ $
+ dw keyword_text_label
+ dw do_label
+ dw keyword_text_default
+ dw do_default
+ dw keyword_text_timeout
+ dw do_timeout
+keyword_cnt dw ($-keywords)/4
; menu entry descriptor
menu_entries equ 0
@@ -942,6 +1038,9 @@ dentry_buf_len equ $ - dentry_buf
max_cmd_len equ 2047
command_line resb max_cmd_len+2
+NumBuf resb 15
+NumBufEnd resb 1
+
alignb 4
derivative_id resb 1
drivenumber resb 1
diff --git a/utils/isohybrid.in b/utils/isohybrid.in
index a92b5726..0726bed9 100644
--- a/utils/isohybrid.in
+++ b/utils/isohybrid.in
@@ -194,7 +194,7 @@ if ($c > 1024) {
# Preserve id when run again
if (defined($opt{'id'})) {
- $id = $opt{'id'};
+ $id = pack("V", doh($opt{'id'}));
} else {
seek(FILE, 440, SEEK_SET) or die "$0: $file: $!\n";
read(FILE, $id, 4);