who run main() of linux?
In Linux 0.11, we can see there is a main.c with a main()
In my understanding, the object code needs an OS to run it.
I mean, since Linux 0.11 is an OS, who is in front of it to run it? DOS?
linux kernel drivers
add a comment |
In Linux 0.11, we can see there is a main.c with a main()
In my understanding, the object code needs an OS to run it.
I mean, since Linux 0.11 is an OS, who is in front of it to run it? DOS?
linux kernel drivers
add a comment |
In Linux 0.11, we can see there is a main.c with a main()
In my understanding, the object code needs an OS to run it.
I mean, since Linux 0.11 is an OS, who is in front of it to run it? DOS?
linux kernel drivers
In Linux 0.11, we can see there is a main.c with a main()
In my understanding, the object code needs an OS to run it.
I mean, since Linux 0.11 is an OS, who is in front of it to run it? DOS?
linux kernel drivers
linux kernel drivers
asked 1 hour ago
MarkMark
886
886
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
The Linux kernel, especially in the 0.11 days, was loaded directly by the hardware BIOS.
Basically the BIOS looks at the boot sector (of a floppy) or the Master Boot Record of a hard disk, and loads that sector. With a hard disk the MBR then loads the "primary partition" boot sector.
This loaded boot sector has enough information to know about how to load the kernel into memory, and then run it.
With the old old 0.11 disks it was effectively a floppy boot solution, with the kernel on one disk and root on another disk, so the boot system was very very simple.
When Linux handled hard disks the boot process was still very simple. It was so simple that it became possible to create tools such as "loadlin" which was a simple DOS program that would load the Linux kernel and boot into it, emulating the BIOS loader. In this way a DOS config.sys menu could be created to boot DOS or Linux; an early form of dual booting.
But at it's heart, the Linux kernel is loaded from "bare metal" and takes over the machine.
add a comment |
The main function is a feature of the C language. How exactly it gets converted into a computer instruction for the CPU to "start here" is basically a compiler implementation detail. On bare metal, you can often simply rely on the hardware to start execution at a particular memory address when it first boots. Early versions of Linux depended on a. simple x86 boot loader; today, that role is typically handled by Grub. That behavior, in turn, depends on BIOS firmware conventions, But really, at every level, you have a piece of computer architecture with a convention for how to start a program.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507080%2fwho-run-main-of-linux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The Linux kernel, especially in the 0.11 days, was loaded directly by the hardware BIOS.
Basically the BIOS looks at the boot sector (of a floppy) or the Master Boot Record of a hard disk, and loads that sector. With a hard disk the MBR then loads the "primary partition" boot sector.
This loaded boot sector has enough information to know about how to load the kernel into memory, and then run it.
With the old old 0.11 disks it was effectively a floppy boot solution, with the kernel on one disk and root on another disk, so the boot system was very very simple.
When Linux handled hard disks the boot process was still very simple. It was so simple that it became possible to create tools such as "loadlin" which was a simple DOS program that would load the Linux kernel and boot into it, emulating the BIOS loader. In this way a DOS config.sys menu could be created to boot DOS or Linux; an early form of dual booting.
But at it's heart, the Linux kernel is loaded from "bare metal" and takes over the machine.
add a comment |
The Linux kernel, especially in the 0.11 days, was loaded directly by the hardware BIOS.
Basically the BIOS looks at the boot sector (of a floppy) or the Master Boot Record of a hard disk, and loads that sector. With a hard disk the MBR then loads the "primary partition" boot sector.
This loaded boot sector has enough information to know about how to load the kernel into memory, and then run it.
With the old old 0.11 disks it was effectively a floppy boot solution, with the kernel on one disk and root on another disk, so the boot system was very very simple.
When Linux handled hard disks the boot process was still very simple. It was so simple that it became possible to create tools such as "loadlin" which was a simple DOS program that would load the Linux kernel and boot into it, emulating the BIOS loader. In this way a DOS config.sys menu could be created to boot DOS or Linux; an early form of dual booting.
But at it's heart, the Linux kernel is loaded from "bare metal" and takes over the machine.
add a comment |
The Linux kernel, especially in the 0.11 days, was loaded directly by the hardware BIOS.
Basically the BIOS looks at the boot sector (of a floppy) or the Master Boot Record of a hard disk, and loads that sector. With a hard disk the MBR then loads the "primary partition" boot sector.
This loaded boot sector has enough information to know about how to load the kernel into memory, and then run it.
With the old old 0.11 disks it was effectively a floppy boot solution, with the kernel on one disk and root on another disk, so the boot system was very very simple.
When Linux handled hard disks the boot process was still very simple. It was so simple that it became possible to create tools such as "loadlin" which was a simple DOS program that would load the Linux kernel and boot into it, emulating the BIOS loader. In this way a DOS config.sys menu could be created to boot DOS or Linux; an early form of dual booting.
But at it's heart, the Linux kernel is loaded from "bare metal" and takes over the machine.
The Linux kernel, especially in the 0.11 days, was loaded directly by the hardware BIOS.
Basically the BIOS looks at the boot sector (of a floppy) or the Master Boot Record of a hard disk, and loads that sector. With a hard disk the MBR then loads the "primary partition" boot sector.
This loaded boot sector has enough information to know about how to load the kernel into memory, and then run it.
With the old old 0.11 disks it was effectively a floppy boot solution, with the kernel on one disk and root on another disk, so the boot system was very very simple.
When Linux handled hard disks the boot process was still very simple. It was so simple that it became possible to create tools such as "loadlin" which was a simple DOS program that would load the Linux kernel and boot into it, emulating the BIOS loader. In this way a DOS config.sys menu could be created to boot DOS or Linux; an early form of dual booting.
But at it's heart, the Linux kernel is loaded from "bare metal" and takes over the machine.
answered 58 mins ago
Stephen HarrisStephen Harris
26.5k34980
26.5k34980
add a comment |
add a comment |
The main function is a feature of the C language. How exactly it gets converted into a computer instruction for the CPU to "start here" is basically a compiler implementation detail. On bare metal, you can often simply rely on the hardware to start execution at a particular memory address when it first boots. Early versions of Linux depended on a. simple x86 boot loader; today, that role is typically handled by Grub. That behavior, in turn, depends on BIOS firmware conventions, But really, at every level, you have a piece of computer architecture with a convention for how to start a program.
add a comment |
The main function is a feature of the C language. How exactly it gets converted into a computer instruction for the CPU to "start here" is basically a compiler implementation detail. On bare metal, you can often simply rely on the hardware to start execution at a particular memory address when it first boots. Early versions of Linux depended on a. simple x86 boot loader; today, that role is typically handled by Grub. That behavior, in turn, depends on BIOS firmware conventions, But really, at every level, you have a piece of computer architecture with a convention for how to start a program.
add a comment |
The main function is a feature of the C language. How exactly it gets converted into a computer instruction for the CPU to "start here" is basically a compiler implementation detail. On bare metal, you can often simply rely on the hardware to start execution at a particular memory address when it first boots. Early versions of Linux depended on a. simple x86 boot loader; today, that role is typically handled by Grub. That behavior, in turn, depends on BIOS firmware conventions, But really, at every level, you have a piece of computer architecture with a convention for how to start a program.
The main function is a feature of the C language. How exactly it gets converted into a computer instruction for the CPU to "start here" is basically a compiler implementation detail. On bare metal, you can often simply rely on the hardware to start execution at a particular memory address when it first boots. Early versions of Linux depended on a. simple x86 boot loader; today, that role is typically handled by Grub. That behavior, in turn, depends on BIOS firmware conventions, But really, at every level, you have a piece of computer architecture with a convention for how to start a program.
answered 52 mins ago
tripleeetripleee
5,28311930
5,28311930
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507080%2fwho-run-main-of-linux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown