who run main() of linux?












0















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?










share|improve this question



























    0















    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?










    share|improve this question

























      0












      0








      0








      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?










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      MarkMark

      886




      886






















          2 Answers
          2






          active

          oldest

          votes


















          1














          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.






          share|improve this answer































            0














            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.






            share|improve this answer























              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
              });


              }
              });














              draft saved

              draft discarded


















              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









              1














              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.






              share|improve this answer




























                1














                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.






                share|improve this answer


























                  1












                  1








                  1







                  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.






                  share|improve this answer













                  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.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 58 mins ago









                  Stephen HarrisStephen Harris

                  26.5k34980




                  26.5k34980

























                      0














                      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.






                      share|improve this answer




























                        0














                        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.






                        share|improve this answer


























                          0












                          0








                          0







                          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.






                          share|improve this answer













                          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.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 52 mins ago









                          tripleeetripleee

                          5,28311930




                          5,28311930






























                              draft saved

                              draft discarded




















































                              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.




                              draft saved


                              draft discarded














                              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





















































                              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







                              Popular posts from this blog

                              宮崎県

                              濃尾地震

                              シテ島