another question

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.
Post Reply
one

another question

Post by one »

I want to know how i can get information about the installed disks,devices in a computer system. can i depend on checking the CMOS info for this? if so then what about the different types of BIOS that i might encounter do they all use the same layout? I would also apprectiaite it any of you folks could explain how i can configure BOCHS with different types of BIOS images? where can i get these images? also is there any way to write my kernel file to an image file for testing in BOCHS? right now i build it then write it to a floppy and then use partcopy to create an image is there any simpler way of doing this without using any floppy in between? (i've lost quite a few floppies to date:-( ). Thanx in advance for your help
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:another question

Post by Pype.Clicker »

one wrote: also is there any way to write my kernel file to an image file for testing in BOCHS?
just build it in a file and give that file to BOCHS...
one

Re:another question

Post by one »

do you mean that BOCHS will load the whole file and not just the first 512 bytes?
Curufir

Re:another question

Post by Curufir »

one wrote: do you mean that BOCHS will load the whole file and not just the first 512 bytes?
No, BOCHS will treat the file as a disk image and load in the first 512 bytes.

Since you're writing to a floppy anyway why bother with the partcopy step?

Since it's apparent you're on Windows and don't have any image manipulation software (I suggest Winimage) then you may as well just use the physical floppy disk until you feel like distributing an image.

To do so just change your bochsrc floppy entry to point at A: instead of the disk image.
Adek336

Re:another question

Post by Adek336 »

You say you are loosing your floppies?

Probably it is because your bootstrap has not got a BIOS Paramater Block (BPB). Without it you have to reformat the floppy each time.

Cheers,
Adrian.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:another question

Post by Solar »

Boys, boys... what he's saying is, he's always writing his kernel image to a floppy disk, then booting from that in Bochs, and that this procedure is wearing away his floppies...

(And it's slow as hell, too...)

On http://www.acc.umu.se/~bosse/, you will find a tool named "filedisk".

Make an image from your floppy drive. (The how-to on that should be somewhere in the Bochs manuals IIRC.)

Then, you can mount that image:

filedisk /mount 0 'C:\Path\To\Your\ImageFile.img' z:

Now you can access your image at drive letter z:. Copy your kernel image there, unmount the drive with

filedisk /umount z:

...and boot the image with Bochs.

Hint: I wrote a target "image" in my makefile, which builds the kernel image, and does the mount/copy/unmount. That way, all I have to do is a "make image", there you go. ;-)
Every good solution is obvious once you've found it.
Curufir

Re:another question

Post by Curufir »

Thanks Solar, this is exactly what I've been searching for.
Schol-R-LEA

Re:another question

Post by Schol-R-LEA »

If you still wish to write your kernel image to an image file (something I myself do), it can be done with partcopy quite easily, though you will want to be quite careful when doing so.

While Bochs will boot from an image file of almost any size less than 1.44M as if it were a floppy disk, I prefer to actually use an empty 1.44M file as the basis of the image. Such a file can be created using the bximage utility that comes with the Windows version of Bochs; just select 'fd' instead of 'hd', and choose the defaults for the remaining queries, and you will have an empty 1.4M file named 'a.img'. You can rename it to whatever you wish.

To insert a file's contents into another file using partcopy, the general syntax is:

[tt]partcopy <src> <src_begin> <src_size> <dest> <dest_begin>[/tt]

... where src_begin is the location in the source file to begin copying from, src_size is the size of the block to be copied, and dest_begin is the location in the destination file where it should be copied to. All sizes are in hex, BTW. So, if you are copying a 512 byte boot image from boot.bin to the beginning of a.img, it would be

[tt]partcopy boot.bin 0 200 a.img 0[/tt]

I insert the boot block separately from the kernel; this way, I can simply keep a master copy of the file with the tested boot block around, and copy that over the test image each time before inserting the latest version of the kernel image. I also use batch scripts to do the actual copying, which I only change when the file sizes change. Not only does this save repeated effort, it also minimizes the chance of a damaging error when typing out the command line (and allows me to run it from the GUI as convienent).

HTH. Again, remember to take care when using partcopy, as it is a potentially dangerous tool when applied carelessly.
one

Re:another question

Post by one »

Thanx a lot solar I've been searching for something like this right from the start of my OS developmemnt. Man Thanx a lot.
One
There is one problem however I can't seem to get an image mounted with filedisk i either get the error
"Specified path is invalid" or
"Access is denied"
Please give me the details about mounting drives.Thanx

P.S:- I added the info in the REG file to the registry and restarted to no avail
BI lazy

Re:another question

Post by BI lazy »

something similar like filedisk can be done in unix/linux with the famous loop device. so i don't need floppys but for testing on my test pc. it's fairly simple to do:

for obtaining a floppyimg with a valid filesystem:
dd if=/dev/fd0 of=/blah/floppy.img
mount -t auto /blah/floppy.img /bloh/floppy -o loop=/dev/loop[1<n<9]

then you can copy stuff to the image as if it were a real disk, and then you can unmount it with umount /bloh/floppy
one

Re:another question

Post by one »

Is there no one checking up on this post? Please let me know how to use FILEDISK as i keep getting the same errors. Thanx in advance. ???
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:another question

Post by Solar »

TheOne: Please excuse me for being away over the weekend.
::) ???

Dude, I had no more info about filedisk than you have after reading the indicated website and downloading the package, so I can just heartily utter "RTFM".

How come I left you under the impression that you are inclined for getting an answer? I believe you have yet to learn how to ask questions... (Hint: there's a sticky thread of the same name...)

PS: This comes across a bit too aggressive. So I'll try to make up for it a bit.

* check if the drive letter is already in use;
* check if the path you are giving is actually correct;
* check if you still have DOS boxes open pointing to the mounted image when trying to unmount it;
* check the Makefile at http://svn.pro-pos.org/firststep/DEV/kernel/Makefile
* try the README in the filedisk package, and calling filedisk /?.
* try asking instead of demanding, next time...
Every good solution is obvious once you've found it.
BI lazy

Re:another question

Post by BI lazy »

no need for excuses, Solar. *gg* That lad's gonna learn on his own how to use the tool with the info you 've passed to him. It's time for him to learn the best tool of a developer: Research.

Stay safe ];->
one

Re:another question

Post by one »

Thanks for the info and advice Itook it in the right spirit. The problem here is that the net access charges are high and so i dont feel at ease searching the web for long. hence the rush.Sorrry I'll try to be more smarter next time.
Post Reply