Bluehost.com Web Hosting $6.95

Question about MBR

This is a discussion on Question about MBR within the Linux General forums, part of the Linux Forums category; Ok, here is the challenge: -I want to write a set of simple assembly instructions to the MBR, or first ...


Go Back   Usenet Forums > Linux Forums > Linux General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-22-2003
Josh Beck
 
Posts: n/a
Default Question about MBR


Ok, here is the challenge:
-I want to write a set of simple assembly instructions to
the MBR, or first sector, of either a cdrom or floppy disk.

-How can I specify what sector to write to?

Thanks
Josh Beck


--


Reply With Quote
  #2 (permalink)  
Old 11-22-2003
P.T. Breuer
 
Posts: n/a
Default Re: Question about MBR

Josh Beck <Webmaster@freewebspace.planetdns.net> wrote:

> -I want to write a set of simple assembly instructions to
> the MBR, or first sector, of either a cdrom or floppy disk.


> -How can I specify what sector to write to?


Clue: it's the zeroth.

For a cdrom you don't get direct access like that. A floppy is no
trouble.

For cds you have to read your cd writer app's docs to see how to write
the boot track. It should be a separate (floppy) image.

Peter
Reply With Quote
  #3 (permalink)  
Old 11-24-2003
Leon.
 
Posts: n/a
Default Re: Question about MBR


"Josh Beck" <Webmaster@freewebspace.planetdns.net> wrote in message
news:Pine.LNX.4.44.0311212229170.31808-100000@localhost.localdomain...
>
> Ok, here is the challenge:
> -I want to write a set of simple assembly instructions to
> the MBR, or first sector, of either a cdrom or floppy disk.
>
> -How can I specify what sector to write to?


On a floppy , is it the first sector, or just the first part of the first
sector ?


given a floppy disk, you can read the sector like this

dd if=/dev/fd0 of=bootsector count=1

having modified the parts you want to modify, you can write it back

dd if=bootsector of =/dev/fd0 count=1


Having made your floppy, you then use that as the boot image on the cdrom,
the ISO image creation software then makes the cd bootable using the image
of the floppy - technically, the computer bios understands enough of the
cdrom command and ISO image to be able to find and read the floppy image.
This virtual floppy then has to be bootable and contain an OS ...








>
> Thanks
> Josh Beck
>
>
> --
>
>



Reply With Quote
  #4 (permalink)  
Old 11-24-2003
Shmuel (Seymour J.) Metz
 
Posts: n/a
Default Re: Question about MBR

In <Pine.LNX.4.44.0311212229170.31808-100000@localhost.localdomain>,
on 11/22/2003
at 04:31 AM, Josh Beck <Webmaster@freewebspace.planetdns.net> said:

> -I want to write a set of simple assembly instructions to
> the MBR, or first sector, of either a cdrom or floppy disk.


You can't. You need to write machine code. That means that you will
either need to read the output from the assembler or hand assemble
your code.

--
Shmuel (Seymour J.) Metz, SysProg and JOAT

Unsolicited bulk E-mail will be subject to legal action. I reserve
the right to publicly post or ridicule any abusive E-mail.

Reply to domain Patriot dot net user shmuel+news to contact me. Do
not reply to spamtrap@library.lspace.org

Reply With Quote
  #5 (permalink)  
Old 11-24-2003
Homer Welch
 
Posts: n/a
Default Re: Question about MBR

Josh Beck wrote:
> Ok, here is the challenge:
> -I want to write a set of simple assembly instructions to
> the MBR, or first sector, of either a cdrom or floppy disk.
>
> -How can I specify what sector to write to?
>


I suggest that you look at the source files of lilo. It
writes to the MBR.

Good luck,


Reply With Quote
  #6 (permalink)  
Old 11-25-2003
Dave Brown
 
Posts: n/a
Default Re: Question about MBR

In article <3fc15330$1@news.rivernet.com.au>, Leon. wrote:
>
> "Josh Beck" <Webmaster@freewebspace.planetdns.net> wrote in message
> news:Pine.LNX.4.44.0311212229170.31808-100000@localhost.localdomain...
>>
>> Ok, here is the challenge:
>> -I want to write a set of simple assembly instructions to
>> the MBR, or first sector, of either a cdrom or floppy disk.
>>
>> -How can I specify what sector to write to?

>
> On a floppy , is it the first sector, or just the first part of the first
> sector ?
>
>
> given a floppy disk, you can read the sector like this
>
> dd if=/dev/fd0 of=bootsector count=1
>
> having modified the parts you want to modify, you can write it back
>
> dd if=bootsector of =/dev/fd0 count=1
>
>
> Having made your floppy, you then use that as the boot image on the cdrom,
> the ISO image creation software then makes the cd bootable using the image
> of the floppy - technically, the computer bios understands enough of the
> cdrom command and ISO image to be able to find and read the floppy image.
> This virtual floppy then has to be bootable and contain an OS ...


Actually, a floppy doesn't have a "master boot record". When BIOS
goes to the floppy for booting, it loads a binary image from sector 0
and subsequent as long as it can (probably up to a series of 0x00s),
and then passes control to it. Which is why you can 'dd' a kernel image
to a floppy and boot it (as long as it's smaller than 1 MB. When BIOS
goes to a CDROM, it seeks to sector 19(?) and then reads a bootdiskette
image, just like it was reading a diskette.

--
Dave Brown Austin, TX
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:56 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0