Verbal algorithm for the computer boot process. Open Library - open library of educational information


A long time ago, when I was little, I worked in an institute laboratory on a large computer SM-3 (something like the famous PDP-11), bootstrapping (loading) the computer looked like this. A short paper tape with a boot program punched on it was inserted into the photo reader, the reading process was started, and then... depending on your luck.

The fact is that the paper tape gradually wore out, began to be difficult to read, and the computer might not start the first time. In this case, the process had to be repeated, sometimes several times, until the bitter end. When the tape completely failed and the machine did not want to “come to life”, it was necessary to temporarily enter the boot program manually using the switches located on the front panel. The main thing here was to take your time and not make mistakes.

With modern computers, the boot process is largely automated, but that doesn't mean it's not worth getting to know.

Basic definitions and stages of loading an operating system

Turning on the computer, POST, BootMonitor

The initial stage of loading the operating system after turning on the computer begins in the BIOS (Basic Input/Output System). In the BIOS settings we specify the boot device, or a number of boot devices in order of priority. Various boot options and their combinations are possible: from a hard drive, CD/DVD drive, USB flash drive and others.

Immediately after passing POST (Power-On Self-Test), the computer’s BIOS will begin to cycle through the specified boot devices one by one until it finds a suitable special entry on one of them, which contains information about further actions.

Level 1 loader. Master Boot Record

Master Boot Record is the master boot record, located in the first physical sectors of boot storage devices. It contains a Partition Table and executable code.

The main task of the program written in the MBR is to search for the active system partition of the disk and transfer control to its boot sector. Thus, this stage can be called preparatory, due to the fact that the OS itself is not directly loaded yet.

The system partition is usually called the partition of the disk (storage device) on which the operating system files responsible for the OS boot process are located (the operating system itself can be located in another partition). In principle, there can be several system partitions, so one of them is marked as active. This is what the program loaded from the MBR is looking for.

Level 2 bootloader. Partition Boot Sector

The next stage of booting the computer is transferring control to the executable code recorded in the PBS (Partition Boot Sector - the boot sector of the active partition). PBS is located in the first sector(s) of the corresponding disk partition. The PBS code specifies the name of the operating system loader file, to which control is transferred at this stage.

The initial stage of loading the operating system. OS boot manager

Initially, the boot loader in Linux was LILO (Linux Loader). Due to its shortcomings, the main one being the inability to understand the file systems used in Linux, the GRUB (GRand Unified Bootloader) bootloader was later used, in which the shortcomings of LILO were corrected.

If we are talking about versions of Windows before Vista, for example, Windows XP, then Ntldr will be loaded. It, in turn, reads information from the Boot.ini text file, which records information about installed operating systems.

Loading the operating system kernel

The final stage of loading the operating system is loading the OS kernel and transferring control to it.

Several years ago there was such a funny case in my practice.

I was asked to help a man buy and organize a computer for his home. This friend had just retired at that time, and before that he worked as a boss and saw the computer, for the most part, from afar, on his secretary’s desk. After retirement, he had the time and desire to master the computer. Well, I think that's great. We found him an inexpensive, but high-quality computer with a good monitor, for those times. I installed and configured some programs and showed them how to use them. The gentleman acquired a book from the series “ Something for dummies“And we parted absolutely satisfied with each other.

About a week later, my ward called me on the phone and, almost crying, told me that everything was gone and the computer no longer worked. Fortunately, he did not lock himself away and honestly told how it happened. And it was like this. A friend went to explore the contents of his computer and found several suspicious and “unnecessary” files, in his opinion, in the root of the C:\ drive. He decided to free up space and simply deleted these files. I think that everyone already guessed that it was boot.ini, ntldr, ntdetect, etc. It wasn’t difficult to correct the situation, except that I had to go to him again.

By the way, in order to get problems with loading Windows XP, you could not erase anything, but slightly “tweak”, for example, boot.ini.

Apparently Microsoft somehow found out about this case and in the next version of its OS decided to hide the bootloader files better.

Features of loading Windows Vista / 7 / 8 operating systems

In Windows Vista or Windows 7/8 the boot manager is called Bootmgr. It reads the list of installed operating systems not from a simple text file, which is boot.ini, but from the system BCD (Boot Configuration Data) storage, accessed through a special utility bcdedit.exe.

But that is not all. Open “Computer Management” -> “Disk Management” >

The standard installation process of the Windows Vista / 7 / 8 operating system creates an additional “System Reserved” partition at the beginning of the disk. It is not assigned a drive letter, so unless additional steps are taken, both the partition itself and its contents will be hidden from the user. This main partition has the status “System” and “Active” and, therefore, cannot be deleted either.

In Windows 7, the size of such a partition is 100 MB, of which about 30 MB is occupied; in Windows 8, it is already 350 MB, of which 105 MB is occupied. This difference is explained by the fact that in Windows 8 the “Recovery” folder was moved to this partition.

Let's look at the contents of the "Reserved by the system" section. To do this, assign it a drive letter, for example, “W” in “Disk Management”. Additionally, open “Control Panel” -> “Folder Options” and on the “View” tab, uncheck “Hide protected system files” and check “Show hidden files, folders and drives”.

If the FAR Manager file manager is installed on the system, then you can use it to view it and not have to configure the visibility of hidden files.

This is what the contents of the “System Reserved” section look like in Windows 8 >

As expected, at the root of the partition we see the Bootmgr bootloader.

And this is what part of the contents of the “Boot” folder looks like >

In the folder we find the BCD Boot Configuration Database and its accompanying folders with language and font files.

To complete the picture, it remains to say which partition is called the boot partition. The answer is already shown in the picture with Windows 7 volumes. Obviously, this is the partition on which all the main files of the operating system are located.

Well, it’s very easy to remember the names of disk partitions according to the principle “it’s the other way around” - on the system one there is no system (operating system), but there is a third-level bootloader, on the boot one there is no bootloader, but the system itself is located. Naturally, this “memory” only works when there are several sections. If there is only one partition, then it can be system, active and boot at once.

The main task of the 3rd level boot loader, which, depending on the type of OS, is Bootmgr, Ntldr or GRUB, is to read from the boot disk and load the operating system kernel. In addition, in the case of multiple booting, when several operating systems are installed on the computer, the 3rd level boot loader allows you to select the one you need each time you start the computer.

A classic mistake that Microsoft has dedicated to is installing Windows XP after Windows Vista/7/8. The Windows XP installer marks its partition as active, after which, during boot, the MBR transfers control to the PBS of this partition, which, in turn, passes control to Ntldr. The Windows XP boot loader does not know anything about later versions of Windows operating systems and loading them becomes impossible. It is quite easy to treat, but this situation can confuse an inexperienced user.

There is practically nothing to add to this and you can proceed directly to editing the boot menu. Let's start with .

10 comments

    • Thanks for your feedback. In the near future, I plan to continue describing methods for correcting loading errors using specific examples. I know from experience that while you read everything seems to be clear, but when it comes down to it in practice, difficulties begin.

  1. Please tell me how exactly to treat?:
    “The Windows XP loader does not know anything about later versions of Windows operating systems and loading them becomes impossible. It is quite easy to treat, but this situation can confuse an inexperienced user.”

    I installed XP after Vista on the laptop - as a result, the system starts until XP starts loading and everything reboots again, and if you turn off the power adapter (while the OS is loading), then everything boots normally. If you boot in safe mode, you do not need to disable the adapter. What can hit us and how can we fight it?

    PLEASE FOLLOW. THANKS IN ADVANCE. SORRY FOR THE “BROKEN” RUSSIAN.

    • I won’t say anything about the influence of the power adapter on loading XP - I have no specific ideas. Regarding restoring the Vista boot, if this is relevant, then at the end of the post there is a link to the Microsoft support article (919529), which is directly devoted to this topic. To restore, you will need a Vista installation disc. In the command line with administrator rights you need to run:
      X:\boot\bootsect.exe /nt60 all
      where X: is the letter of the optical drive.
      But the XP boot will need to be added manually using the editor. The set of commands will be like this:
      Bcdedit /create (ntldr) /d "Microsoft Windows XP"
      If this command fails, then:
      Bcdedit /set (ntldr) description "Microsoft Windows XP"
      Further:
      bcdedit /set (ntldr) device partition=X:
      X: - the drive letter of the partition on which the XP bootloader files are located, and the path to it:
      bcdedit /set (ntldr) path \ntldr
      bcdedit /displayorder (ntldr) /addlast

    I had a laptop, when I booted and rebooted, Windows immediately turned on, but now I bought a desktop computer and the loading process takes place in three stages. How to do it in order to get rid of these stages. Sorry for the ignorant use of technical terms.

    • Yuri! I'm afraid that the information you provided is clearly not enough to make any recommendations. What Windows and what stages are we talking about? Please check.

    Good health, Alexander.
    How to understand, prevent, and if it happens again, how to get out of such a situation correctly.
    Laptop. Windows 7 installed. After turning it on and entering the password, it showed “missing operating system” - that is, “there is no operating system.” Turning it off and on again gave the same result. It was possible to start only by removing and after some time inserting the battery.
    The day before, however, there was an incorrect shutdown: the flash drive and modem were not turned off first. Previously, such forgetfulness also happened, but there was no such effect.
    I would be grateful for an answer that is accessible to an old “teapot” (I am ten years older than the gentleman in a funny case, but I became acquainted with COMP at about the same age).

    • Vladimir, hello. Happy holidays and all the best.
      In this situation, you did everything right - you reset the “stuck” glitch.
      As the song says: “One drop of rain is not enough rain. One snowflake is not yet snow.” It is possible that nothing like this will ever happen again. Now, if regular problems begin with the launch, then it will be necessary to sort it out. In general, Windows 7 and higher are quite resistant to abnormal shutdowns.
      What to do? You yourself answered your own question - try to turn off devices regularly. And if it is possible to connect an external drive via USB, then I would definitely make (in fact, I do quite regularly) a backup of the system, for example using .

    Hello. I have the same problem, a desktop computer, two hard drives, Windows 10. After the BIOS splash screen, a distorted window appears, the computer does not start, after a forced reboot everything starts and everything works. That is, there is some kind of error between the BIOS and disk selection.

Send your good work in the knowledge base is simple. Use the form below

Students, graduate students, young scientists who use the knowledge base in their studies and work will be very grateful to you.

Volga University named after V.N. Tatishchev

Faculty of Computer Science and Telecommunications

Department of “Informatics and Control Systems”

COURSE WORK

discipline: “System software”

Subject: " Loader

Is done by a student. IS-303

Krasnoseltsev IN. P.

Teacher: Trubacheva S.I.

Tolyatti

Introduction

1. Theoretical part

2. Design part

2.1 Problem statement

2.2 Development of an algorithm for solving the problem

2.3 Description of the application program loading algorithm

2.4 Description of the OS boot algorithm

2.5 Description of the Unix boot algorithm using the LILO boot loader

Conclusion

References

Introduction

The relevance of my course work lies in the fact that the development of computers and their operating systems went parallel to the development of various boot loader programs. Certain operating systems require different bootloaders to boot. For example, the Unix multi-user operating system requires a LILO boot loader and various utilities. Any loading of the operating system affects the RAM, which is used by both the primary and secondary bootloaders. During loading, various types of errors occur, which the bootloader bypasses or completes the loading process (displays an informational message).

A bootloader is a program that more than one computer and more than one operating system simply cannot do without.

1 . Theoretical part

Microsoft OS boot process

Whatever operating system we are considering, in order for the OS to start controlling the computer, it must be loaded into RAM. Therefore, let's look at how the process of loading different OSes occurs. Since we are only interested in booting from hard drives, we will not consider the features of booting from a floppy disk, CD-ROM, and over the network. Let's start with MS-DOS and MS Windows.

As you know, when you turn on your computer, the POST (Power On Self Test) program first runs. It determines the amount of available memory, tests it, determines the presence of other components (keyboard, hard drive, etc.), and initializes adapter cards. Messages usually appear on the screen about the amount of memory, about its testing, a list of detected devices (floppy and hard drives, processor, COM ports, etc.).

After testing is complete, POST calls Int 19h, which attempts to find a boot device. The search is performed in the order defined in Setup BIOS, and is carried out by polling the zero sectors of the corresponding devices. If the disk is bootable, then in its zero sector there is a master boot record - Master Boot Record (MBR). The last two bytes of the MBR are a “magic number”, which is a sign that this sector is an MBR, and therefore the disk is bootable. In addition to the “magic number”, the MBR contains a disk partition table, which was already mentioned above, and a small program - the primary bootloader, with a volume of only 446 (0 * 1BE) bytes.

Table 2.1 shows the structure of the main boot sector created during the installation of Windows.

Table 2.1 Structure of the main boot sector

Interrupt 19h BIOS loads the primary bootloader into the computer's memory and transfers control to this program. But such a small program cannot boot the OS; all it can do is load a more powerful program into memory - a secondary bootloader.

To do this, it searches the partition table for the active partition and reads into memory the secondary bootloader, which is located starting from the first logical sector of the active partition. Notice the word “beginning.” The fact is that the secondary bootloader in different systems has different lengths.

The secondary bootloader loads the first layer of programs needed to run the OS. In the case of MS - DOS, the boot program loads IO.SYS at address 700h, then MSDOS.SYS and transfers control to the SYSINIT section of the IO.SYS module.

If for some reason no active partition is found on the disk, the boot process continues by processing interrupt 18h. This branch is rarely used in its entirety, but this feature can be very useful in some situations. During remote boot, when the OS is loaded from the server, this interrupt is redirected by the POST program to the ROM of the network card.

Problems with large disks

In MS-DOS and the first versions of Windows, access to disks was organized through interrupt 13 (Int 13h) of the BIOS. In this case, addressing sectors on the disk was used based on indicating the numbers of the cylinder, head and sector on the track (C/H/S). More precisely:

1)AH - selection of operation;

2)CP - low-order 8 bits of the cylinder number;

3)CL - bits 7-6 correspond to the most significant bits of the cylinder number, bits 5-0 correspond to the sector number;

4)DH - reading head number;

5)DL - disk number (80h or 81h).

It should be noted that all of the above restrictions are significant only at the OS boot stage, since Linux itself and the latest versions of Windows no longer use BIOS interrupt 13 when working with disks, but use their own drivers for working with disks. But before the system can use its own driver, it must at least load it. Therefore, at the initial boot stage, any system is forced to use the BIOS. This causes restrictions on placing many systems beyond 8 GB; they cannot boot from there, although after a successful boot they can work with much larger disks. In order to understand how we can get around these restrictions, we need some knowledge of how Linux OS boots.

LILO boot loader from Linux OS distribution

Before you begin installing the second OS, you need to choose a method for organizing the OS selection at the computer boot stage. Loader programs solve this problem. There are several programs of this kind. Since we are talking about Linux, the first thing we need to mention is the LILO program, which is included in any Linux distribution.

LILO is a set of several programs: the bootloader itself, programs used to install and configure the bootloader, and service files:

The /sbin/lilo program, which runs under Linux, serves to write all the information needed during the boot phase to the appropriate places. It must be restarted every time a change is made to the kernel or LILO configuration file;

Various service files that LILO needs during boot. These files are usually located in the /boot directory. The most important of them are the bootloader itself and the map file (/boot/map), which indicates the location of the kernel. Another important file is the LILO configuration file, which is usually named /etc/lilo.conf;

The bootloader itself is the part of LILO that is first loaded into memory through a BIOS interrupt, and that loads the Linux kernel or the boot sector of another OS. The bootloader also consists of two parts. The first part writes to the boot sector and is used to load the second part, which is much larger in size. Both parts are usually stored on disk in the file /boot/boot.b.

When installing the system, the LILO boot sector can be placed in the following places:

The boot sector of the floppy disk in Linux format(/dev/fd0,...);

MBR of the first hard drive (/dev/had, /dev/sda,...);

The boot sector of the primary partition of the Linux file system on the first hard disk (/dev/hda1, /dev/hda2,...);

The boot sector of the logical partition in the extended partition of the first hard drive (/dev/hda5,…). True, most programs like fdisk do not assume that you can boot from an extended partition and refuse to declare it active. Therefore, LILO includes a special program (activate) that allows you to bypass this limitation. But the fdisk program from the Linux distribution supports the ability to activate an extended partition. To do this, use either the -b option or the BOOT variable.

The LILO boot sector cannot be placed in the following locations:

The boot sector of a floppy disk or primary partition, formatted in other file systems;

In the Linux swap partition;

In addition to the fact that LILO also needs the following files during loading:

-/boot/map (created when running /sbin/lilo);

All downloadable kernel versions (if you select a kernel version during the download phase);

Boot sectors of other operating systems that will boot via LILO;

Messages issued during loading (if defined)

When LILO boots up, it displays the word “LILO”. In this case, the output of each letter indicates the completion of a certain action or stage of loading LILO. If the download fails, then by the number of letters displayed you can judge the cause of the problem.

Nothing is output - no part of LILO was loaded. Either LILO was not installed or the partition it is on is not active

L [error code] - the primary loader loaded and started (control was transferred to it), but it was unable to load the secondary loader. A two-digit error code indicates the specific cause of the problem. This is usually due to media defects or incorrect disk geometry. Unless LILO stops at this point, throwing an endless string of error codes, the problem is usually easily solved.

LI - the primary loader was able to load the secondary loader, but was unable to launch it for execution. This could be caused by an error in setting the disk geometry or because /boot/boot.b was moved without restarting /sbin/lilo.

LIL - the secondary loader started, but could not launch the descriptor table from the map file. The reason is usually the presence of defects on the disk or incorrectly specified disk geometry.

LIL? - the secondary bootloader was loaded to the wrong address. Typically caused by an error in setting the disk geometry or because /boot/boot.b was moved without restarting /sbin/lilo.

LIL- - descriptor table destroyed. Typically caused by an error in setting the disk geometry or because /boot/boot.b was moved without restarting /sbin/lilo.

LILO - all parts of LILO have been successfully loaded.

The init process and the /etc/inittab file

As you know, after turning on the computer and completing hardware testing, the BIOS is read from the first sector of the boot disk, which is the bootloader program. This program starts the main system boot loader (for example, LILO) which, in turn, loads the system kernel into memory, which is usually stored in the file vmlinuz-x.y.z-a in the /boot directory.

Immediately after booting, the kernel mounts the root filesystem and starts the init process. The init process is the program that is responsible for continuing the boot procedure, and transitioning the system from the initial state that occurs after the kernel boots to the standard state of processing requests from many users.

The exact list of these operations depends on the so-called run level. The execution level determines the list of actions performed by the init process and the state of the system after boot, i.e. configuration of running processes. The runlevel is identified by a single symbol. There are 8 main execution levels in Linux OS:

1)System stop;

2)Single-user mode (for special administration cases);

3)Multi-user mode without NFS (the same as 3, if the computer does not work with the network);

4)Full multi-user mode;

5)Use is not regulated;

6) Typically used to run the system in graphical mode;

S) (or s) - roughly the same as single-user mode, but S and s are used mainly in scripts.

The first thing the init process does after starting is read its configuration file /etc/inittab. This file consists of individual lines. If a line begins with a # or is empty, it is ignored. All other lines consist of 4 fields separated by colons:

id : runlevels : action : process

id - row identifier;

runlevels - run levels;

process - process;

action - action;

The action field contains a keyword that defines additional conditions for the command specified by the process field. Valid values ​​for the action field:

respawn - restart the process if it terminates;

once - execute the process only once when moving to the specified level;

wait - the process will be launched once when moving to the specified level;

sysinit - This keyword designates actions performed during the system boot process, regardless of the run level (the id field is ignored).

boot - the process will be launched at the system boot stage from the run level;

bootwait - the process will be started at the system boot stage from the run level, and init will wait for its completion;

initdefault - the line in which this word appears in the action field determines the execution level to which the system goes by default.

off - ignore this element;

powerwait - Allows the init process to stop the system when power is lost.

Ctrlaltdel - allows init to reboot the system when the user presses a key combination on keyboard.

This list is not exhaustive. More information about the inittab file can be found in the init(8), inittab(5), and getty(8) man pages.

2 . Project part

2.1 Problem statement

It is necessary to study theoretical material on the chosen topic, develop an algorithm for the loader to operate when implementing the method (present in the form of a block diagram), and describe the algorithm.

2.2 Development of an algorithm for solving the problem

Input: Single-processor system, application program, LILO boot loader, POST program, mutual exclusion.

Figure 1 shows the “application program loading” algorithm.

Figure 2 shows the algorithm for “loading the Operating System”

2.3 Description of the application program loading algorithm

1) The application program is launched for execution. Afterwards the system program “Bootloader” is activated.

2) After activation, scanning of RAM begins to find free areas.

3) If such areas are found, then the determination of the beginning of the location address of the free area begins. Then we go to this address and determine the size of the free area.

4) Afterwards, the size of the code of the application program that is launched for execution is determined.

5) Compare the size of the code and the size of the free area in RAM.

6) If there is enough space in RAM to copy the application program code, then the virtual page numbers of the physical pages are set in the page table. Then the application program code is copied into RAM. And completion of the process.

7) Otherwise, we will find out whether there is enough space in RAM for part of the application program code. If so, then we repeat those steps when there is enough space for the complete code of the application program. But after copying the code into RAM, part of the code is copied into the swap area.

8) If there is not enough space for part of the code, then the transition to the stage of scanning the RAM occurs to find free areas.

2.4 Description of the OS loading algorithm (Operating System)

1) The POST program starts. This program tests available memory, determines the presence of other components (various PC devices, for example: keyboard, hard drive, etc.) and initializes adapter cards.

2) After the POST program runs, the results of its work are displayed on the screen.

3) Call the 19H program, which tries to find the boot device.

4) Interrupt 19H BIOS loads the primary boot loader into the computer memory and transfers control to this program

5) Due to the lack of power of this program, load the OS. She is therefore looking for a more powerful program that is capable of this - a secondary bootloader. To do this, it searches the partition table for the active partition and reads the secondary bootloader into memory.

6) The secondary boot loader loads the first layer of programs needed to run the OS. The bootloader program loads the IO.SYS module at address 700h, then MSDOS.SYS transfers control to the SYSINIT section of the IO.SYS module.

7) If for some reason the active partition in the partition table was not found on the disk, the boot process continues by processing the 18h interrupt.

2.5 Description of the loading algorithmUnixusing bootloaderLILO

1) Run the /sbin/lilo program to write all the information needed during the boot phase to the appropriate places. Search for service files required by LILO during boot.

2) If the files are not found, a message indicating the end of the download is displayed.

4) If the primary loader was unable to load the secondary loader, an information message indicating an error during loading is displayed on the screen.

6) If the primary loader successfully loaded the secondary one, but failed to start, then an information message about an error during loading is displayed.

7) Otherwise, the secondary bootloader is launched.

8) Checking that the secondary bootloader has loaded to the correct address.

9) If not, then an information message about errors during loading is displayed.

10) Checking whether the descriptor table is destroyed. If yes, then an information message about an error during loading is displayed. And if not, then the descriptor table is loaded from the map file.

11) Checking whether the launch of the descriptor table was successful. If not, then an information message about an error is displayed at startup.

12) Otherwise, display an information message about the successful loading of LILO.

Conclusion

This course work examines some aspects of loading programs. Types of loaders: moving, primary, secondary, etc. The necessity of using the bootloader in various operating environments has been proven. Various boot methods are covered, such as application boot, LILO boot, and OS boot. Theoretical material on the topic has been studied, algorithms for the operation of the loader when implementing the method have been developed (presented in the form of a block diagram).

References

1. Tanenbaum Andrew. Modern operating systems / Andrew Tanenbaum. - 2nd ed. - St. Petersburg: Peter, 2002. - 1037 pp.: ill. - (Classics of Computer Science). - ISBN 5-318-00299-4

2. Partyka, T.L. Operating Systems, Environments, and Shells: A Tutorial for Environments. Prof. Arr. rec. MO / Partyka, T.L., Popov, I.I. - M.: FORUM: INFRA - M, 2006. - 399 pp.: ill. - (Professional education). - ISBN 5-8199-0072-5-16-001355-5

3. Olifer, V.G. Network operating systems: Textbook. manual for universities MO / Olifer, V.G., Olifer, N.A. - St. Petersburg: Peter, 2003. - 538 p.: ill. - ISBN 5-272-00120-6

4. Trubacheva, S.I. Programming in operating systems: Methodical manual / Trubacheva, S.I. - Tolyatti: VUiT, 2006. - 44 p.

5. Terence Chan. System programming in C++ for Unix / Ed. Kolomytseva. - Kyiv, 2004.

6. Tacket D., Barnett S. Special edition. Using LINUX / Transl. from English - 4th ed. St. Petersburg: Williams, 2003.

7. Ivanova G.S. Programming in SI++ / Textbook. Ed. M.: MSTU, 2002.

Similar documents

    General characteristics of the Android system, review of its analogues. Necessary components to get started in Android. Setting up Ubuntu configurations. Writing scripts to simplify Linux generation. Debugging and testing the program on the freescale i.MX53 board.

    course work, added 10/12/2012

    Consideration of the characteristics of boot managers. Description of Download Accelerator Plus, Download Master, FlashGet, GetRight, ReGet, Go!Zilla. Comparative characteristics of Windows boot managers. Programs for Unix, Linux and Mac operating systems.

    abstract, added 09/06/2014

    The concept and structure of distributions of the Linux operating system, the history of their origin and the main developers. Classification of distributions by the nature of assembly and installation, modification of their finished versions. Description of ways to create your own distribution.

    course work, added 04/02/2014

    General diagram of the loading process, its main stages and distinctive features. Primary and secondary loaders, their functionality and directions of action. Places for possible placement of the boot sector. Disk space requirements.

    presentation, added 12/20/2013

    Analysis of the technical capabilities of the Mandriva Linux operating system - a GNU/Linux distribution developed by the French company Mandriva, which produces free, commercial and corporate versions of its distribution. Linux shell installation steps.

    presentation, added 05/23/2010

    Highlights of the history of operating systems that link hardware and application programs. Characteristics of the Microsoft Windows Seven operating system, analysis of the Linux operating system. Advantages and disadvantages of each operating system.

    course work, added 05/07/2011

    Selecting tools for developing a distribution installation program. Implementation of a module for the Gentoo distribution, operating according to the user manual for this system. Testing the installation program on various architectures.

    thesis, added 07/18/2013

    Stages of loading a Linux system, registration. User account management. The principle of naming devices, the purpose and use of special files. Managing files, access to the file system, tasks. Basic Linux file structure.

    training manual, added 11/15/2014

    Consideration of various operating system distributions. Study of data exchange protocols and physical data storage formats. Development of a distribution based on the Linux operating system for operation as part of the StarNAS network storage.

    course work, added 11/05/2015

    Features of loading the Linux operating system in terminal mode, logging in and registering users. Performing file reassignment, using it to work with operating system commands. Application of software channels (conveyors).

The operating system is stored in external memory, usually on a hard disk, less often on a floppy disk. For normal operation of a computer, it is necessary that the main modules of the operating system be in RAM. Therefore, after turning on the computer, the operating system is automatically rewritten (loaded) from the disk into RAM. The most important aspects of this loading are depicted in the form of an algorithm in Fig. 9.13.

Rice. 9.13. Algorithm for loading the operating system from disk into RAM

After turning on the computer, you watch the numbers change on the screen. These numbers reflect the process of testing RAM by the BIOS program. If a fault is detected in the RAM cells, a message will be displayed.

After successfully completing the hardware testing, the drive with floppy disk A is accessed, and the indicator light next to it lights up. If you are loading the operating system from a floppy disk, then before or during testing you must insert the system disk into drive A. Otherwise, if there is no operating system on disk A, the hard disk is accessed, as evidenced by the indicator light next to it.

Reading into the RAM of the 0th sector of the 0th side of the disk in which the bootloader is located (BOOT RECORD) begins. Control is transferred to the bootloader, which checks for the presence of the IO.SYS expansion module and the MSDOS.SYS base module on the system disk. If they are in their designated place (cm. rice. 9.10), then it loads them into RAM, otherwise a message about their absence will be displayed. In this case, it is recommended to re-download. The reboot signal transfers control to the permanent BIOS module, which again writes the boot block from the disk into RAM, etc.

Remember! For reboot the operating system press the keys simultaneously into memory .

After successfully loading the IO.SYS expansion module and the MSDOS.SYS base module into the RAM, the COMMAND.COM command processor is loaded and the CONFIG.SYS configuration file is processed, which contains commands for connecting the necessary drivers. This file may be missing if you are happy with the base version of the operating system.

The batch file AUTOEXEC.BAT is then processed. Using this file you can configure the operating environment parameters. For example, create a virtual disk, change printing modes, load auxiliary programs, etc.

Attention! Files with the .BAT extension play a special role when working in a system environment. They contain a set of operating system commands or executable file names. After running a file with the .BAT extension, all commands written in it are executed automatically one after another.

A file with the standard name AUTOEXEC.BAT differs from other files of the .BAT type in that the execution of commands placed in it begins automatically immediately after the operating system boots.

If the AUTOEXEC.BAT file is missing, you will be prompted to enter the date and time:

if you press the enter key, the so-called system parameters determined by the computer timer will be accepted as the current date and time;

If you want to reset the system date and time, then in response to the prompt, enter the values ​​in one of the provided forms, for example:

10-25-1997 (month day year)

7:30:10.00r (hours:minutes:seconds)

After the AUTOEXEC.BAT file finishes running, and if this file is not found, a system disk prompt will be displayed on the display screen, for example C:\>. This indicates that the boot process has completed normally and you can begin working by entering the application name or operating system command.

Note. The CONFIG.SYS and AUTOEXEC.BAT files may be missing. In this case, the operating environment settings will be set to default.

Remember! The hard drive must permanently store the operating system.

When you turn on your computer, all floppy drives must be open.

The floppy disk with application programs must be inserted into the drive after the download is complete.

A bootloader is a system program that performs booting. Many loaders also provide movement and linking. Some systems separate the linking function from the move and load functions. Linking is performed by a special linking program (or link editor), moving and loading by the loader.

Linking is the linking of two or more separate translated programs.

Relocation is the modification of an object program so that it can be loaded from a different address than the original one.

Bootloader functions:

  1. OP distribution;
  2. moving a program;
  3. linking modules;

OP distribution

Moving a program

If there are address constants inside the modules that are calculated from the beginning of the module, then the addresses will be adjusted relative to the Base.

Linking modules

Types of bootloaders

Compile-run loaders

One of the possible ways to perform the loader function may be to organize the work of the assembler in such a way that the assembler, working in one part of the memory, places machine instructions and data as it is assembled directly into the memory cells allocated for them. Once compilation is complete, the assembler passes control to the resulting program's entry point. This is a very simple solution that allows you to do without any additional procedures. This scheme is called "compile-execute", and the "loader" consists of a single instruction that transfers control to the assembled program.

Absolute loaders are easy to implement, but have a number of features:

  • the task of distributing the OP is performed by the programmer (using the directive for setting the initial value of the OP);
  • the task of moving the program is performed by the compiler;
  • linking modules - decided by the programmer (call 600);
  • loading programs into the OP and launching them for execution.

Advantages:

  • smaller bootloader size (memory size);
  • separation of the compilation and loading phases, which reduces the time for processing modules;
  • the ability to use several programming languages, because the structures of the created object modules are identical.

Flaws:

A large amount of work falls on the programmer. It is necessary to constantly monitor changes in starting addresses when modifying modules, because their length changes.

Absolute Loader Object File Structure

The information record consists of:

  1. sign;
  2. absolute address of the OP where information can be transferred;
  3. number of information bytes in the message;
  4. bytes of information;
  5. checksums;
  6. numbering.

The control record consists of:

  1. sign;
  2. entry point address.

A simple absolute loader works:

  1. Check whether there is enough memory for this program (viewing the first record).
  2. Sequential reading of the program body and placement at the specified address.
  3. Transfer of control to the address for program execution.

Tuning bootloader

To avoid the need to reassemble all subroutines when a change is made to one of them, and also to free the programmer from the tasks of memory allocation and communication of subroutines, so-called loaders were developed. This bootloader allows a program to have multiple program segments and one data segment (common segment). The assembler translates each segment separately and provides the loader with text and information regarding movements and cross-references between segments.

The output of the assembler with this scheme is the object program and information about all other programs to which there are calls in this program. In addition, there is information about those places that must be changed during loading (movement information), i.e. about cells whose contents depend on the location of the program in memory.

For each source program, the assembler produces text (translation result) as output information, preceded by a transition vector containing the addresses of the names of subroutines that are accessed in the source program. For example, if the SQRT routine is the first routine called, then the first cell of the jump vector will contain the symbolic name SQRT. Statements containing a call to an SQRT routine will be translated into a jump instruction indicating the address of the branch vector element associated with the SQRT. The assembler will also convey additional information such as the total length of the program and the length of the branch vector. After loading the program text and the jump vector into memory, the loader will load each routine specified in the vector. Then he will place a command to go to the corresponding subroutine in each element of the vector. Thus, calling the SQRT subroutine will result in the execution of a jump command to the first cell of the transition vector, which will contain a jump command to the called subroutine.

This loading scheme with two-stage control transfer is often used in computers with a fixed instruction format and direct addressing.

This bootloader has a number of disadvantages:

  • the transition vector is not entirely convenient for loading and saving external data (located in another program segment);
  • the transition vector increases the length of the object program;
  • The loader operates on program segments, but does not facilitate access to data segments that may be shared by multiple routines.

Directly linking bootloader

The directly linking bootloader most fully provides the ability to move programs and data in memory and is currently the most common. Such a loader has the advantage that it allows the use of a large number of both program segments and data segments and gives the programmer complete freedom to access data located in other segments, while allowing separate translation.

The assembler (translator) must pass the following information to the bootloader with each program and data segment:

  1. segment length;
  2. a list of all segment symbols that can be accessed from other segments, and their relative addresses;
  3. a list of all symbols not defined in this segment that are accessed in this segment;
  4. information about the location of address constants in the segment and a description of how their values ​​should change;
  5. machine codes resulting from translation and assigned relative addresses.

One of the disadvantages of a direct linking loader in its simplest form is that each time the program is executed, it must repeatedly perform the functions of memory allocation, moving, linking, and loading all necessary subroutines. These problems can be resolved by performing the loading using two separate programs: the combiner and the module loader. The output of the combiner is a set of data in a format that allows the program to be loaded into memory, and is called a load module. There are several types of combiners. One of them is the so-called link editor, which stores the information necessary to move the module in memory, so that the module as a whole can then be configured and loaded into an arbitrary memory location. In this case, the module loader must perform memory allocation and relocation functions, but remains free from the complex task of linking object modules and subroutines.

Dynamic loader

In each of the considered schemes, it was assumed that all the necessary routines were loaded into memory simultaneously. If the total amount of memory required by the routines is less than the machine's available memory, problems arise. These difficulties are overcome by using a dynamic loading scheme with sequential use of a combiner and a loader. This scheme is based on the fact that usually different routines are required at different times and can be mutually exclusive. By explicitly defining which subroutine contains calls to other subroutines, you can define a so-called overlay structure that specifies mutually exclusive subroutines.

The loading module is formed. It is relocatable and must have a relocation table. Also, the structure of the loading module must contain information about connections. The loader must contain such a part as an overlay manager; it selects from the boot modules exactly those that are starting, and in the process of work organizes the loading of the necessary modules into the OP.

Dynamic Linking

There are cases when, to ensure efficient use of machine memory, subroutines are dynamically linked during program execution. That is, subroutines are loaded into memory only as they are called. This can be beneficial because... Under certain conditions in the program, some subroutines may not be needed at all. Let's look at an example:

if (condition 1)
subroutine call 1
if (condition 2)
subroutine call 2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
if (condition m)
call subroutine m

Many of the branches will be skipped, and it will not be necessary to load into the OP, for example, subroutine 2 if condition 2 is not met. In this case, the loader must work simultaneously with the program and perform the functions of linking and loading subroutines.







2024 gtavrl.ru.