diff --git a/src/sys/boot/Makefile b/src/sys/boot/Makefile index b3371df..c84b742 100755 --- a/src/sys/boot/Makefile +++ b/src/sys/boot/Makefile @@ -19,7 +19,7 @@ (dd if=/dev/zero of=./buf bs=512 count=10) (cat buf >>bootsec) (rm -f buf) - (./writeimg $(FDDEVICE)) +# (./writeimg $(FDDEVICE)) formatdsk: format (./format 60 2 bin help.txt readme.txt) diff --git a/src/sys/boot/Makefile.inc b/src/sys/boot/Makefile.inc deleted file mode 100755 index e3011be..0000000 --- a/src/sys/boot/Makefile.inc +++ /dev/null @@ -1,6 +0,0 @@ -# Common defines for all of /sys/boot/i386/ -# -# $FreeBSD: src/sys/boot/i386/Makefile.inc,v 1.1.2.2 2000/12/28 12:04:04 ps Exp $ - -LOADER_ADDRESS?= 0x200000 -CFLAGS+= -mpreferred-stack-boundary=2 diff --git a/src/sys/boot/boot2/boot2.c b/src/sys/boot/boot2/boot2.c index cc429c5..013b416 100755 --- a/src/sys/boot/boot2/boot2.c +++ b/src/sys/boot/boot2/boot2.c @@ -246,13 +246,9 @@ } static void initUbixFS() { - int i = 0x0; BAT = (struct blockAllocationTableEntry *)malloc(4096); rootDir = (struct directoryEntry *)malloc(4096); dskread(BAT,0,8); - for (i=0;i<16;i++) { - printf("block: [%u][%u]\n",i,BAT[i].nextBlock); - } dskread(rootDir,8,8); } @@ -322,7 +318,6 @@ { } -//woot static void load(const char *fname) { @@ -382,7 +377,6 @@ } } else { fs_off = hdr.eh.e_phoff; - printf("e_phoff: [%u]\n",fs_off); for (j = i = 0; i < hdr.eh.e_phnum && j < 2; i++) { if (xfsread(fname, ep + j, sizeof(ep[0]))) return; @@ -392,7 +386,6 @@ for (i = 0; i < 2; i++) { p = PTOV(ep[i].p_paddr & 0xffffff); fs_off = ep[i].p_offset; - printf("fs_off: [%u][%u]\n",fs_off,ep[i].p_filesz); if (xfsread(fname, p, ep[i].p_filesz)) return; } @@ -414,8 +407,6 @@ } addr = hdr.eh.e_entry & 0xffffff; } - printf("addr: [%u]\n",addr); - //while(1); bootinfo.bi_esymtab = VTOP(p); bootinfo.bi_kernelname = VTOP(fname); bootinfo.bi_bios_dev = dsk.drive; @@ -539,14 +530,13 @@ xfsread(const char *fname, void *buf, size_t nbyte) { if (fsread(fname, buf, nbyte) != nbyte) { - printf("Invalid %s\n", "format"); +// printf("Invalid %s\n", "format"); return -1; } return 0; } - -//woot +/* FSREAD */ static ssize_t fsread(const char *fname, void *buf, size_t nbyte) { int i = 0x0,x = 0x0,block = 0x0,bOffset = 0x0,offset = 0x0,lb = -1; int fBlock = -1; @@ -572,25 +562,19 @@ printf("Error!!!\n"); offset = 0; } - printf("Test: [%u][%u][%u]\n",fs_off,nbyte,(fs_off/4096)); for (i=0;i +#include + +#include "ubixfs.h" + +int main() { + FILE *fd; + struct ubixDiskLabel *d = (struct ubixDiskLabel *)malloc(512); + printf("Building Disk Label\n"); + d->magicNum = UBIXDISKMAGIC; + d->magicNum2 = UBIXDISKMAGIC; + d->numPartitions = 1; + d->partitions[0].p_size = 2000; + d->partitions[0].p_offset = 50; + d->partitions[0].p_fstype = 0x24; + d->partitions[0].p_bsize = 0x8; + fd = fopen("/dev/fd0","wb"); + fseek(fd,512,0); + fwrite(d,512,1,fd); + } diff --git a/src/sys/boot/boot2/ubixfs.h b/src/sys/boot/boot2/ubixfs.h new file mode 100755 index 0000000..4c558d1 --- /dev/null +++ b/src/sys/boot/boot2/ubixfs.h @@ -0,0 +1,44 @@ +#define DOSPTYP_UBX 0x2A /* UbixFS partition type */ +#define UBIXDISKMAGIC ((u_int32_t)0x45) /* The disk magic number */ +#define MAXUBIXPARTITIONS 16 +#define UBIXFSMAGIC ((u_int32_t)0x69) /* The File System Magic Number */ + +typedef unsigned long uLong; +typedef unsigned short uShort; + + +struct ubixDiskLabel { + u_int32_t magicNum; + u_int32_t magicNum2; + u_int16_t driveType; + u_int16_t numPartitions; + struct ubixPartitions { /* the partition table */ + u_int32_t p_size; /* number of sectors in partition */ + u_int32_t p_offset; /* starting sector */ + u_int32_t p_fsize; /* filesystem basic fragment size */ + u_int32_t p_bsize; /* BAT size */ + u_int8_t p_fstype; /* filesystem type, see below */ + u_int8_t p_frag; /* filesystem fragments per block */ + } partitions[MAXUBIXPARTITIONS]; + }; + +//Block Allocation Table Entry +struct blockAllocationTableEntry { + long attributes; //Block Attributes + long realSector; //Real Sector + long nextBlock; //Sector Of Next Block + long reserved; //Reserved + }; + + +struct directoryEntry { + uLong startCluster; //Starting Cluster Of File + uLong size; //Size Of File + uLong creationDate; //Date Created + uLong lastModified; //Date Last Modified + uLong uid; //UID Of Owner + uLong gid; //GID Of Owner + uShort attributes; //Files Attributes + uShort permissions; //Files Permissions + char fileName[256]; //File Name + }; diff --git a/src/sys/boot/bootsec.asm b/src/sys/boot/bootsec.asm deleted file mode 100755 index 1d15566..0000000 --- a/src/sys/boot/bootsec.asm +++ /dev/null @@ -1,410 +0,0 @@ -; $Id$ - -%include "gdtnasm.inc" - -[ORG 0x7c00] -jmp start -nop - -id db 'UbixFS' ;file system id -version dd 1h ; Filing System Version -fs_start dd 257 ; LBA address for start of root dir -krnl_size dd 59 ; Kernel size in sectors, starts at sector 1 -BytesPerSector dw 512 -SectorsPerTrack dw 18 -TotalHeads dw 2 -TotalSectors dd 2880 ; 1474560/512 for a 1.44meg disk - -; Offset in file_entry structure to the nextdata LBA pointer -file_entry_nextdata equ 273 - -; Offset in data_entry structure to the data -data_entry_data equ 9 - -bootdrv db 0 - -start: - xor ax, ax - mov ds, ax - mov [bootdrv], dl -; First get into protected mode - cli -n5: - in al, 0x64 ;Enable A20 {4A} {5} - test al, 2 - jnz n5 - mov al, 0xD1 - out 0x64, al -n6: - in al, 0x64 - test al, 2 - jnz n6 - mov al, 0xDF - out 0x60, al - lgdt [gdtinfo] ;Load GDT - mov ecx, CR0 ;Switch to protected mode - or ecx, 1 ; set PE bit - mov CR0, ecx - mov ax, flat_data-gdt_table ; Selector for 4Gb data seg - mov ds, ax ; {2} Extend limit for ds - mov es, ax ; Extend limit for es - mov fs, ax ; fs and... - mov gs, ax ; gs - dec ecx ; switch back to real mode - mov CR0, ecx - sti - xor ax, ax - mov ds, ax - mov dl, [bootdrv] - mov bx, 0x60 -; mjikaboom -;mji mov bx, 0x0a000 - mov es, bx - mov eax, 1 - mov ecx, [krnl_size] - mov di, 1 -load_loop: - call read_sectors - inc eax - mov bx, es - add bx, 32 - mov es, bx - loop load_loop - ; Turn off the floppy motor, its annoying leaving it on ! - mov edx,0x3f2 - mov al,0x0c - out dx,al - ;lets convert the ELF file to a linear binary so we can execute it - cmp dword [0x600],464c457fh ; The ELF signature is \07fELF -;mjikaboom - mov ax, 0x60 - mov es, ax - cmp dword [es:0],464c457fh ; The ELF signature is \07fELF - jne ldr_ELF_err ; Ugh... not an ELF file !!! -;mji cmp word [0x600+4],101h ; It should be statically linked etc. -;mjikaboom - cmp word [es:4],101h ; It should be statically linked etc. - jne ldr_ELF_err -;mji cmp byte [0x600+6],1 -;mjikaboom - cmp byte [es:6],1 - jne ldr_ELF_err - jmp short skip_err_handler -ldr_ELF_err: - mov ax, 'E'+0x0E00 - mov bx, 7 - int 10h - mov al, 'L' - int 10h - mov al, 'F' - int 10h - cli - hlt -skip_err_handler: - - mov eax, [0x600+18h] -;mjikaboom -;mji mov eax, [0x0a0000+18h] - mov [krnl_entry], eax - - xor ecx,ecx ; Get the number of sections in cx - mov cx,[0x600+2ch] -;mjikaboom -;mji mov cx,[0x0a0000+2ch] - -sectionloop: - dec ecx ; Next section - push ecx ; Save cx on the stack while we load - ; the section into memory - mov bx, 0x600 ; access image location -;mjikaboom -;mji mov bx, 0x0a0000 ; access image location - - mov ax,[bx+2ah] ; Get the program header entry size - mul cx ; Calculate the offset from the start - ; of the program header table - add ax,[bx+1ch] ; ax <= PHT offset + PHT entry offset - add bx,ax ; bx <= ax(PHT offset + PHT entry offset) - ;+ image location of ELF file (0x600) - - cmp dword [bx],1 ; Does this section have to be - ; loaded into memory ? - jne nextsect ; No, next section - - mov dword ecx,[bx+10h] ; Get the size of the segment in the - ; ELF file - mov dword edi,[bx+8h] ; Get the memory address of the sect. - mov dword eax,[bx+14h] ; eax <= the size of the section - mov dword ebx,[bx+4h] ; Get the offset of the segment in - ; the ELF file - add ebx, 0x600 ; -;mjikaboom -;mji add ebx, 0x0a0000 ; - - ; set up for memcopy - - mov edx, edi ; edx <- set dest addr - add edi, ecx ; move past part which will be copied - sub eax, ecx ; eax <- store zero fill size - ; ebx is already source addr - ; ecx is already count - - ; set up for memcopy - ;mov esi, 0x600 - ;add esi, ecx - ;mov ecx, edx - - ;call memcopy - call nonmajicmemcpy - - ; warnng, ,assume zero-fill < 64K - ;test ax,ax ; This amount needs to be zeroed - ;jz nextsect ; It's ok, next section - - ; store zero fill size - ;mov ecx, eax - ;add edi,edx ; Zero the memory from this address - ;xor ax,ax ; edi is an absolute address - ;mov ecx,ebx - ;call zero_memblock ; Zero the rest of the section - -nextsect: - pop ecx ; Restore our section count - or ecx,ecx ; Was this the last one ? - jnz sectionloop - - -; Re-enter protected mode ! A20 is already enabled - -;mov ax,0x4F01 -;mov cx,0x4115 -;mov bx,0x100 -;mov es,bx -;xor di,di -;xor bx,bx -;int 0x10 - - -;mov ax,0x4F02 -;mov bx,0x4115 -;int 0x10 - - -;mov ax, 0x4f0a -;xor bx,bx -;int 0x10 -;xor eax,eax -;mov ax,es -;mov bx,di -;xor dx,dx -;mov es,dx -;mov si, 0x3000 -;mov [es:si],ax -;mov [es:si+4],bx -;mov [es:si+8],cx - cli ; No interrupts please at all - lgdt [gdtinfo] - mov ecx, cr0 - or ecx, 1 ; set PE bit - mov cr0, ecx - mov ax, flat_data-gdt_table - mov ds, ax - mov es, ax - mov fs, ax - mov gs, ax - - jmp dword (flat_code-gdt_table):pmode1 - -pmode1: -[BITS 32] - - push dword 2 - popfd - - mov eax, [krnl_entry] - call eax - cli - hlt - -;Hang the system.. -hang: jmp hang - -[BITS 16] - read_sectors: -; Input: -; EAX = LBN -; DI = sector count -; ES = segment -; Output: -; BL = low byte of ES -; EBX high half cleared -; DL = 0x80 -; EDX high half cleared -; ESI = 0 - - pushad - - cdq ;edx = 0 - movzx ebx, byte [SectorsPerTrack] - div ebx ;EAX=track ;EDX=sector-1 - mov cx, dx ;CL=sector-1 ;CH=0 - inc cx ;CL=Sector number - xor dx, dx - mov bl, [TotalHeads] - div ebx - - mov dh, dl ;Head - mov dl, [bootdrv] ;Drive 0 - xchg ch, al ;CH=Low 8 bits of cylinder number; AL=0 - shr ax, 2 ;AL[6:7]=High two bits of cylinder; AH=0 - or cl, al ;CX = Cylinder and sector - mov ax, di ;AX = Maximum sectors to xfer -retry: mov ah, 2 ;Read - xor bx, bx - int 13h - jc retry - - popad - - ret - -; zero_memblock: Fills the specified memory block with zeros (0x0) -; -; Takes parameters: -; ax = segment/selector of memory to be cleared -; edi = offset of memory to be cleared -; ecx = number of bytes to clear -; -; Returns: -; nothing - -;zero_memblock: -; push eax ; Save the registers -; push edi -; push ecx -; push es -; mov es,ax -; xor eax,eax ; Fill the memory with zeros (0x0) -; cld ; Clear the direction flag; rep increments di -; a32 rep stosb ; Fill the memory (one byte at a time) -; pop es ; Restore the registers -; pop ecx -; pop edi -; pop eax -; ret ; Return to the main program - -; Parameters -; DS:ESI = Source -; DS:EDI = Destination -; CX = length -;memcopy: -; pusha -;memcopy_loop: -; mov al, [esi] -; mov [edi], al -; inc edi -; inc esi -; loop memcopy_loop -; popa -; ret - -; edx = dest -; ebx = source -; ecx = count -; -; all other registers maintained -nonmajicmemcpy: - pusha - - ; preserve segments - push ds - push es - - push cx ; [stack] <- 'left-over' after full 256 byte copies - - - xor ax, ax - - ; break size into 256 byte chuunks - shr ecx, 8 ; cx <- number of 256 byte copies to perform - mov bp, cx ; bp <- number of 256 byte copies to perform - - mov cl, 4 - - ; break destination into 256 byte chuunks - xchg al, dl ; al <- initial 'offset' of destination - ; edx <- 16 X initial 'segment' of destination - shr edx, cl ; dx <- initial 'segment' of destination - - ; break source into 256 byte chuunks - xchg ah, bl ; ah <- initial 'offset' of source - ; ebx <- 16 X initial 'segment' of source - shr ebx, cl ; bx <- initial 'segment' of source - - cld ; clear direction flag - inc bp ; pre-increment 256 section count - -nonmajicmemcpy_loop256: - movzx si, ah ; restore initial source addr - movzx di, al ; restore initial dest addr - - ; restore/set segment addrs - mov ds, bx - mov es, dx - - ; done? - dec bp - jz nonmajicmemcpy_rest - - ; copy one 256 byte run - mov cx, 0100h - a16 rep movsb - - ; move 'segments' 256 bytes forwards - ; (eax = [es:ds]) - add bx, 0010h - add dx, 0010h - - ; continue - jmp nonmajicmemcpy_loop256 - -nonmajicmemcpy_rest: - pop cx ; restore 'left-over' after full 256 byte copies - inc cl ; pre increment count - -nonmajicmemcpy_restloop: - dec cl - jz nonmajicmemcpy_done - - movsb - jmp nonmajicmemcpy_restloop - -nonmajicmemcpy_done: - - ; restore segments - pop es - pop ds - - popa - ret - -gdtinfo: - -dw gdtlength -dd gdt_table - -;********* GDT TABLE -gdt_table: - -null_desc desc 0,0,0 - -flat_code desc 0, 0xFFFFF, D_CODE + D_READ + D_BIG + D_BIG_LIM - -flat_data desc 0, 0xFFFFF, D_DATA + D_WRITE + D_BIG + D_BIG_LIM - -gdtlength equ $ - gdt_table - 1 -;********* END GDT TABLE -krnl_entry dd 0 - -times 510-($-$$) db 0 -dw 0xAA55 diff --git a/src/sys/boot/format.c b/src/sys/boot/format.c deleted file mode 100755 index 833856a..0000000 --- a/src/sys/boot/format.c +++ /dev/null @@ -1,204 +0,0 @@ -/************************************************************************************** -$Id$ - - -**************************************************************************************/ - -#include -#include - -unsigned long getfilesize(char *filename); -unsigned long ceil(double __x); - -typedef struct { - unsigned char jmp[4]; /* jump to code (4bytes) */ - unsigned char id[6]; /* Should be 'UbixFS' */ - unsigned long version; /* Should be 1 */ - unsigned long fs_start; /* LBA pointer to the start of the FS */ - unsigned long krnl_size; /* LBA pointer to Kernel file entry */ - unsigned int BytesPerSector; - unsigned int SectorsPerTrack; - unsigned int TotalHeads; - unsigned long TotalSectors; - unsigned char code[479]; - } __attribute__ ((packed)) t_bootsect; - -typedef struct { - unsigned char type; /* 0 = unused. 1 = file entry. 2 = data_entry */ - unsigned long prev_entry; /* LBA pointer to previous file entry */ - unsigned long next_entry; /* LBA pointer to next file entry */ - unsigned char filename[255]; /* File name, padded with NULLs */ - /* Attributes - * Bit 0: Read - * Bit 1: Write - * Bit 2: Execute - * Bit 3: Hidden - * Bit 4: Directory - * Rest are unused, and available for future expansion - */ - unsigned char attributes; - unsigned long size; /* size in bytes */ - unsigned long parent_dir; /* LBA pointer to parent dir entry */ - unsigned long first_dataentry; /* LBA pointer to next data struct */ - unsigned char padding[3819]; - } __attribute__ ((packed)) t_file_entry; - -typedef struct { - unsigned char type; /* 0 = unused. 1 = file entry. 2 = data_entry */ - unsigned long prev_entry; /* LBA pointer to previous data/file entry */ - unsigned long next_entry; /* LBA pointer to next data/file entry */ - unsigned char data[4087]; - } __attribute__ ((packed)) t_data_entry; - -// argv[1] = start of FS -// argv[2] = file to put onto FS - -int main(int argc, char **argv) { - t_bootsect bootsect; - t_file_entry file_entry; - t_data_entry data_entry; - unsigned char *data; - unsigned long _fs_start; - unsigned long filesize=0; - unsigned long cur_lbasector = 0; - char filename[255]; - unsigned long no_of_files, file_loop=0; - unsigned int loop=0; - FILE *dev, *file; - if (argc < 4) { - printf("Usage: format \n"); - exit(1); - } - sscanf(argv[2], "%d", &_fs_start); - sscanf(argv[3], "%d", &no_of_files); - - printf("Size of t_bootsect = %d\n", sizeof(bootsect)); - printf("Size of t_file_entry = %d\n", sizeof(t_file_entry)); - printf("Size of t_data_entry = %d\n", sizeof(t_data_entry)); - printf("Size of data_entry.data = %d\n", sizeof(data_entry.data)); - - for (loop=0; loop<4; loop++) { - bootsect.jmp[loop] = 0; - } - - bootsect.id[0] = 'U'; - bootsect.id[1] = 'b'; - bootsect.id[2] = 'i'; - bootsect.id[3] = 'x'; - bootsect.id[4] = 'F'; - bootsect.id[5] = 'S'; - bootsect.version = 1; - bootsect.fs_start = _fs_start; - bootsect.BytesPerSector = 512; - bootsect.SectorsPerTrack = 18; - bootsect.TotalHeads = 2; - bootsect.TotalSectors = 2880*512; - bootsect.krnl_size = _fs_start; - - for (loop=0; loop>2) & 0x400 ;Gate - dw %1 - dw %2 - dw (%3)+D_PRESENT - dw (%1) >> 16 -%else ;Not a gate - dw %2 - dw %1 - db (%1) >> 16 - db ((%3)+D_PRESENT) >> 8 - db (%3) + ((%2) >> 16) - db (%1) >> 24 -%endif -%endmacro - -;----------------------------------------------------------------------------- -; -; A gate is identified as any descriptor whose flags has bit 10 set and -; bit 12 clear. -; -; For a gate, the following rearrangement occurs: -; -; subField Final location -; ------------------ -------------- -; Selector[0..15] 16..31 -; Minor control bits 32..39 -; Major control bits 40..47 -; Offset[0..15] 0..15 -; Offset[16..31] 48..63 -; -; For non-gates the following rearrangement occurs: -; -; subField Final location -; ------------------ -------------- -; Limit[0..15] 0..15 -; Limit[16..19] 48..51 -; Minor control bits 52..57 -; Major control bits 40..47 -; Base[0..23] 16..39 -; Base[24..31] 56..63 -; -; The last parameter to the desc macro contains all the control bits -; combined. It is generated by adding together the appropriate -; D_ constants. For all descriptors, it has the major control bits in D_ -; bits 8 to 15. The minor control bits are in either D_ bits 0 to 7 or bits -; 4 to 7 depending on the type of descriptor. -;_____________________________________________________________________________ - diff --git a/src/sys/boot/help.txt b/src/sys/boot/help.txt deleted file mode 100755 index ddbe15a..0000000 --- a/src/sys/boot/help.txt +++ /dev/null @@ -1,13 +0,0 @@ -$Id$ - -UbixOS Help File ----------------- - -There Are Only Six Commands Currently Supported By This Shell - -ls - Gives you a directory listing -cat - Displays the contents of -version - Displays the version of this os -credits - A list of current developers of this os -reboot - Reboots the machines -exec - Execute File diff --git a/src/sys/boot/readme.txt b/src/sys/boot/readme.txt deleted file mode 100755 index 45b4c7e..0000000 --- a/src/sys/boot/readme.txt +++ /dev/null @@ -1,7 +0,0 @@ -$Id$ - -Please see the file LICENSE for copyright information. The source tree map is as follows: doc - contains most UbixOS documentation. examples - example files help - CLI Help Files developer - developers handbook FAQ - UbixOS FAQ manual - user manual src - contains all source files for UnixOS bin - init - shell grayspace-misc(temporary) lib - libc sys - tools For information on source tree syncing please refer to: \ No newline at end of file diff --git a/src/sys/boot/writeimg.c b/src/sys/boot/writeimg.c deleted file mode 100755 index 4c4425a..0000000 --- a/src/sys/boot/writeimg.c +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************************** - Copyright (c) 2002 The UbixOS Project - All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors. -Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors -in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project nor the names of its -contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - $Id$ - -**************************************************************************************/ - -#include - -int main(int argc, char **argv) { - FILE *in,*out; - int tmp; - - in = fopen("bootsec","rb"); - out = fopen(argv[1],"r+b"); - while(!feof(in)) { - tmp = fgetc(in); - fputc(tmp,out); - } - close(in); - close(out); - return(0); - }