<deleted>

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.
CJKay
Posts: 20
Joined: Sun Aug 30, 2009 6:32 pm

<deleted>

Post by CJKay »

<deleted>
Last edited by CJKay on Wed Jul 12, 2017 1:44 pm, edited 5 times in total.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Bare bones doesn't actually work...

Post by pcmattman »

My binary comes out at 1MB!
Sounds like you're just outputting a flat binary - I'd bet that the first 1 MB of that file is nothing but null bytes...

What you need to do is target a format like ELF. What is your toolchain?
CJKay
Posts: 20
Joined: Sun Aug 30, 2009 6:32 pm

<deleted>

Post by CJKay »

<deleted>
Last edited by CJKay on Wed Jul 12, 2017 1:44 pm, edited 1 time in total.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Bare bones doesn't actually work...

Post by pcmattman »

Code: Select all

sudo yasm -m amd64 -f elf -o loader.o loader.s
sudo gcc -B x86_64-elf -v 4.3.3 -o kernel.o -c kernel.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs # -Werror
ld -T linker.ld -o kernel.bin loader.o kernel.o
Firstly, you shouldn't need sudo... Secondly, targeting 64-bit won't work with the barebones, as GRUB doesn't load a 64-bit kernel.

Your commands should be something more like...

Code: Select all

yasm -f elf -o loader.o loader.s
i586-elf-gcc -o kernel.o -c kernel.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs # -Werror
i586-elf-ld -T linker.ld -o kernel.bin loader.o kernel.o
CJKay
Posts: 20
Joined: Sun Aug 30, 2009 6:32 pm

<deleted>

Post by CJKay »

<deleted>
Last edited by CJKay on Wed Jul 12, 2017 1:44 pm, edited 1 time in total.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: Bare bones doesn't actually work...

Post by Brynet-Inc »

Mr.McNugget (aka CJKay) wrote:Also, I use sudo generally in case it suddenly needs it. Qemu, for example, only loads the acceleration layer with sudo.
I generally shoot people at my front door, because sometimes they might be bears.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
CJKay
Posts: 20
Joined: Sun Aug 30, 2009 6:32 pm

<deleted>

Post by CJKay »

<deleted>
Last edited by CJKay on Wed Jul 12, 2017 1:45 pm, edited 2 times in total.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Bare bones doesn't actually work...

Post by pcmattman »

Generally, using sudo doesn't kill anything except a couple of calories (typing in the password) :P.
I think writing Linux viruses could become quite profitable in the future ;)
But about 64-bit?
You're probably better off writing your own bootloader and second-stage to load your 64-bit kernel (with whatever paging you require) and jump to it.
CJKay
Posts: 20
Joined: Sun Aug 30, 2009 6:32 pm

<deleted>

Post by CJKay »

<deleted>
Last edited by CJKay on Wed Jul 12, 2017 1:45 pm, edited 2 times in total.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Bare bones doesn't actually work...

Post by pcmattman »

I just wrote a bootloader but restarted because I couldn't figure out how to link the C kernel to the assembly (binary doesn't support extern and what-not).
The bootloader loads a binary from a filesystem (or specific disk layout), and then runs it. So there shouldn't be a need for "extern" in the bootloader.
Is there any possible way to make a 64-bit OS with GRUB?
Have a look on Google for "64-bit OS GRUB" and see what comes up ;).

I highly suggest you use the search feature of the forum, this is a topic that's come up several times before.
CJKay
Posts: 20
Joined: Sun Aug 30, 2009 6:32 pm

<deleted>

Post by CJKay »

<deleted>
Last edited by CJKay on Wed Jul 12, 2017 1:45 pm, edited 1 time in total.
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: GRUB error 13...

Post by Combuster »

GRUB error 13...
Well, now I get error 13 >~>.
I get the blasted error 13 #-o .
it gives error 13 :(.
Is there something we don't know :roll:
I couldn't figure out how to link the C kernel to the assembly
All the tutorials on this site use the fact that you can, and there are even guides on bootloaders.
You have to search around a lot for a tutorial that fits exactly what you want.
Newbie mistake #1: Always demand a tutorial for doing X, with respect to Y and Z notwithstanding A, but not B, demonstrating µ via ß including the kitchen sink. Bottom line: Do you have what it takes to write an OS.

In specific, you are expected to do your research, your expermentation, and your own piecing toghether of steps to achieve a goal. Right now you are annoying us in the hopes that we do your homework for you (of which you can be sure we don't)

Homework: this week's required reading consists of at least A B C, and three more relevant items of your choice.
"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 ]
CJKay
Posts: 20
Joined: Sun Aug 30, 2009 6:32 pm

<deleted>

Post by CJKay »

<deleted>
Last edited by CJKay on Wed Jul 12, 2017 1:45 pm, edited 1 time in total.
terry
Posts: 13
Joined: Tue Mar 17, 2009 12:43 pm

Re: GRUB error 13...

Post by terry »

Multiboot headers have nothing to do with a header file called multiboot.h! :)

Google "Multiboot Header" and read the first couple of pages that google finds. They may be helpful to you.

If that doesn't help you then you should try real hard to figure out what the distinction is between an ELF object file and an executable.

I know that this sort of thing can be pretty frustrating at first, but trust me, it just gets worse. Please try to read documentation and figure out as many problems as you can on your own or you will never get anywhere.
CJKay
Posts: 20
Joined: Sun Aug 30, 2009 6:32 pm

<deleted>

Post by CJKay »

<deleted>
Last edited by CJKay on Wed Jul 12, 2017 1:45 pm, edited 2 times in total.
Post Reply