0x100000

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.
hazardoxide
Member
Member
Posts: 26
Joined: Thu Dec 13, 2007 12:31 pm

0x100000

Post by hazardoxide »

apologies. This is my last question for now. first, thanks for all the help. good site.ok. i have a bootable floppy with grub installed that loads the kernel from 0x100000. how do i write my kernel to that address?
If bill gates had a dollar for everytime windows crashed...oh wait... he does.
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Post by ucosty »

GRUB loads the kernel to 0x100000 not from it. That is a location in memory - the 1mb mark to be exact. All you do is point GRUB to your kernel image and it does the rest.
The cake is a lie | rackbits.com
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Post by lukem95 »

you chose what image grub loads on the menu.lst file, then it simple passes control to it.
~ Lukem95 [ Cake ]
Release: 0.08b
Image
hazardoxide
Member
Member
Posts: 26
Joined: Thu Dec 13, 2007 12:31 pm

Post by hazardoxide »

But if i write an image to the disk, it will erase grub
If bill gates had a dollar for everytime windows crashed...oh wait... he does.
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Post by lukem95 »

then you need to include GRUB in your image...

i have a very round-about way of making iso's, as im using a windows platform.

what i do:
+ Compile the source into kernel.bin
+ Use this + grub in VFD (virtual floppy driver) for testing
+ Save this as .img
+ Using MagicISO take the boot code from the .img, and add the boot folder for grub, along with kernel.bin to a new bootable .iso
+ Save and burn to disk using Nero
~ Lukem95 [ Cake ]
Release: 0.08b
Image
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Post by t0xic »

hazardoxide,

First, make sure you use the Fat12 GRUB version. Follow what lukem says to do, then put the following in your "menu.cfg" file, substituting where you need to:

Code: Select all

title		OS
root		(fd0)
kernel    /kernel.bin
hazardoxide
Member
Member
Posts: 26
Joined: Thu Dec 13, 2007 12:31 pm

Post by hazardoxide »

well, im not sure what to do with vfd. i downloaded it. installed and started the driver, set it to A:, now what? i got a floppy with grub installed, and in the menu.lst, i have it setup to look for: kernel (fd0)/boot/kernel.bin but when i out my bin there, it says it's an unreconized or unsupported format. and i also tried moving all the files from the real grub floppy with kernel.bin to virtual floppy A: in "my computer" and with an empty 1.44 img file created in it, but when i try to save from vfd, is says "device not ready" formatting too, it always says to me, device not ready.
If bill gates had a dollar for everytime windows crashed...oh wait... he does.
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Post by t0xic »

What executable format is your kernel? If it is ELF, make sure the linker script works
hazardoxide
Member
Member
Posts: 26
Joined: Thu Dec 13, 2007 12:31 pm

Post by hazardoxide »

what is the default output format of ld if i leave it alone
If bill gates had a dollar for everytime windows crashed...oh wait... he does.
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Post by ucosty »

hazardoxide wrote:what is the default output format of ld if i leave it alone
That depends on your build environment. An ELF cross compiler, like the one described in the wiki, will output an ELF file by default but will (probably) barf on the lack of a linker script. OS Specific toolchains (for user code) have an included linker script specific to that platform.
The cake is a lie | rackbits.com
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:

Post by Combuster »

ucosty wrote:
hazardoxide wrote:what is the default output format of ld if i leave it alone
That depends on your build environment. An ELF cross compiler, like the one described in the wiki, will output an ELF file by default but will (probably) barf on the lack of a linker script. OS Specific toolchains (for user code) have an included linker script specific to that platform.
The cross-compiler on the wiki comes with a builtin linker script that does pretty much of the default things (if you want to link applications, it will probably be good enough). There is a commandline switch that makes ld dump its builtin linker script.
"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 ]
hazardoxide
Member
Member
Posts: 26
Joined: Thu Dec 13, 2007 12:31 pm

Post by hazardoxide »

I'm trying to compile james M'S tut using djgpp and nasm. I made boot.asm (compiled ok) I compiled main.c (with warnings) but when i try to like them (using link.ld) i get the following errors:

Code: Select all

C:\os\main.o:crt0.s:(.text+0x0): multiple definition of 'start'
C:\os\boot.o:C:\os\boot.o:(.text+0x20): first defined here
C:\os\boot.o:C:\os\boot.o:(.text+0x30): undefined reference to 'main'
using: ld -T C:\os\link.ld -o C:\os\kernel.bin C:\os\boot.o C:\os\main.o

when compiling main.c i get the following warnings:

Code: Select all

C:\os\main.c:1: warning: 'struct multiboot' declared inside parameter list
C:\os\main.c:1: warning: its scope is only this definition or declaration, which is probably not what you want
C:\os\main.c:4:2: warning: no newline at end of file
Whats going on here?

thanks,
If bill gates had a dollar for everytime windows crashed...oh wait... he does.
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:

Post by Combuster »

Whats going on here?
Its your toolchain, you should know what it does.

You're probably not using a GCC Cross-Compiler, no?
"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 ]
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Post by lukem95 »

well if your following the tut you should have read that there is no actual definition for the multiboot struct till the last chapter... so thats that warning taken care of.

and as for the multiple start definitions... isnt that obvious? you have used "start" as a function name twice
~ Lukem95 [ Cake ]
Release: 0.08b
Image
hazardoxide
Member
Member
Posts: 26
Joined: Thu Dec 13, 2007 12:31 pm

Post by hazardoxide »

combuster, im using djgpp, so yes. gcc.

use, though common logic i have depicted that i did infact use "start" twice. but the tutorial has it like that, so what can i change to fix said problem.
:?
If bill gates had a dollar for everytime windows crashed...oh wait... he does.
Post Reply