Page 2 of 2
Re: load & execute next sector after bootsector
Posted: Tue Apr 19, 2016 9:07 am
by onlyonemac
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.
Re: load & execute next sector after bootsector
Posted: Tue Apr 19, 2016 11:48 am
by iansjack
dd uses a default block size of 512 bytes.
Re: load & execute next sector after bootsector
Posted: Tue Apr 19, 2016 4:57 pm
by bilsch01
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.
Re: load & execute next sector after bootsector
Posted: Tue Apr 19, 2016 5:02 pm
by bilsch01
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.
Re: load & execute next sector after bootsector
Posted: Tue Apr 19, 2016 11:56 pm
by iansjack
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.