Home arrow Forums
OSDEV Forums  


anonymous
Visitor

Fresh Osdever
Posts: 0
graphgraph
Karma: 0  
bootable cd - 2006/01/31 18:16 I wrote a boot sector and have encounter trouble creating a boot disk. How do i create a bootable image file, or write my 512 byte boot sector to a disk (win xp cannot run partcopy). Also, where is there some info on loading your kernel?

thanks a lot.
  | | The administrator has disabled public write access.
OSDEV
Community
Advertisement
   
gaf
User

Platinum Osdever
Posts: 153
graph
Karma: 10  
Re: bootable cd - 2006/02/01 08:37 Hello,
is there any specific reason why want to use a boot-CD rather than an ordinary floppy ? As virtually all tutorials that can be found on the internet assume that your kernel is stored on a floppy formated with a FAT12 file-system, writing a CD loader will require a lot of research and work..

Also, where is there some info on loading your kernel?
You should find that information in the wiki.

regards,
gaf
  | | The administrator has disabled public write access.
anonymous
Visitor

Fresh Osdever
Posts: 0
graphgraph
Karma: 0  
Re: bootable cd - 2006/02/01 14:50 are floppys fat12 by default, and i have read something about not overwriting the dos mrb?
  | | The administrator has disabled public write access.
anonymous
Visitor

Fresh Osdever
Posts: 0
graphgraph
Karma: 0  
Re: bootable cd - 2006/02/01 14:53 also... can you load the kernel in protected mode, or do you have to do it in real mode, and jump to it after you have entered protected mode.

thanks (sorry about all the questions, im new)
  | | The administrator has disabled public write access.
gaf
User

Platinum Osdever
Posts: 153
graph
Karma: 10  
Re: bootable cd - 2006/02/02 10:32 are floppys fat12 by default
Most floppies are already formated as FAT12, but it's nevertheless a good idea to rebuild the file-system in order to avoid problems with bad sectors. In Linux you can do so by either using the graphical utilities gfloppy/kfloppy or the command-line tool mkdosfs - on windows you'd simply right-click the floppy symbol and choose "format".

I have read something about not overwriting the dos mrb
The MBR contains bootcode that is needed to load the kernel and, at least on larger disks, a partition-table. Overwriting your hard-disk's mbr would thus indeed lead to some problems as the operating-system couldn't boot any longer and accessing the partitions would be impossible. To get you own operating system started, you however have to overwrite the bootsector of a floppy with your boot-code which will then be executed by the BIOS at system start-up (boot sequence).

To copy your bootsector to a floppy you can use dd:

linux:
- Open a console window
- Type "dd if=your_bootsector of=/dev/fd0 bs=512 count=1"

windows:
- Download this port of the dd utility and unzip it to your desktop
- Click "Start/Run" and type "command", press enter
- Type "cd Desktop" and "dd if=c:\\your_bootsector of=\\.\\a: bs=512 count=1"

Can you load the kernel in protected mode, or do you have to do it in real mode, and jump to it after you have entered protected mode

Loading the kernel from pmode unfortunately won't work as you can't use the BIOS interrupts that way, which are however needed to get the kernel off the disk. Most people therefore either use the so called unreal-mode (access to 4gb of memory, real-mode addressing) or load the kernel in real-mode and switch to pmode later on.

Just as a sidenode: I personally have some doubt whether writing an own bootsector/bootloader is really such a great idea, especially if you're new to operating system development. You do know that there are freely avaliable loaders such as grub that may load the kernel for you ?

regards,
gaf
  | | The administrator has disabled public write access.
DRF
User

Platinum Osdever
Posts: 123
graphgraph
Karma: 1  
Re: bootable cd - 2006/02/06 18:48 The Architect: Is this your first attempt at making an OS? If so you really want to avoid trying to make a liveCD OS. It's standard practice to make a OS that runs of a floppy disk for your first go then work on getting it to install to a hard drive/CD/etc. or just starting afresh but with the knowledge from the previous OS development.

You can write using DOS's debuger as well.
The procedure i've used is:

c:\\bootloader\\compiled> debug bootloader

- w 100 0 0 1

- q

But if you enter a question mark (- ?) and press return at the debugger's prompt it will tell you how to use it. (replace bootloader with your compiled bootloader file name)

However using the rawrite software that gaf pointed you towards might be easier for you. (I don't use windows so not sure how well it works, but I used to use this method a while back)

Like gaf I think it's often best to use an existing bootloader, or at least work on a bootloader as a break from your kernel coding. I quite like bootloaders but I (not recently as been busy) did about 1 week on my bootloader to every 2 weeks on my kernel.
However bootloaders tend to all be very similar so it would just be for learning about bootloaders.

Daniel
  | | The administrator has disabled public write access.
grasper
User

Junior Osdever
Posts: 11
graphgraph
Karma: 1  
Re: bootable cd - 2006/04/11 07:09 There is some docs in http://bos.asmhackers.net/docs
  | | The administrator has disabled public write access.

A WebArticles site. Sponsored by Evoleto. Motorola V525 / Business Directory / Delaware Incorporation / Home Made Bazaar