diff options
author | Robert de Bath <rdebath@poboxes.com> | 2000-07-09 08:19:22 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:45:14 +0200 |
commit | 65da95772de1633acd1bfcc7f579067bac3249af (patch) | |
tree | c1d87c195186c7e4882c30a81d1b7512c6efb793 /bootblocks | |
parent | 3401185106fb312c6a7bba3d9e90d44b6df0043b (diff) | |
download | dev86-65da95772de1633acd1bfcc7f579067bac3249af.tar.gz |
Import Dev86src-0.15.1.tar.gzv0.15.1
Diffstat (limited to 'bootblocks')
-rw-r--r-- | bootblocks/Makefile | 18 | ||||
-rw-r--r-- | bootblocks/bzimage.c | 16 | ||||
-rw-r--r-- | bootblocks/cprintf.c | 8 | ||||
-rw-r--r-- | bootblocks/fs_dos.c | 40 | ||||
-rw-r--r-- | bootblocks/min_buf.c | 2 |
5 files changed, 73 insertions, 11 deletions
diff --git a/bootblocks/Makefile b/bootblocks/Makefile index 96dfadf..068613c 100644 --- a/bootblocks/Makefile +++ b/bootblocks/Makefile @@ -4,7 +4,7 @@ HOSTCCFLAGS=-O BCC=bcc CC=$(BCC) -CFLAGS=-ansi -Ms -Oi -O -s $(MONDEFS) +CFLAGS=-ansi -Ms -Oi -O -s # CFLAGS=-ansi -Ms ASFLAGS=-0 -w MINIXDEFS=-DDOTS @@ -37,14 +37,26 @@ EXTRAS=minix.h elf_info.c elf_info.h standalone.c li86.s \ install: monitor.out: $(MOBJ) - $(CC) $(CFLAGS) -H0x10000 $(MOBJ) -o monitor.out -M > monitor.sym + $(CC) $(CFLAGS) $(MONDEFS) -H0x10000 $(MOBJ) -o monitor.out -M > monitor.sym $(MOBJ): $(MINC) version.h fs_min.o: minix.h +bootfile.sys: $(MSRC) $(MINC) + @rm -f $(MOBJ) + make 'CFLAGS=$(CFLAGS) -DDOSFLOPPY -i-' monitor.out + mv monitor.out bootfile.sys + @rm -f $(MOBJ) + +boottar.sys: $(MSRC) $(MINC) tarboot.bin + @rm -f $(MOBJ) + make 'CFLAGS=$(CFLAGS) -DTARFLOPPY -i-' monitor.out + mv monitor.out boottar.sys + @rm -f $(MOBJ) + monitor: $(MSRC) $(MINC) @rm -f $(MOBJ) - make 'CFLAGS=-ansi -H0x8000 $(MONDEFS)' monitor.out + make 'CFLAGS=-ansi -H0x8000' monitor.out mv monitor.out monitor @rm -f $(MOBJ) diff --git a/bootblocks/bzimage.c b/bootblocks/bzimage.c index 7711f41..fac9017 100644 --- a/bootblocks/bzimage.c +++ b/bootblocks/bzimage.c @@ -3,6 +3,7 @@ * friends use. */ +#define __MINI_MALLOC__ #include "monitor.h" int auto_flag = 1; @@ -105,6 +106,10 @@ char * command_line; } if( main_mem_top < 3072 ) printf("RTFM warning: Linux needs at least 4MB of memory.\n"); + + len = (len+1023)/1024+1; /* Where to load the RD image (Mb) */ + if (len<6) len=6; /* Default to 6Mb mark */ + initrd_start = len * 4096; /* 256 bytes pages. */ #endif low_sects = buffer[497] + 1; /* setup sects + boot sector */ @@ -551,6 +556,15 @@ static char * image_str = "BOOT_IMAGE="; if( strncasecmp(s+4, "ask", 3) == 0 ) vga_mode = -3; else + if( strncasecmp(s+4, "ext", 3) == 0 ) + vga_mode = -2; + else + if( strncasecmp(s+4, "nor", 3) == 0 ) + vga_mode = -1; + else + if( strncasecmp(s+4, "cur", 3) == 0 ) + vga_mode = 0x0f04; + else { s+=4; getnum(&s, &vga_mode); } @@ -662,6 +676,8 @@ unsigned int k_top; rd_start = address - rd_len*4; rd_start &= -16; /* Page boundry */ + if (initrd_start && initrd_start<rd_start) + rd_start = initrd_start; address = rd_start; printf("Loading %s at 0x%x00\n", fname, rd_start); diff --git a/bootblocks/cprintf.c b/bootblocks/cprintf.c index de622fc..e6c0ea7 100644 --- a/bootblocks/cprintf.c +++ b/bootblocks/cprintf.c @@ -68,14 +68,18 @@ cprintf(char * fmt, ...) switch(c) { - case 'x': base=16; if(0) { - case 'o': base= 8; } if(0) { + case 'x': base=16; type |= 4; if(0) { + case 'o': base= 8; type |= 4; } if(0) { + case 'u': base=10; type |= 4; } if(0) { case 'd': base=10; } switch(type) { case 0: val=va_arg(ap, short); break; case 1: val=va_arg(ap, int); break; case 2: val=va_arg(ap, long); break; + case 4: val=va_arg(ap, unsigned short); break; + case 5: val=va_arg(ap, unsigned int); break; + case 6: val=va_arg(ap, unsigned long); break; default:val=0; break; } cp = __numout(val,base); diff --git a/bootblocks/fs_dos.c b/bootblocks/fs_dos.c index 0ad6af6..b99fb4c 100644 --- a/bootblocks/fs_dos.c +++ b/bootblocks/fs_dos.c @@ -1,8 +1,8 @@ #include "monitor.h" -#ifdef MINI_BUF -#define BUFFER_FAT +#ifdef BUFFER_FAT +#define read_fat_sector read_sector #endif #define DOS_SECT(P) get_uint(P,0x0B) @@ -34,6 +34,12 @@ static Tsect dos_clust0, dos_spc; static int dos_fatpos, dos_fatlen, dos_fattype; static int last_serial = 0; +#ifndef BUFFER_FAT +static char * read_fat_sector(); +static int sector_no = 0; +static char sector_buf[512]; +#endif + #ifdef BUFFER_FAT static char * fat_buf = 0; int use_fatbuf = 0; @@ -281,12 +287,12 @@ char * buffer; else #endif { - ptr = read_sector(dos_fatpos+(val/512)); + ptr = read_fat_sector(dos_fatpos+(val/512)); if( ptr == 0 ) return -1; if( val%512 == 511 ) { val2 = (ptr[511]&0xFF); - ptr = read_sector(dos_fatpos+(val/512)+1); + ptr = read_fat_sector(dos_fatpos+(val/512)+1); if( ptr == 0 ) return -1; val2 |= (ptr[0]<<8); } @@ -302,7 +308,7 @@ char * buffer; } else { - ptr = read_sector(dos_fatpos+(cur_file.cur_cluster/256)); + ptr = read_fat_sector(dos_fatpos+(cur_file.cur_cluster/256)); if( ptr == 0 ) return -1; cur_file.cur_cluster = get_uint(ptr, (cur_file.cur_cluster%256*2)); } @@ -319,6 +325,10 @@ static int read_bootblock() char * sptr; int rv, media_byte = 0; +#ifndef BUFFER_FAT + sector_no = 0; +#endif + sptr = read_sector(1); if( sptr == 0 ) return -1; media_byte = *(unsigned char*)sptr; @@ -360,3 +370,23 @@ static int read_bootblock() return 0; } + +#ifndef BUFFER_FAT +static char * +read_fat_sector(sector) +int sector; +{ + char * p; + if( sector == sector_no ) return sector_buf; + p = read_sector(sector); + if(p) + { + memcpy(sector_buf, p, 512); + sector_no = sector; + return sector_buf; + } + else + return 0; +} +#endif + diff --git a/bootblocks/min_buf.c b/bootblocks/min_buf.c index ff58d55..75d2043 100644 --- a/bootblocks/min_buf.c +++ b/bootblocks/min_buf.c @@ -14,7 +14,7 @@ int bad_track = -1; static int track_no = -1; static int buf_len = 0; -static char buffer[MAXTRK*512]; +static char buffer[MAXTRK*512]; /* WARNING: This must be DMAable */ void reset_disk() { |