Open akkartik opened 10 years ago
No it's not, it's the offset of the first partition: https://github.com/SamyPesse/How-to-Make-a-Computer-Operating-System/blob/master/Chapter-3/README.md#create-a-disk-image-for-our-kernel-and-grub
Thanks. But I'm still confused: why isn't the offset 0? Why do we have to use the computation in your link?
I also am trying to go over the computation at your link. Locally, the output of fdisk -l -u c.img
:
Disk sdk/c.img: 2 MB, 2097152 bytes
1 heads, 5 sectors/track, 819 cylinders, total 4096 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9cbdff7d
Device Boot Start End Blocks Id System
sdk/c.img1 * 1 4 2 83 Linux
On the VM:
You must set cylinders.
You can do this from the extra functions menu.
Disk c.img: 0 MB, 0 bytes
1 heads, 5 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9cbdff7d
Device Boot Start End Blocks Id System
c.img1 * 1 4 2 83 Linux
I see where these show the size of each sector, but not where the 63 comes from. From http://en.wikipedia.org/wiki/Cylinder-head-sector#Sectors I learn that PCs usually have 63 sectors per track. Is that it?
Did you change the disk geometry for your c.img1? or do you use the same geometry of c.img?
The offset is not 0 because the partition starts after some boot sectors.
I didn't mean to change the geometry, I think I used the same geometry. And oddly enough the one with the 'must set cylinders' message is what shows hello correctly.
Hum, in vagrant I have:
vagrant@lucid32:/vagrant/sdk$ fdisk -l -u c.img
You must set cylinders.
You can do this from the extra functions menu.
Disk c.img: 0 MB, 0 bytes
16 heads, 63 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe8c36f7f
Device Boot Start End Blocks Id System
c.img1 * 63 4031 1984+ 83 Linux
Locally what os are you using? do you have the same thing with vagrant?
Host OS: Ubuntu 12.04.1 Vagrant OS: Ubuntu 10.04.4
Hmm, I installed vagrant from apt-get. Is this a problem?
I have different results in Vagrant from when running on bare metal.
I have got the same message
16 heads, 63 sectors/track, 0 cylinders, total 0 sectors Units = sectors of 1 * 512 = 512 bytes
but why 0 cylinders?
just something from fdisk:
the -u option, should receive the format wanted. The default is set if just "-u" is given. The default is different in different OS or Linux flavors. To avoid it you should use:
/sbin/fdisk -u=cylinder ...
Is it to make room for the grub MBR?