OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Mar 19, 2024 12:33 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: load & execute next sector after bootsector
PostPosted: Tue Apr 19, 2016 9:07 am 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
bilsch01 wrote:
The command lines for writing them to disk are:

dd if=/mnt/sda5/home/bilsch/jinx/bootn1.bin count=1 of=/dev/sda1 count=1
dd if=/mnt/sda5/home/bilsch/jinx/kern1.bin count=1 of=/dev/sda1 seek=1 count=1
If you're using "count=1", you need to specify a block size and make sure that the files are smaller than the block size otherwise they will be truncated.

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: load & execute next sector after bootsector
PostPosted: Tue Apr 19, 2016 11:48 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
dd uses a default block size of 512 bytes.


Top
 Profile  
 
 Post subject: Re: load & execute next sector after bootsector
PostPosted: Tue Apr 19, 2016 4:57 pm 
Offline
Member
Member

Joined: Sat Dec 19, 2015 10:48 am
Posts: 42
Quote:
Have you confirmed that /dev/sda1 starts at LBA 1 and not somewhere else?
[/quote]Hint: it probably doesn't.[/quote]

Yes. I corrected that. Sector to load is lba 64 not lba 2. I have the program running correctly now - Success. Onwards to writing a real bootsector and a format program. I,m going to model it on MSDOS. Thanks for your help. Bill S.


Last edited by bilsch01 on Tue Apr 19, 2016 5:08 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: load & execute next sector after bootsector
PostPosted: Tue Apr 19, 2016 5:02 pm 
Offline
Member
Member

Joined: Sat Dec 19, 2015 10:48 am
Posts: 42
onlyonemac wrote:
bilsch01 wrote:
The command lines for writing them to disk are:

dd if=/mnt/sda5/home/bilsch/jinx/bootn1.bin count=1 of=/dev/sda1 count=1
dd if=/mnt/sda5/home/bilsch/jinx/kern1.bin count=1 of=/dev/sda1 seek=1 count=1
If you're using "count=1", you need to specify a block size and make sure that the files are smaller than the block size otherwise they will be truncated.


Both files are 512 bytes. Default bs is 512.


Top
 Profile  
 
 Post subject: Re: load & execute next sector after bootsector
PostPosted: Tue Apr 19, 2016 11:56 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
bilsch01 wrote:
I corrected that. Sector to load is lba 64 not lba 2. I have the program running correctly now - Success. Onwards to writing a real bootsector and a format program.

You really shouldn't hard code this value. Read the partition table to find where the partition starts.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group