mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-23 21:20:42 +08:00
translated
This commit is contained in:
parent
cfab2c7c22
commit
41db0ff5b1
@ -1,76 +0,0 @@
|
||||
[#]: subject: (How FreeDOS boots)
|
||||
[#]: via: (https://opensource.com/article/21/6/freedos-boots)
|
||||
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
How FreeDOS boots
|
||||
======
|
||||
An overview of how your computer boots up and starts a simple operating
|
||||
system like FreeDOS.
|
||||
![Code going into a computer.][1]
|
||||
|
||||
One thing I appreciate from growing up with DOS computers is that the boot process is relatively easy to understand. There aren't a lot of moving parts in DOS. And today, I'd like to share an overview of how your computer boots up and starts a simple operating system like FreeDOS.
|
||||
|
||||
### Initial bootstrapping
|
||||
|
||||
When you turn on the power to your computer, the system performs several self-checks, such as verifying the memory and other components. This is called the **Power On Self Test** or "POST." After the POST, the computer uses a hard-coded instruction that tells it where to find its instructions to load the operating system. This is the "boot loader," and usually it will try to locate a Master Boot Record or (MBR) on the hard drive. The MBR then loads the primary operating system; in this case, that's FreeDOS.
|
||||
|
||||
This process of locating one piece of information so the computer can load the next part of the operating system is called "bootstrapping," from the old expression of "picking yourself up by your bootstraps." It is from this usage that we adopted the term "boot" to mean starting up your computer.
|
||||
|
||||
### The kernel
|
||||
|
||||
When the computer loads the FreeDOS kernel, one of the first things the kernel does is identify any parameters the user has indicated to use. This is stored in a file called `FDCONFIG.SYS`, stored in the same root directory as the kernel. If `FDCONFIG.SYS` does not exist, then the FreeDOS kernel looks for an alternate file called `CONFIG.SYS`.
|
||||
|
||||
If you used DOS in the 1980s or 1990s, you may be familiar with the `CONFIG.SYS` file. Since 1999, FreeDOS looks for `FDCONFIG.SYS` first in case you have a DOS system that is _dual booting_ FreeDOS with some other DOS, such as MS-DOS. Note that MS-DOS only uses the `CONFIG.SYS` file. So if you use the same hard drive to boot both FreeDOS and MS-DOS, MS-DOS uses `CONFIG.SYS` to configure itself, and FreeDOS uses `FDCONFIG.SYS` instead. That way, each can use its own configuration.
|
||||
|
||||
`FDCONFIG.SYS` can contain a number of configuration settings, one of which is `SHELL=` or `SHELLHIGH=`. Either one will instruct the kernel to load this program as the interactive shell for the user.
|
||||
|
||||
If neither `FDCONFIG.SYS` nor `CONFIG.SYS` exist, then the kernel assumes several default values, including where to find the shell. If you see the message "Bad or missing Command Interpreter" when you boot your FreeDOS system, that means `SHELL=` or `SHELLHIGH=` is pointing to a shell program that doesn't exist on your system.
|
||||
|
||||
![Bad or missing Command Interpreter][2]
|
||||
|
||||
Jim Hall, CC-BY SA 4.0
|
||||
|
||||
You might debug this by looking at the `SHELL=` or `SHELLHIGH=` lines. Failing that, make sure you have a program called `COMMAND.COM` in the root directory of your FreeDOS system. This is the _shell_, which I'll talk about next.
|
||||
|
||||
### The shell
|
||||
|
||||
The term "shell" on a DOS system usually means a command-line interpreter; an interactive program that reads instructions from the user, then executes them. In this way, the FreeDOS shell is similar to the Bash shell on Linux.
|
||||
|
||||
Unless you've asked the kernel to load a different shell using `SHELL=` or `SHELLHIGH=`, the standard command-line shell on DOS is called `COMMAND.COM`. And as `COMMAND.COM` starts up, it also looks for a file to configure itself. By default, `COMMAND.COM` will look for a file called `AUTOEXEC.BAT` in the root directory. `AUTOEXEC.BAT` is a "batch file" that contains a set of instructions that run at startup, and is roughly analogous to the `~/.bashrc` "resource file" that Bash reads when it starts up on Linux.
|
||||
|
||||
You can change the shell, and the startup file for the shell, in the `FDCONFIG.SYS` file, with `SHELL=` or `SHELLHIGH=`. The FreeDOS 1.3 RC4 installer sets up the system to read `FDAUTO.BAT` instead of `AUTOEXEC.BAT`. This is for the same reason that the kernel reads an alternate configuration file; you can dual-boot FreeDOS on a hard drive with another DOS. FreeDOS will use `FDAUTO.BAT` while MS-DOS will use `AUTOEXEC.BAT`..
|
||||
|
||||
Without a startup file like `AUTOEXEC.BAT`, the shell will simply prompt the user to enter the date and time.
|
||||
|
||||
![Without AUTOEXEC.BAT, the shell will prompt for date and time][3]
|
||||
|
||||
Jim Hall, CC-BY SA 4.0
|
||||
|
||||
And that's it. Once FreeDOS has loaded the kernel, and the kernel has loaded the shell, FreeDOS is ready for the user to type commands.
|
||||
|
||||
![FreeDOS is ready for you to enter your first command][4]
|
||||
|
||||
Jim Hall, CC-BY SA 4.0
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/6/freedos-boots
|
||||
|
||||
作者:[Jim Hall][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jim-hall
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_development_programming.png?itok=4OM29-82 (Code going into a computer.)
|
||||
[2]: https://opensource.com/sites/default/files/uploads/bad-missing-command.png (Bad or missing Command Interpreter)
|
||||
[3]: https://opensource.com/sites/default/files/uploads/no-autoexec.png (Without AUTOEXEC.BAT, the shell will prompt for date and time)
|
||||
[4]: https://opensource.com/sites/default/files/uploads/freedos-boot.png (FreeDOS is ready for you to enter your first command)
|
75
translated/tech/20210608 How FreeDOS boots.md
Normal file
75
translated/tech/20210608 How FreeDOS boots.md
Normal file
@ -0,0 +1,75 @@
|
||||
[#]: subject: (How FreeDOS boots)
|
||||
[#]: via: (https://opensource.com/article/21/6/freedos-boots)
|
||||
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
FreeDOS 如何启动
|
||||
======
|
||||
概述你的计算机如何启动和启动一个像 FreeDOS 的简单操作系统。
|
||||
![Code going into a computer.][1]
|
||||
|
||||
在使用 DOS 计算机的过程中,我很欣赏的一点是,启动过程相对容易理解。在 DOS 中没有太多的变动组件。而今天,我想和大家分享一下电脑是如何启动和启动像 FreeDOS 这样的简单操作系统的概况。
|
||||
|
||||
### 初始引导
|
||||
|
||||
当你打开计算机的电源时,系统会进行一些自我检查,如验证内存和其他组件。这被称为**开机自检** (Power On Self Test) 或 “POST”。POST 之后,计算机使用一个硬编码指令,告诉它在哪里找到加载操作系统的指令。这就是“引导加载程序”,通常它将试图找到硬盘上的主启动记录 (MBR)。然后,MBR 加载主操作系统。在这里就是 FreeDOS。
|
||||
|
||||
这个定位一个信息以便计算机能够加载操作系统的下一个部分的过程被称为“引导” (bootstrapping),来自于“通过引导程序启动自己”的古老说法。正是从这个用法中,我们采用了“启动” (boot) 一词来表示启动你的计算机。
|
||||
|
||||
### 内核
|
||||
|
||||
当计算机加载 FreeDOS 内核时,内核所做的第一件事就是识别用户所表示要使用的任何参数。它被保存在一个叫做 `FDCONFIG.SYS` 的文件中,与内核保存在同一个根目录下。如果 `FDCONFIG.SYS` 不存在,那么 FreeDOS 的内核就会寻找一个叫做 `CONFIG.SYS` 的替代文件。
|
||||
|
||||
如果你在 20 世纪 80 年代或 90 年代使用过 DOS,你可能对 `CONFIG.SYS` 文件很熟悉。从 1999 年起,FreeDOS 首先寻找 `FDCONFIG.SYS`,以防你的 DOS 系统与其他 DOS(如 MS-DOS)有_双启动_。请注意,MS-DOS 只使用 `CONFIG.SYS` 文件。因此,如果你用同一个硬盘同时启动 FreeDOS 和 MS-DOS,MS-DOS 使用 `CONFIG.SYS` 来配置自己,而 FreeDOS 则使用 `FDCONFIG.SYS`。这样一来,双方都可以使用自己的配置。
|
||||
|
||||
`FDCONFIG.SYS` 可以包含一些配置设置,其中之一是 `SHELL=` 或 `SHELLHIGH=`。任何一个都会指示内核加载这个程序作为用户的交互式 shell。
|
||||
|
||||
如果 `FDCONFIG.SYS` 和 `CONFIG.SYS` 都不存在,那么内核就会假定几个默认值,包括在哪里找到 shell。如果你在启动 FreeDOS 系统时看到 “Bad or missing Command Interpreter” 的信息,这意味着 `SHELL=` 或 `SHELLHIGH=` 指向了一个在你系统中不存在的 shell 程序。
|
||||
|
||||
![Bad or missing Command Interpreter][2]
|
||||
|
||||
Jim Hall,CC-BY SA 4.0
|
||||
|
||||
你可以通过查看 `SHELL=` 或 `SHELLHIGH=` 行来调试这个问题。如果做不到这一点,请确保你在 FreeDOS 系统的根目录下有一个名为 `COMMAND.COM` 的程序。它就是 _shell_,我接下来会讲到它。
|
||||
|
||||
### shell
|
||||
|
||||
在 DOS 系统中,“shell” 一词通常是指一个命令行解释器:一个交互式程序,它从用户那里读取指令,然后执行它们。在这里,FreeDOS 的 shell 与 Linux 的 Bash shell 相似。
|
||||
|
||||
除非你用 `SHELL=` 或 `SHELLHIGH=` 要求内核加载一个不同的 shell,否则 DOS 上的标准命令行 shell 被称为 `COMMAND.COM`。当 `COMMAND.COM`启动时,它也寻找一个文件来配置自己。默认情况下,`COMMAND.COM` 会在根目录下寻找一个名为 `AUTOEXEC.BAT` 的文件。`AUTOEXEC.BAT` 是一个“批处理文件”,它包含一组启动时运行的指令,大致类似于 Linux 上 Bash 启动时读取的 `~/.bashrc` “资源文件”。
|
||||
|
||||
你可以在 `FDCONFIG.SYS` 文件中用 `SHELL=` 或 `SHELLHIGH=` 改变 shell 以及 shell 的启动文件。FreeDOS 1.3 RC4 安装程序将系统设置为读取 `FDAUTO.BAT` 而不是 `AUTOEXEC.BAT`。这与内核读取另一个配置文件的原因相同;你可以在硬盘上用另一个 DOS 双启动 FreeDOS。FreeDOS 将使用 `FDAUTO.BAT` 而 MS-DOS 将使用 `AUTOEXEC.BAT`。
|
||||
|
||||
如果没有像 `AUTOEXEC.BAT` 这样的启动文件,shell 将简单地提示用户输入日期和时间。
|
||||
|
||||
![Without AUTOEXEC.BAT, the shell will prompt for date and time][3]
|
||||
|
||||
Jim Hall, CC-BY SA 4.0
|
||||
|
||||
就是这些了。当 FreeDOS 加载了内核,而内核也加载了 shell,FreeDOS 就准备好让用户输入命令了。
|
||||
|
||||
![FreeDOS is ready for you to enter your first command][4]
|
||||
|
||||
Jim Hall, CC-BY SA 4.0
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/6/freedos-boots
|
||||
|
||||
作者:[Jim Hall][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jim-hall
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_development_programming.png?itok=4OM29-82 (Code going into a computer.)
|
||||
[2]: https://opensource.com/sites/default/files/uploads/bad-missing-command.png (Bad or missing Command Interpreter)
|
||||
[3]: https://opensource.com/sites/default/files/uploads/no-autoexec.png (Without AUTOEXEC.BAT, the shell will prompt for date and time)
|
||||
[4]: https://opensource.com/sites/default/files/uploads/freedos-boot.png (FreeDOS is ready for you to enter your first command)
|
Loading…
Reference in New Issue
Block a user