Booting from CD

This is a discussion on Booting from CD within the Tech Board forums, part of the Community Boards category; Hi everyone. As yet another attempt to learn even more, i tackled OS creation tutorials! I read that there is ...

  1. #1
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,624

    Booting from CD

    Hi everyone. As yet another attempt to learn even more, i tackled OS creation tutorials! I read that there is a certain byte sequence that the BIOS will read from a hard, floppy or compact disk in order to load it onto memory and execute it. I made the same sequence in a binary file. The problem is that the tutorials use a program called partcopy to copy! data onto a floppy disk. The problem is that i don't have a floppy disk driver on my laptop! I tried doing the same from a CD, but it doesn't boot probably because a file system is created along with the file. So my question is:
    Is there a way to write raw data on a CD? If yes, what's that?
    Devoted my life to programming...

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,505
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    You might also want to consider booting from a flash drive, if your BIOS supports it.
    Consider this post signed

  4. #4
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    1. Grab an emulator. Bochs for Windows, and Qemu for Linux are the most common(Although they both work on both platforms.).

    2. Go to an OS development related forum and wiki. osdev.org is a good one.

    3. Are you sure that your code is bootable? Is it in asm? If not, it should be. The boot sector is one of the things that actually is best done by hand.

  5. #5
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,624
    Thanks for the links, Salem.

    "User Name":
    1) Thanks for pointing that out, i had a hard time rebooting again and again!
    2) Actually, there's where i started from.
    3) Yes, my code is pure assembly. I'm using FASM for this.

    "bernt":
    Are there any tutorials about it? Because i feel i'm gonna stuck on the same problem.
    Devoted my life to programming...

  6. #6
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    Heck yeah! Fasm's awesome!

    Here's a little template:
    Code:
    format binary as 'img'
    use16
    org 0x7c00
       
       ; Set up segments
       mov ax, 0
       mov ds, ax
       mov es, ax
       mov fs, ax
       mov gs, ax
       
       ; Set up stack
       mov ss, ax
       mov esp, 0x7c00
    
       ; Boot code
    
       rb 510-($-$$) ; Align to 510
       db 055h,0AAh ; Boot signature
    Assemble this, ans set it as the boot floppy in Bochs, and boot it. You'll need to print something to be able to tell whether it worked or not, but I'll leave that for you to figure out.

    There's hundreds if not more simple boot loaders in Fasm's OSdev section. Here's a particularly good one: flat assembler - View topic - Case Study: FAT12 bootloader

    But I'm gonna be honest, you'll not learn very much that is relevant to modern osdev from simple boot loader dev. All the interrupts you learn will instantly become useless when you set the p-mode bit in cr0. I would suggest following a grub based "hello world" kernel tutorial. Maybe this one: Fasm-TCC BareBones - OSDev Wiki. To use GCC with it, just replace t with g, the args are the same.

  7. #7
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    Are there any tutorials about it? Because i feel i'm gonna stuck on the same problem.
    Well, it shouldn't be too much trouble to install grub on a flash drive, and then making your kernel bootable with grub. But Bochs is also very nice (I assumed you already knew about that ) because you don't run the risk of trashing your computer.
    Consider this post signed

  8. #8
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,624
    Thanks, guys! I think i have enough information to go on!
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Back To The Basics: Freeing An Array on the Heap?
    By Deo in forum C++ Programming
    Replies: 12
    Last Post: 04-07-2007, 04:42 AM
  2. HUGE fps jump
    By DavidP in forum Game Programming
    Replies: 23
    Last Post: 07-01-2004, 10:36 AM
  3. Pointer's
    By xlordt in forum C Programming
    Replies: 13
    Last Post: 10-14-2003, 02:15 PM
  4. Nero CD recording take long time
    By Eagle16 in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 11-15-2002, 04:49 PM
  5. How to encrypt a CD perfectly?
    By Yin in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 03-13-2002, 08:02 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21