1

If there is a computer without operating system, then we can install one on it using a floppy disc or usb stick. While the computer is booting, we push F11 or some other button, then the computer will boot from the usb stick and run the system installing program. Now my question is that: How to write a program into the usb stick such that if we press the F11 button, the screen will print "Hello World!" or show some pictures.

How to realize such an program using C and assembly language? How to write such program into a usb stick?

Thaks

closed as off-topic by Gilles, derobert, jimmij, John WH Smith, jordanm Feb 2 '15 at 22:35

  • This question does not appear to be about Unix or Linux within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    floppy disc? How old is this computer? – devnull Feb 2 '15 at 14:44
  • Have you looked at [this thread][1]? [1]: stackoverflow.com/a/22054750/1195751 – devnull Feb 2 '15 at 14:47
  • @DevNull Thanks, that's exactly what i want – Grub Feb 2 '15 at 14:52
  • 1
    Ironically grub is an example of such a program. – wurtel Feb 2 '15 at 14:54
  • 3
    I'm voting to close this question as off-topic because it doesn't really have anything to do with Unix or Linux. – derobert Feb 2 '15 at 22:26
0

As I mentioned in the comments, here is a thread that talks bare metal programming.

General answer to the question: it can be done. It's often reffered to as "bare metal programming". To read from flash drive, you want to know what's USB, and you want to have some driver to work with this USB. The program on this drive would also have to be in some particular format. On some particular filesystem... This is something that usually boot loaders do. Many ARM boards let you do some of those things. Some have boot loader to help you with basic setup.

Here is another article with examples: http://www.valvers.com/open-software/raspberry-pi/step02-bare-metal-programming-in-c-pt2/

Not the answer you're looking for? Browse other questions tagged or ask your own question.