|
OS Boot ToolsVersion 3.3 Freeware Edition for non-commercial use: DOWNLOAD. This tool set is designed for fast, easy and reliable booting of your operating system or one of the existing OS to PC memory from floppy disks, flash-drives, hard drives from partitions MBR, EBR and GPT including that beyond 2TB limit and with file systems FAT12/16/32, exFAT, NTFS, Minix1/2/3, Ext2/3/4, from CD/DVD-disks with file system ISO-9660 and from ISO-images written to the USB flash-drives (USB-ISO) without installing complicated multistage loaders.
Attention! Incorrect or inaccurate usage of this tools may cause problems with booting your work OS! Windows 98/ME handles 128GiB and larger drives incorrectly. To work with 128GiB and larger drives under Windows 2K/XP certain updates must be installed and LBA48 support must be switched on in the registry. Windows XP and preceding OS don't support drives larger than 2TiB. IntroductionIn spite of existence of complicated boot loaders and boot managers, thus far no any standard for first stage booting from different kind of file systems and drives. That's why an OS or second stage loader developer encounters the complete absence of software that organizes the booting in easy and standard way and immediately faces the task of learning the installation and using of complicated boot-loaders, such as GRUB2, or developing his own first stage loader that will be able to boot the simple OS image file or second stage loader into memory. When solving the task you may encounter common problems:
This toolset provides complete solution of all these problems with maximum reliability and safety and has a variety of unique features. So, for example, no one set of first stage boot-loaders passes the volume identifier, is not able to boot OS from drives of more than 2TB capacity and at that time doesn't provide the loading of such large files on all supported file systems. Valuable advantages of toolset are full unification of booting process independently of file system used and ultimate simplicity of its usage. Also I've done the best to provide the developers the quick startup tools for their own projects. Nevertheless, it is supposed that the user has at least basic knowledge in assembler, PC functioning, disk structure and file systems. History3.3
3.2
3.1
3.0
2.1
2.0
1.2
1.1
1.0
Package contents
LicenseFiles "kernel.asm" and "kernel.sys" are distributed under the terms of free license WTFPL. Files "freedos.sys", "grub.sys", "grub4dos.sys" and "syslinux.sys" are distributed under the terms of GNU GPL v2 license. All other files of this package are distributed under the terms of the license agreements in the file "eula_en.txt". Boot specifications
Package contents descriptionkernel.asm – the source of OS startup sample, written in NASM. You may use this code as a startup for your own project. This sample shows correct initialization and saving the passed values and shows some system parameters. The passed values are shown on the display. kernel.sys – is the compiled sample. You can just copy this file by any convenient way to the root directory of a volume prepared by the "boot.exe" command (see below) then boot from that disk. rawfs.bin – Boot code for linear loading of sectors from partition without file system or with an arbitrary file system. For installation to the partition you need to fix three parameters in boot sectors: first sector of the boot partition, number of bytes to load from disk and volume ID that passed to the loaded kernel in EBX register. The first sector number has 8 bytes (64 bits) and is placed in the position 90…97 in little-endian format. The default value is 1, which means the sector right after the boot sector. This value is counted not from the beginning of the whole disk but from the start of partition. Number of bytes to load has 4 bytes (32 bits) and is placed to the position 98…101 in little-endian format. Volume ID has 4 bytes (32 bits) and is placed to the position 102…105 in little-endian format. The default value is 0. Boot-loader doesn't use bytes from 2 to 89 including, so you may use the loader in file systems that contain in this area their parameters.
incbin "rawfs.bin" incbin "kernel.sys" times 630*2*512-($-$$) db 0 then after building the kernel compile it with the NASM assembler: nasm hdd.asm -o hdd.img add the following lines to the Bochs configuration file: ata0-master: type=disk, path=hdd.img, cylinders=2, heads=10, spt=63, translation=none boot: disk and run Bochs. All sequence may be automated with the help of make-file. If your kernel is small and you wish to optimize boot process, you may explicitly specify the size of your kernel to the loader in bytes and fill it in to the position 98…101 in little-endian format. In this case boot code will calculate how many sectors to load and will load only necessary. Corresponding code in NASM syntax will look like the following: incbin "rawfs.bin", 0, 98 dd Kend-Kstart incbin "rawfs.bin", 102 Kstart: incbin "kernel.sys" Kend: times 630*2*512-($-$$) db 0 The resulting image "hdd.img" will be suitable not only for running in virtual machine. You may copy it to the first sectors of flash-disk and run it in real hardware. fat12.bin, fat16.bin – boot sector images for FAT12 and FAT16 file systems. Note that the bytes 3…61 (including) are the BIOS and file system parameters. This area requires correction after file system generation. If you choose file name other than KERNEL.SYS (the default name), you need to write it in by the capital letters to the position 62…72 in the following format: short file name padded by spaces to 8, then extension padded by spaces to 3 without separating period. In total 11 symbols. fat32.bin, fat32chs.bin, fat32lba.bin – boot sector images for FAT32 file system with automatic access mode, CHS and LBA48 access respectively. Note that the bytes 3…89 (including) are the BIOS and file system parameters. This area requires correction after file system generation. If you choose file name other than KERNEL.SYS (the default name), you need to write it in by the capital letters to the position 90…100 in the following format: short file name padded by spaces to 8, then extension padded by spaces to 3 without separating period. In total 11 symbols. The fat32.bin version of boot-loader occupies two sectors if sector size is 512 bytes, so you need to place second sector anywhere in the reserved area of file system. The number of the reserved sectors is specified in bytes 14…15, in that limits the boot code will seek its extension. Keep in mind that at least two sectors in the reserved area are occupied, – the sector with file system information, its number is specified in bytes 48…49, and the backup copy, its number is in bytes 50…51. Second sector of boot code may be placed at any free sector, but it is preferable to place it closer to the partition start. It is common that the backup copy is in 6-th sector, and file system information is in 1-st, so the best choice will be placing the boot code extension in sector number 2. If the file system formatted so that it is not enough reserved sectors for placing the boot code extension, you need to use CHS or LBA version of loader. If the sector size is 1 kB or more, the whole boot code must be placed in one sector. exfat.bin – boot record for exFAT file system. Note that the bytes 64…119 (including) are the file system parameters. This area requires correction after file system generation. If you choose file name other than KERNEL.SYS (the default name), you need to fill it in to the position 122…134 in the following format: file name up to 8 symbols, then dot without preceding spaces, then up to 3 symbols of extension terminated by null byte. In total not more than 13 symbols including null terminator. exFAT file system allows to create clusters of big size, but due to peculiarities of CPU architecture loader supports cluster size only up to 32kb. It is needed to keep in mind that the whole volume boot record of exFAT file system is protected by checksum and it is needed to update checksum after any change of data in VBR according to documentation at the link in the end of this help. Also you need to update the backup copy of the volume boot record. ntfs.bin – boot record for NTFS file system. Note that the bytes 3…83 (including) are the BIOS and file system parameters. This area requires correction after file system generation. If you choose file name other than KERNEL.SYS (the default name), you need to fill it in to the position 84…96 in the following format: file name up to 8 symbols, then dot without preceding spaces, then up to 3 symbols of extension terminated by null byte. In total not more than 13 symbols including null terminator. Because NTFS boot record has 8-bytes Volume ID, it is not passed as a whole. Instead, EBX register contains the result of XOR operation (exclusive "or") between high and low parts of Volume ID value. Loading of compressed and sparse files is not supported. ext.bin, ext4.bin, minix.bin, minix2.bin, minix3.bin – boot records for Ext2/3, Ext4 and Minix1/2/3 file systems. Note that the bytes 2…11 (including) are the boot-loader parameters. This area requires correction after file system generation. Bytes 2…3 must contain the size of sector in bytes in little-endian (Intel) format. Bytes 4…11 must contain 64-bit number of hidden sectors (sectors, preceding the partition) also in little-endian format. You may omit number of hidden sectors, if you use MBR/GPT loader from this package. If you choose file name other than KERNEL.SYS (the default name), you need to write it in to the position 12…24 in the following format: short file name up to 8 symbols, then dot without preceding spaces, then up to 3 symbols of extension terminated by null byte. In total not more than 13 symbols including null terminator. Because superblock of Ext2 file system version 1.0 and higher has 16-byte Volume ID, it is not passed as a whole. Instead, EBX register contains the result of XOR operation (exclusive "or") between four 32-bit words, making up the Volume ID value. In case that the result of XOR operation is zero (earlier versions of file system have no Volume ID), boot code passes in EBX register the CRC32 code of the whole superblock (bytes 1024…2047 of the partition). Minix loaders always pass the CRC32 code of the superblock. The CRC32 computation algorithm is given below. The Ext4 boot code doesn't support file systems with more than 2^32 blocks (4TiB or more with 1kiB blocks). mbr.bin, ebr.bin – boot code for master and extended boot records. If you need to specify the alternative boot partition, you need to place its number in zero sector in byte number 0x1BD (445), immediately before partition table. The numbering of partitions for alternative boot starts from 1. If that byte contains 0, then the alternative booting is switched off. Keep in mind that in zero sector (MBR) for alternative boot may be specified only the primary partition or the whole extended partition. The logic drive for alternative boot in extended partition you must set in the zero sector of extended partition (EBR) at the same address 0x1BD (445). The number of logical drive also specified starting from 1. hybrid.bin – boot code for first sector on drive with hybrid file system. Hybrid file system is such a disk format when it is simultaneously partitioned and not partitioned, depending on interpretation of the first sector of drive. This sector has both partitions table and file system parameters area. If we treat drive as partitioned, then the start of partition points to the volume boot sector with file system parameters. If we treat the drive as unpartitioned, then the first sector of drive contains the copy of file system parameters with certain changes, so that it is possible to work with data stored on drive. For correct work the FS data area has increased number of reserved sectors to cover all the disk area before the start of partition, and, in case of FAT32 file system, changed pointers to informational sector (FS info) and backup copy of boot sector. On recording of boot code to the first sector of such disk we loose hybridity independently of which boot code we'll record onto it – MBR or VBR. To save hybridity we need to save both file system data area and partition table. For this purpose provided this boot code. To record it to disk you need to transfer onto it bytes 3…89 (BIOS parameters block and file system data) and 440…511 (disk ID, partition table and boot signature) from existing first sector of disk. gpt.bin – boot code for GUID partition table. Code must be placed to protective MBR, the very first sector on disk. GPT is developed to support drives with size more than 2TB. In theory, to work with GUID partitions it is necessary that BIOS of your mainboard support EFI technology. Nevertheless this technology is yet not widely used. This code intended to boot from GPT drives on legacy systems without EFI support. If you need to specify alternative boot partition, you need to set its number in zero sector (protective MBR) in byte 0x1BD (445), immediately before partition table. The numbering of partition for alternative boot starts from 1. If that byte contains 0, the alternative booting is switched off. iso9660.bin – boot code for booting your OS directly from CD without using floppy-disk or HDD emulation. See below the detailed information about creating bootable CD. If the name of OS file image differs from KERNEL.SYS (the default name), you need to type it in by binary editor to the positions 2…14 in the following format: name of file, point, then extension and null byte string terminator. In total not more than 13 bytes, including terminator. Spaces and special symbols in file name and extension are not allowed. The allowed set includes letters, digits and underscore sign. Because CDs don't have a simple unique value, that may be used as a short volume ID, boot code passes in EBX register the CRC32 code of the whole Primary Volume Descriptor of the CD. CRC32 code is calculated according to the algorithm given below. usbiso.bin – boot sector USB-ISO for booting ISO-images from USB-drives. In order to make such universal ISO-image you need to put this sector in the first 512 bytes of bootable ISO-image, after that this image may be both recorded to CD and sector-by-sector to USB drive. In this case you may boot from that drive. This technology is extremely convenient for distribution of installation or Live CD as an ISO-image, that may be used not only on PCs equipped by CD/DVD-drives, but also on netbooks which doesn't have such drives. This boot code doesn't load kernel by itself but only a helper code for ISO9660 bootloader. So, ISO-image must be bootable by its own. USB-ISO boot code doesn't select which file to load and doesn't require any settings. Instead it loads ISO9660 boot code according to El Torito specifications and passes control to it. In theory, this boot code may be used for booting ISO images that have foreign boot code in "No Emulation" mode, nevertheless for this the foreign code must be adapted to work with sectors of 512 bytes in size. ISO9660 loader from this package is fully adapted to this mode and may immediately be used. To protect data on USB-drive from accidental overwrite the boot sector is represented as master boot record (MBR) with one hidden partition that covers the whole disk. In theory, such drive may have additional partitions on free space, but in order to do that you need to shrink the size of hidden partition to the size of ISO-image. This task may easily be solved by using "boot.exe" utility. It is quite sufficient to execute command "boot -b -f cd.iso" and the utility will automatically place USB-ISO boot code into the image file cd.iso and will adjust the size of hidden partition. You may use the files described above in your operating system under terms of license agreements (see eula_en.txt) for file systems generation and formatting. boot, boot.exe – Linux and Windows console executable programs, designed for preparing boot disk or file image for booting for OS or second stage loader satisfying the former boot specifications. Existing OS, including Windows and Linux do not satisfy the specification directly, so never apply these utilities for disk with you working system! See below the description of boot disk preparing process. mksys, mksys.exe – Linux and Windows console executable programs, designed for conversion of some second stage loaders to the format, supported by this package. In spite of that operating systems Windows and Linux could not be directly loaded by these loaders, some versions of GRUB2 loader may be loaded after conversion to necessary format. Why do it? Existing Linux loaders (LILO, SysLinux, GRUB, GRUB2) require mandatory procedure of installation after every update. During installation process the installer determines their physical location, after that modifies boot records and the loader file itself to provide the possibility to load. The resulting file, being bound to definite location, could not be relocated to another place on disk; also such disk could not be copied file-by-file keeping the possibility to boot from it. Besides these restrictions there is a risk of that the installer will not be able to bind the new version of loader on some reasons, and after that this disk will no more be bootable. Using converted loader together with this package removes all mentioned restrictions and allows to upgrade the loader safely without binding it to definite location. This package version supports conversion of the following loaders and kernels: FreeDOS kernel builds 2024-2041, GRUB versions 0.94-0.97, GRUB2 versions 1.96-2.00, GUB4DOS versions 4.1-4.4 and SYSLINUX versions 4.05-4.06. To convert you need to take the original loader file, for example, /boot/grub/core.img, and then run the following command: % mksys -i core.img -o grub2.sys In the case of success utility will report the version of detected loader and create the file "grub2.sys". The resulting file you need to place to the root directory of your Linux boot disk and then to prepare the disk for booting by "boot" utility with specifying the "grub2.sys" file name to load. The boot disk preparing procedure performed only once and not needed for further loader update. To update the second stage loader it will be sufficient just to replace the "grub2.sys" file in the root directory to the newer version. For the Microsoft Windows OS family you need to convert file "ntldr" from the root directory of boot disk for operating systems NT4.0, XP, WS2003, XP64, or file "bootmgr" for operating systems Vista and Windows 7. In the case of FreeDOS OS you need to convert file "kernel.sys". In the case of GRUB Legacy loader you need to convert file "stage2". In the case of GRUB4DOS loader you need to convert file "grldr" (preferable) or "grub.exe". In the case of SYSLINUX loader you need to convert file "ldlinux.bin" from folder "core" of the project. Attention! Because archive doesn't contain *nix file attributes, before using Linux version of "mksys" utility you need to add execution rights to it, for example so: % chmod +x mksys Attention! The boot disk may differ from your system (root) disk. You need to take this into account when placing the resulting file and when preparing drives for booting. freedos.sys – Kernel of operating system FreeDOS build 2041 with FAT32 support turned on for CPU 386+, converted by mksys utility and ready to boot. When using this file don't forget to add to disk other files, necessary for operating system to work. At least you need file "command.com". The link to the project is at the end of this page. grub.sys – Second stage loader GRUB Legacy version 0.97, converted by mksys utility and ready to boot. When using this file don't forget to create file "boot/grub/menu.lst" according to GRUB documentation. The link to the project is at the end of this page. grub4dos.sys – Second stage loader GRUB4DOS version 4.4, converted by mksys utility and ready to boot. When using this file don't forget to create file "boot/grub/menu.lst" according to GRUB4DOS documentation. The link to the project is at the end of this page. syslinux.sys – Second stage loader SYSLINUX version 4.06, converted by mksys utility and ready to boot. When using this file don't forget to add to root directory necessary modules and to create file "syslinux.cfg" according to SYSLINUX documentation. The link to the project is at the end of this page. Converted Microsoft Windows loaders are not included into the package because they are components of OS Windows and are proprietary products. You need to convert them by yourself. Don't delete original loader until you check that converted loader successfully loads. Don't forget to make backup copy of all valuable data from disk. Preparing the drives for bootingThe preparing of drive or file image for booting is made with the help of the "boot.exe" utility under OS Windows or "boot" under OS Linux. Attention! Because archive doesn't contain *nix file attributes, before using Linux version of "boot" utility you need to add execution rights to it, for example so: % chmod +x boot While working, the "boot" utility determines the structure of chosen disk, file system type, selects and writes proper boot code in a safe manner, not destroying file system and stored data. If the disk is partitioned, utility will choose the active partition. If there is no active partition, you will need to explicitly define which partition is to be marked as active, that partition will be prepared for booting. After that you once prepared you disk for booting there is no need to do it again. Just copy the OS image file to the root directory of your disk by any convenient way and it will be loaded on booting. Program usage in OS Windows: > boot [options] And in OS Linux: % boot [options] [devices] [files] Available options for Windows: -v Print version info -l List available devices and partitions -d N Open device/drive N N must be a number for physical device and letter for floppy disk or logical drive -f FILE Open image file -a N Make partition number N active, count from 1 Set 0 to remove activity flag Specify twice to set alternative boot partition -b Record volume boot code -m Record master boot code (MBR/GPT) -n NAME Set name of file to load by boot code. Default is KERNEL.SYS For Linux available all options with the exception of two – -d and -f. Instead of pointing out the drive or file in options, you need just list them in command line. The difference is determined by that in Linux all devices are available in the same file name space as regular files, and there is no need to specify, whether you work with file with name "A" or with drive A. Before preparing disks list all available devices in your system: > boot -l Remember that disk names or numbers may change after reloading your operating system! In displayed list will be shown detailed information about all partitions, which partition is active, already have boot code and the name of file that will be loaded. Then determine the disk you need to work with and enter additional options for certain actions you need to perform, for example: > boot -d4 -bfor recording boot code to the active partition of drive 4 in OS Windows. The command line in Linux will look like that: % boot /dev/sdd -b Never choose the disk with your working OS! Remember that the actual boot drive of your system may differ from the disk where your copy of Windows is installed! It will be a good idea to backup the system area of your disk with the help of any binary disk editor, for example DMDE. This may require an extensive knowledge about disk structure. If your drive is partitioned, you'll probably need to write not only volume boot code but also master boot code with the -m option and to specify active partition with -a option. Along with main (active) boot partition you may setup alternative boot partition. This can be done by specifying the -a option twice. The first option will set the active partition and the second – alternative. In this case if you'll press and hold Alt key at system bootup, the alternative partition will be booted. Both active and alternative may be any partition or logic drive on disk without any restriction. If you have to boot from image file in your emulator or virtual machine, then enter, for example, the following command: > boot -f floppy.img -bor for Linux: % boot floppy.img -b In the simplest case you may try to prepare bootable floppy disk. This may be done by the following command: > boot -dA -bor for Linux: % boot /dev/fda -b After that copy file kernel.sys from archive to floppy disk and boot from floppy. Booting from CDTo create bootable CD you first need to download free toolset for preparing CD – CDRTools. For Linux OS you may download it directly from developer's site: http://cdrecord.berlios.de/. For Windows you need to download Cygwin-port, – archive of pre-compiled binaries for Windows. You better download it from this location: http://smithii.com/cdrtools, because on a developer's site only old version port is present. You need two files from archive: mkisofs.exe (utility for creation ISO disk image) and cygwin1.dll (POSIX-library for running Unix-oriented applications on Windows environment). Unpack these files to project directory or to any directory pointed by path of executables search. Then create subdirectory for files with CD image, for example, cdimage. Copy boot sector iso9660.bin and kernel file of your OS kernel.sys to this directory. If the name of your file differs from default, don't forget to fix it in boot sector as described before in boot sectors section. After all this you can start creation of disk image: > mkisofs -b iso9660.bin -no-emul-boot -o cd.iso cdimage This is minimal command that allows us to build ISO-image of bootable CD. Here option -b gives the name of file with boot sector, -no-emul-boot points out the mode of boot sector work. These options are obligatory. You'll see the additional appeared file BOOT.CAT in the disk image. This is auxiliary file for booting system in accordance with El Torito specification, pointing to BIOS, where is located our boot sector and in what mode it is running. This file and boot sector are not needed to user after system bootup, so we may hide them with the help of additional options: -hide boot.catalog and -hide iso9660.bin. System will run OK without these files. File system ISO-9660 imposes strict limitations to filenames. To get more freedom in naming files we may create disk with file system extension Rock Ridge. This is done by -r option. Nevertheless, Rock Ridge is more oriented to Unix-systems, but Windows-systems use Joliet extension of file system. To create image with this extension, use option -J. But after adding this option you may notice that files boot.catalog and iso9660.bin appear back. This is because Joliet extension in contrast to Rock Ridge extension stores filenames in separate, Joliet-specific disk structures, but not in the main structures as in Rock Ridge. To hide them again from Joliet namespace use options: -hide-joliet boot.catalog and -hide-joliet iso9660.bin, correspondingly. Now we prepared bootable disk image without strict limitations to filenames and their attributes. You may check the obtained image in PC emulator Bochs and then burn it by any software that supports burning ISO-images to the recordable CD. CRC32 checksum calculationHere is given in "C" programming language an optimized in speed sample code of CRC32 calculation based on primitive polynomial 0xEDB88320, adopted as standard for data transmission networks.unsigned long CRCTable[256] = { 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D }; unsigned long CalculateCRC (const unsigned char *buf, size_t size) { unsigned long CRC=0xFFFFFFFF; while ( size ) { CRC = (CRC>>8) ^ CRCTable[(unsigned char)CRC ^ *buf]; ++buf; --size; } return CRC^0xFFFFFFFF; } TroubleshootingIn case of problems with booting your OS... Ensure that you specified correct file name to load when installing the boot code. Ensure that the file specified for loading actually exists and is placed to the root of file system. Try to boot the demo file. If the other image file name is given, just rename the demo file. If demo file loaded correctly, most probable that the problem is in your OS. If demo file is not loaded, ensure that drive is prepared for booting. For this you may run the command for device listing "boot -l" and look if necessary partition is marked as "boot" and "active". There you also may see which file will be loaded in every partition. In addition you need to ensure that the main boot record also has mark "bootable". If demo-file loads OK but your kernel doesn't load. Most probable that you didn't setup segment registers (including CS), didn't set the correct "org" directive or didn't setup stack. Best solution in this case would be either subsequent changes in supplied demo-kernel for your purposes, or transferring the whole initialization code from demo-kernel to your kernel. Links
Second stage loaders and operating systems: Documentation: Tools: 25.09.13 |