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.
Hello everyone, I'm new in this forum and in the development of operating systems ^ ^ (XD)
I wanted to ask how to create a custom bootloader ... or better to say how to recognize it from qemu xD.
In short, the boot loader code is this:
Boot.asm:
global loader
[BITS 32]
extern _kmain
section .text
LEA SI,[msg]
MOV AH,0Eh
print: MOV AL,[SI]
CMP AL,0
JZ done
INT 10h
INC SI
JMP print
; wait for 'any key':
done: ;MOV AH,0
;INT 16h
call _kmain
MOV AX,0040h
MOV DS,AX
MOV word[0072h],0000h.
JMP 0FFFFh:0000h
msg DB 'Benvenuto in patronum OS.',13,10
; end boot1
qemu in windows but does not recognize it ... in ubuntu I need to use "qemu-kernel kernel.bin" instead in windows if I type the same command (with qemu installed) nothing happens ...
berkus wrote:I assume you have read the Bootloader wiki article, so you know about the BIOS boot signature. There's even an example how to define one.
oh, i haven't read it....
EDIT: After reading the article, I see that do not there is a big difference between that article and "my" ( excepted that the code in the article is in 16 bit and my is in 32 bit, there is also the difference that he does not call any C code, which I will be obliged to do (because I do not know very well asm) )
berkus wrote:I assume you have read the Bootloader wiki article, so you know about the BIOS boot signature. There's even an example how to define one.
oh, i haven't read it....
EDIT: After reading the article, I see that do not there is a big difference between that article and "my" ( excepted that the code in the article is in 16 bit and my is in 32 bit, there is also the difference that he does not call any C code, which I will be obliged to do (because I do not know very well asm) )
You can't use 32 bit code in a boot sector, the cpu is running in 16 bit mode until you enter protected mode.
berkus wrote:I assume you have read the Bootloader wiki article, so you know about the BIOS boot signature. There's even an example how to define one.
oh, i haven't read it....
EDIT: After reading the article, I see that do not there is a big difference between that article and "my" ( excepted that the code in the article is in 16 bit and my is in 32 bit, there is also the difference that he does not call any C code, which I will be obliged to do (because I do not know very well asm) )
You can't use 32 bit code in a boot sector, the cpu is running in 16 bit mode until you enter protected mode.
Gigasoft wrote:That isn't a bootloader. It is the entry point and multiboot header for a multiboot executable.
What? I tried this code in QEMU with the string "qemu -kernel kernel.bin" (after compiling a "kernel.bin" file ) and it works...
It do what I want: it calls a C function from Assembler in the computer boot. And with this I think it's a bootloader.
What? I tried this code in QEMU with the string "qemu -kernel kernel.bin" (after compiling a "kernel.bin" file ) and it works...
It do what I want: it calls a C function from Assembler in the computer boot. And with this I think it's a bootloader.
Do you have any idea what -kernel option does? It's a good practice to examine the water level before diving into this huge sea. Do care to search before complaining.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
Shikhin wrote:/me shakes his head - this is what happens to people who just aimlessly copy code from some website, without even understanding what it does.
I already said that I do not know well the assembly, or rather not know anything about assembler.
It is true that I copied that code from a site ... but this does not mean anything.
Chandra wrote:
What? I tried this code in QEMU with the string "qemu -kernel kernel.bin" (after compiling a "kernel.bin" file ) and it works...
It do what I want: it calls a C function from Assembler in the computer boot. And with this I think it's a bootloader.
Do you have any idea what -kernel option does? It's a good practice to examine the water level before diving into this huge sea. Do care to search before complaining.
Yes, it is obvious that I know what are the functions that I say.
It's needless to say ****.
berkus wrote:This isn't a bootloader, it's just a multiboot entry point which can be loaded by multiboot-compatible bootloader.
Sorry, but it works without another bootloader ( such as grub ).
Accepting that you are wrong is the first step to start learning. And stating that everyone except you is wrong is the first step to damage your reputation.
Shikhin wrote:Accepting that you are wrong is the first step to start learning. And stating that everyone except you is wrong is the first step to damage your reputation.