loading images to run user program?

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
amirsadig

loading images to run user program?

Post by amirsadig »

now I want to have some basic user process, so I will know where are bugs in my OS. because I could not complete my floppy driver and thus no FS support, I need other ideas to load some program emages with the kernel right after the kernel image and my kernel is able to find them. is there any way to do that?
gtsphere

Re:loading images to run user program?

Post by gtsphere »

you could physically write the files into separate sectors onto the disk, but that can be very time consuming for that you need to track how many each program takes up (how many sectors). But it is possible.

dd if=/whatever of=/dev/fd0 offset=(number of sectors)

i believe thats the command line for where to write what with DD, but i'd double check.

Hope this somewhat helps
-GT
amirsadig

Re:loading images to run user program?

Post by amirsadig »

my floppy driver does not work until now there for I can not read any disk with my kernel. I mean, I want some like ramdisk which will be attached at the end of my kernel - for example after bss section.
nullify

Re:loading images to run user program?

Post by nullify »

If you are using GRUB, it can load extra modules with the kernel. These modules can be the simple user-space programs that you want to load and test. This is what I did anyway, since I don't (yet) have a working floppy driver, either. Take a look at the multiboot specification for info on how to do this.

If you're using someone else's bootloader other than GRUB, check if the bootloader supports loading modules (I know the SIGOPS uBoot loader allows you to load modules, too).

If you've written your own bootloader and it doesn't have this functionality, then I'm afraid that you have little choice... :(
amirsadig

Re:loading images to run user program?

Post by amirsadig »

I will try it. thanks
DarylD

Re:loading images to run user program?

Post by DarylD »

Note, to use GRUB's module loader to load programs, is that it loads the image as is, it doesnt do any runtime linking.

So for example if you had an elf program loaded as a boot module, it would load it into memory as it appears on disk, complete with elf headers et al.

Note, elf loaders are interesting to write, but not incredibly difficult.

Daryl.
amirsadig

Re:loading images to run user program?

Post by amirsadig »

That realy what I want now, until my floppy disk driver work. I will write elf loader, to run the programs in the image.
Post Reply