James Molloy's Tutorial without Grub Multi Bootloader?

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
User avatar
ehenkes
Member
Member
Posts: 124
Joined: Mon Mar 23, 2009 3:15 am
Location: Germany
Contact:

James Molloy's Tutorial without Grub Multi Bootloader?

Post 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, ...
User avatar
imate900
Member
Member
Posts: 80
Joined: Sat Feb 28, 2009 11:43 am

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

Post 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.
Current work on a OS: SauOS (project homepage: http://code.google.com/p/sauos/)
Image
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

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

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

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

Post 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..
User avatar
ehenkes
Member
Member
Posts: 124
Joined: Mon Mar 23, 2009 3:15 am
Location: Germany
Contact:

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

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