Page 1 of 1

James Molloy's Tutorial without Grub Multi Bootloader?

Posted: Sat Apr 18, 2009 7:26 am
by ehenkes
Re: James Molloy's Tutorial: Are there workarounds if you do not use Grub but your own tiny bootloader, e.g. for the loading of the files to the ram disk area? (chapter eight)
Which tool could you recommend (MS Windows) for transfering files/data from external mediums to the memory before or after the boot process?

There are more transfer problems like initial_esp (for moving stack), end of kernel, ...

Re: James Molloy's Tutorial without Grub Multi Bootloader?

Posted: Wed Apr 22, 2009 2:00 pm
by imate900
ehenkes wrote:Re: James Molloy's Tutorial: Are there workarounds if you do not use Grub but your own tiny bootloader, e.g. for the loading of the files to the ram disk area? (chapter eight)
Which tool could you recommend (MS Windows) for transfering files/data from external mediums to the memory before or after the boot process?

There are more transfer problems like initial_esp (for moving stack), end of kernel, ...
You have to strip the Multiboot code so boot.s is:

Code: Select all

start:
 mov esp, stack
 cli
 call main
 jmp $

stack resb 16384
Make sure the bootloader switches you into protected mode.
Use the same linker script.

Re: James Molloy's Tutorial without Grub Multi Bootloader?

Posted: Wed Apr 22, 2009 2:10 pm
by Combuster
Which tool could you recommend (MS Windows) for transfering files/data from external mediums to the memory before or after the boot process?
Are you seriously asking for a windows application to run at boot-time? Nonexistant.
Re: James Molloy's Tutorial: Are there workarounds if you do not use Grub but your own tiny bootloader
If you read the tutorial you would know about the multiboot standard, and you wouldn't be asking this question.

Re: James Molloy's Tutorial without Grub Multi Bootloader?

Posted: Wed Apr 22, 2009 2:31 pm
by earlz
For loading the initrd, I used somethign like

Code: Select all

global initrd
global end_initrd
initrd:
incbin "initrd.bin"
end_initrd:
and compiled it like

Code: Select all

yasm -f elf initrd.asm
and then linked it with the rest of the kernel like

Code: Select all

ld ... main.o initrd.o
then all you have to do to get the address of initrd is

Code: Select all

extern char initrd[];
...
initrd[0]; //first byte of ramdisk
Very simple stuff..

Re: James Molloy's Tutorial without Grub Multi Bootloader?

Posted: Fri Apr 24, 2009 11:24 am
by ehenkes
@earlz: thanks, I did not know this incbin instruction. Great!

It worked very well. :D

I worked on the VFS and the RAM disk, because it is very important to bring data, specialized kernel modules or user code into the memory of the OS. The way how it works now is as follows:

1) produce a binary image from various files (with "make_initrd.exe", source code: "make_initrd.c"). I renamed the resulting image to "file_data.dat". This is the target for incbin in process.asm.

2a) include it in process.asm with incbin, global addresses:

Code: Select all

; data for ramdisk
global _file_data_start
global _file_data_end
_file_data_start:
incbin "file_data.dat"
_file_data_end: 	
2b) Linker transfers it to the memory at &file_data_start

3) The source code line

Code: Select all

k_memcpy((void*)ramdisk_start, &file_data_start, (ULONG)&file_data_end - (ULONG)&file_data_start);
in main() transfers the data with the files to the RAM disk (this is an easy way to exchange data with the OS)

4) The Virtual File System (VFS) with individual file headers helps to access the files in the RAM disk

PrettyOS: http://www.henkessoft.de/OS_Dev/Downloads/36.zip
Screenshot: http://www.henkessoft.de/OS_Dev/Downloa ... k_test.png
Are you seriously asking for a windows application to run at boot-time? Nonexistant.
I thought that there might be a little tool (at MS Windows developing platform) performing the transfer controlled by the makefile before booting, but I think now that this is really nonsense.