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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
"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 > > > -- > > |
|
|||
|
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 |
|
|||
|
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, |
|
|||
|
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 |