Writing Kernel to hard drive

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
djtrickdog
Member
Member
Posts: 39
Joined: Sat Dec 15, 2007 7:36 pm

Writing Kernel to hard drive

Post by djtrickdog »

Hello I am developing a OS and i am using MikeOS as my loose base. I want to write MikeOS on my hard drive but i have Windows XP on it already and wish to Still keep it on it :/ . I am using Gag boot loader and have about 40 unpartitioned space on my hd. What do i need to write MikeOS or any kernel to my hard drive? Thanks for the Help guys.
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post by Pyrofan1 »

create a new partition and put it on there.
User avatar
djtrickdog
Member
Member
Posts: 39
Joined: Sat Dec 15, 2007 7:36 pm

Post by djtrickdog »

Pyrofan1 wrote:create a new partition and put it on there.
ok thanks for the useless reply. Anyone else? I am well aware i need to create a "partition" and put it on there, i just dont know how.
User avatar
Jef
Member
Member
Posts: 112
Joined: Tue Jan 08, 2008 7:25 am
Location: Greece
Contact:

Post by Jef »

djtrickdog wrote:
Pyrofan1 wrote:create a new partition and put it on there.
ok thanks for the useless reply. Anyone else? I am well aware i need to create a "partition" and put it on there, i just dont know how.
you don't know how to create a partition (?) or you don't know how to put it there your kernel?
Keep coding...
...the sky is the limit

AsteriOS project: http://www.mindfields.gr/main/index.php ... &Itemid=27
User avatar
djtrickdog
Member
Member
Posts: 39
Joined: Sat Dec 15, 2007 7:36 pm

Post by djtrickdog »

not with xp no (linux, yus, have no linux right now). and writing kernel with it, no
User avatar
binutils
Member
Member
Posts: 214
Joined: Thu Apr 05, 2007 6:07 am

Post by binutils »

http://gparted.sourceforge.net/

HTH

--
PS: too bad, winxp first before linux, plan9 etc..
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

1) $linux_distro liveCD.
2) right click my computer -> manage -> drives ... I think you can double click some free space there and make a new partition
3) cygwin -> dd / fdisk

* NOTE if you are resizing an NTFS partition don't forget to pray first...
User avatar
mathematician
Member
Member
Posts: 437
Joined: Fri Dec 15, 2006 5:26 pm
Location: Church Stretton Uk

Post by mathematician »

It your BIOS gives you the option of booting up from a hard drive other than the master on the primary IDE channel you could go to Ebay, buy a cheapo 40GB drive for £15 or so, and use that exclusively for OS testing.
User avatar
djtrickdog
Member
Member
Posts: 39
Joined: Sat Dec 15, 2007 7:36 pm

Post by djtrickdog »

So the only way is linux? :? dang windows
ok i have ubuntu live cd i could just use that. thanks for help
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Post by bewing »

I know that XP has some utility for creating a partition. Isn't FDISK around anymore on XP? As for writing to it -- it depends on if one of your onboard OSes recognizes the filesystem format. If you format the new partition as FAT32, then you just drag and drop like normal from XP. The trick would be to put a new MBR onto the disk to dual boot your kernel on your new partition.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Now what you want to do, depends on the OS, can it be loaded from a hdd, what file sys does it use etc.
I would think your best bet is to make a Dos partion, with dos on, once you have your PC setup to boot multi-OS including Dos, you can go about code or get a program to install "MikeOS" and replace dos.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

djtrickdog wrote:So the only way is linux? :? dang windows
ok i have ubuntu live cd i could just use that. thanks for help
Bah! Read my post!
JamesM wrote:2) right click my computer -> manage -> drives ... I think you can double click some free space there and make a new partition
That wasn't a "do option 1 THEN do option2 ..." list, it was a "do option 1 OR do option 2..." - i.e. option 2 was a windows-specific solution.
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Re: Writing Kernel to hard drive

Post by XCHG »

djtrickdog wrote:Hello I am developing a OS and i am using MikeOS as my loose base. I want to write MikeOS on my hard drive but i have Windows XP on it already and wish to Still keep it on it :/ . I am using Gag boot loader and have about 40 unpartitioned space on my hd. What do i need to write MikeOS or any kernel to my hard drive? Thanks for the Help guys.
The partition table is located at the offset 446 (Dec, Zero-based) of the MBR. Each partition takes 16 bytes of space. The partition table is 64 bytes long allowing up to 4 partitions to be created (4*16 = 64). Dump your disk MBR into a file using MBRUtils. Search in Google and you will find it. Then create your own partition. The partition structure is:

Code: Select all

(* ----------------------------------- *)
  PHDDPartition = ^THDDPartition;
  THDDPartition = Packed Record
    BootIndicator                     : Byte;
    StartingCHS                       : Array [0..2] of Byte;
    PartitionType                     : Byte;
    EndingCHS                         : Array [0..2] of Byte;
    StartingLBA                       : DWORD;
    PartitionSizeInSectors            : DWORD;
  end;
(* ----------------------------------- *)
If you find the BootIndicator field of one of the partitions to be equal to 0x80, that partition is the active partition and most definitely your Windows partition. Find its length and see how many bytes you have free for your own partition and etc. Then create one of the above structures and write it to a new partition in your partition table.

Let me know if you need more help.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
User avatar
djtrickdog
Member
Member
Posts: 39
Joined: Sat Dec 15, 2007 7:36 pm

Post by djtrickdog »

Bah! Read my post!
oops sorry misunderstood what you ment.
what is dd? i googled and not sure i found the right thing...
i also searched on wiki
The partition table is located at the offset 446 (Dec, Zero-based) of the MBR. Each partition takes 16 bytes of space. The partition table is 64 bytes long allowing up to 4 partitions to be created (4*16 = 64). Dump your disk MBR into a file using MBRUtils. Search in Google and you will find it. Then create your own partition. The partition structure is:

Code:
(* ----------------------------------- *)
PHDDPartition = ^THDDPartition;
THDDPartition = Packed Record
BootIndicator : Byte;
StartingCHS : Array [0..2] of Byte;
PartitionType : Byte;
EndingCHS : Array [0..2] of Byte;
StartingLBA : DWORD;
PartitionSizeInSectors : DWORD;
end;
(* ----------------------------------- *)


If you find the BootIndicator field of one of the partitions to be equal to 0x80, that partition is the active partition and most definitely your Windows partition. Find its length and see how many bytes you have free for your own partition and etc. Then create one of the above structures and write it to a new partition in your partition table.
i just created a new partition...thanks for the help!
Now i just need to know how to Write my bin files to the hard drive. Do i have to make a disk image? if so what kind? What tool? Or do i put the bins directly on drive?
ChristianF
Member
Member
Posts: 79
Joined: Sun Jun 10, 2007 11:36 am

Post by ChristianF »

MMhhh....
you can ...
  • ... install GRUB
    ... modify the boot.ini
To modify the boot.ini click on start, execute, type msconfig and change to boot.ini. There you can insert your OS.

Cheers
Christian
Post Reply