From c669f3644ce442e08906f09e005e5e07f68b2556 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Sun, 21 Sep 2003 16:13:16 +0000 Subject: [PATCH] + Changes Lucho * boot.asm, boot32.asm, boot32lb.asm, sys.c: add metakern support: sys looks for a file metakern.sys which is a multiple of 512. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@702 6ac86273-5f31-0410-b378-82cca8765d1b --- boot/boot.asm | 5 ++--- boot/boot32.asm | 4 ++-- boot/boot32lb.asm | 13 ++++++------- sys/sys.c | 21 +++++++++++++++++---- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/boot/boot.asm b/boot/boot.asm index 203fbc8..afe2473 100644 --- a/boot/boot.asm +++ b/boot/boot.asm @@ -519,9 +519,8 @@ read_ok: pop si ret -filename db "KERNEL SYS" + times 0x01f1-$+$$ db 0 - - times 0x01fe-$+$$ db 0 +filename db "KERNEL SYS",0,0 sign dw 0xAA55 diff --git a/boot/boot32.asm b/boot/boot32.asm index b5bf2ea..7dd4699 100644 --- a/boot/boot32.asm +++ b/boot/boot32.asm @@ -384,8 +384,8 @@ no_incr_es: adc dx,byte 0 ret -filename db "KERNEL SYS" + times 0x01f1-$+$$ db 0 - times 0x01fe-$+$$ db 0 +filename db "KERNEL SYS",0,0 sign dw 0xAA55 diff --git a/boot/boot32lb.asm b/boot/boot32lb.asm index 122d9fe..2795f89 100644 --- a/boot/boot32lb.asm +++ b/boot/boot32lb.asm @@ -388,18 +388,17 @@ no_incr_es: pop di ;----------------------------------------------------------------------- msg_LoadFreeDOS db "Loading FreeDOS ",0 + +mystack dw 0x7c00 ; the 0 for SS overlaps into pad bytes! + ; (so we can LSS SP to 0:7c00) + + times 0x01ee-$+$$ db 0 + msg_BootError db "No " ; currently, only "kernel.sys not found" gives a message, ; but read errors in data or root or fat sectors do not. filename db "KERNEL SYS" -msg_BootErrorPart2: - db " ???",0 - - times 0x01fa-$+$$ db 0 - -mystack dw 0x7c00 ; the 0 for SS overlaps into sign! - ; (so we can LSS SP to 0:7c00) sign dw 0, 0xAA55 ; Win9x uses all 4 bytes as magic value here. diff --git a/sys/sys.c b/sys/sys.c index ab27716..a6dac59 100644 --- a/sys/sys.c +++ b/sys/sys.c @@ -29,7 +29,7 @@ #define DEBUG /* #define DDEBUG */ -#define SYS_VERSION "v2.7" +#define SYS_VERSION "v2.8" #include #include @@ -111,9 +111,10 @@ int write(int fd, const void *buf, unsigned count) int stat(const char *file_name, struct stat *buf) { struct find_t find_tbuf; - UNREFERENCED_PARAMETER(buf); - - return _dos_findfirst(file_name, _A_NORMAL | _A_HIDDEN | _A_SYSTEM, &find_tbuf); + int ret = _dos_findfirst(file_name, _A_NORMAL | _A_HIDDEN | _A_SYSTEM, &find_tbuf); + if (!ret) + buf->st_size = find_tbuf.size; + return ret; } /* WATCOM's getenv is case-insensitive which wastes a lot of space @@ -726,6 +727,18 @@ VOID put_boot(COUNT drive, BYTE * bsFile, BOOL both) printf("Root directory starts at sector (PREVIOUS + %u * %u)\n", bs->bsFATsecs, bs->bsFATs); #endif + { + struct stat sbuf; + static char metakern[] = "A:\\METAKERN.SYS"; + metakern[0] = drive + 'A'; + if (!stat(metakern, &sbuf) && sbuf.st_size && !(sbuf.st_size & SEC_SIZE-1)) + { + memcpy(&newboot[0x1f1], "METAKERNSYS", 11); +#ifdef DEBUG + printf("%s found - boot sector patched to load it!\n", metakern); +#endif + } + } #ifdef DDEBUG printf("\nNew Boot Sector:\n");