[?]Help Making OS [?] (Linker Error)

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.
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: [?]Help Starting OS [?]

Post by Troy Martin »

Yeah but using AT&T with as makes everything standard and the same.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: [?]Help Starting OS [?]

Post by Love4Boobies »

And using the Intel syntax for everything makes it the same plus more convenient for you :wink:
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
GeniusCobyWalker
Member
Member
Posts: 65
Joined: Mon Jan 12, 2009 4:17 pm

Re: [?]Help Starting OS [?]

Post by GeniusCobyWalker »

Well, they are pretty much the same. I recommend GCC, NASM (well, that's me), Bochs.
I got (Code::Blocks) GCC, NASM, Bochs.

What now?

Also im using Ubuntu i386 AMD64 does that matter?
Full Knowledge in:
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: [?]Help Starting OS [?]

Post by Love4Boobies »

GeniusCobyWalker wrote:What now?
Now the fun begins. Start reading the Intel manuals before anything else. After that, look around the wiki and you'll know what to do. It's normal to be confused at the begining :). If you still have problems, come back here and ask for more directions.

Anyway, you've got a pretty strange background... Zilog assembly and stuff like Blender? :lol: I mean I played around with Blender myself but that's it... You will find that OSDeving is a lot different than application programming, espeically that of OpenGL & such. Nonetheless, I wish you good luck :D
Also im using Ubuntu i386 AMD64 does that matter?
Ubuntu i386 AMD64? I doubt there's such a platform :) Do you mean your CPU is an AMD64?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
GeniusCobyWalker
Member
Member
Posts: 65
Joined: Mon Jan 12, 2009 4:17 pm

Re: [?]Help Starting OS [?]

Post by GeniusCobyWalker »

No it is Ubuntu 64 Bit.
Full Knowledge in:
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: [?]Help Starting OS [?]

Post by Love4Boobies »

Ok, but it can't be both i386 and AMD64. i386 stands for "Intel 80386" (although the AMD64 architecture is backwards-compatible with the i386). Anyway, it's fine what you have :wink:
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
GeniusCobyWalker
Member
Member
Posts: 65
Joined: Mon Jan 12, 2009 4:17 pm

Re: [?]Help Starting OS [?]

Post by GeniusCobyWalker »

Does anybody know how to start a project for this in Code::Blocks?
How do I go about compiling it?

If anyone thinks I shouldn't use code::blocks what should I use?
Full Knowledge in:
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: [?]Help Starting OS [?]

Post by Love4Boobies »

You probably shouldn't be using an IDE to begin with. IDEs tend to control your applications for you and you don't want that for OSes; use command lines and makefiles. If you like nifty user interfaces, get an editor, otherwise use a simple UTF-8 text editor. You will find a list of editors on the wiki, as well as IDEs, but I would not recommend any of those unless you know what you're doing (and even so it's kind of pointless)...
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
Zenith
Member
Member
Posts: 224
Joined: Tue Apr 10, 2007 4:42 pm

Re: [?]Help Starting OS [?]

Post by Zenith »

Personally, I'd disagree with that. Though I don't get Eclipse (the IDE of choice for me) to manage every facet of my OS project for me, I find it's helped simplify development a lot. I DO use a makefile (with autoconf), but Eclipse has a view for managing and executing makefile targets that's much easier to manage than continuously opening a bash shell. File/project management, class/object views, dependencies, and content-assist across multiple files, and compiler integration are just some of the useful advantages an IDE can offer that a text editor with command shell cannot, even in the case of OS development. But to each their own...
"Sufficiently advanced stupidity is indistinguishable from malice."
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: [?]Help Starting OS [?]

Post by JohnnyTheDon »

IDEs will work, but so will basic makefiles. Here is a simple one to get you started:

Code: Select all

CC = gcc
CFLAGS = -m32 -ffreestanding -nostdlib -nodefaultlibs -mcmodel=large -DBUILDING_KERNEL

ASM = nasm
ASMFLAGS =

LD = ld
LDFLAGS = -T linkerscript.ld --strip-all -nostdlib -nodefaultlibs

BIN = (Insert directory where you put compiled executables)
OUTPUT = (Insert name of output)

CSOURCES = $(wildcard *.c)
CHEADERS = $(wildcard *.h)
ASMSOURCES = $(wildcard *.s)

COBJECTS = $(patsubst %.c,%.o, $(CSOURCES))
ASMOBJECTS = $(patsubst %,%.o, $(ASMSOURCES))

.PHONY : all clean

all: $(BIN)$(OUTPUT)
clean:
	rm -f *.o
$(BIN)$(OUTPUT): $(COBJECTS) $(ASMOBJECTS)
	$(LD) $(LDFLAGS) -o $(BIN)$(OUTPUT) $(COBJECTS) $(ASMOBJECTS)
$(COBJECTS) : $(CSOURCES) $(CHEADERS)
	$(CC) -c $(CFLAGS) -o $@ $(patsubst %.o,%.c, $@)
$(ASMOBJECTS) : $(ASMSOURCES)
	$(ASM) -f elf32 $(ASMFLAGS) -o $@ $(patsubst %.o,%, $@)
$(CSOURCES) :
$(ASMSOURCES) :
$(CHEADERS) :
That will build a 32-bit ELF with all the .c and .s files in the directory. Make sure you also provide a linker script. Take a look at the bare bones tutorial for more info.

IDEs will work, but I prefer makefiles because I can easily create a script that will run my makefile, report any errors, copy my kernel to my disk image, and then run my emulator. Probably possible in an IDE as well, but idk how to set it up.
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: [?]Help Starting OS [?]

Post by Combuster »

I'd have serious trouble with people who
- can't compile code
- can't figure how to create a project
- can't distinguish i386 and amd64
- uses colours and therefore haven't read the forum rules.

So either this is cotton returning or you should really consider starting with something easier than an OS.
"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
GeniusCobyWalker
Member
Member
Posts: 65
Joined: Mon Jan 12, 2009 4:17 pm

Re: [?]Help Starting OS [?]

Post by GeniusCobyWalker »

Still need help.

How do I make these files in Ubuntu
Full Knowledge in:
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
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: [?]Help Starting OS [?]

Post by Combuster »

"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
GeniusCobyWalker
Member
Member
Posts: 65
Joined: Mon Jan 12, 2009 4:17 pm

Re: [?]Help Starting OS [?]

Post by GeniusCobyWalker »

Thanks for the links Combuster sorry that I haven't read them before.
Also fixed the signature (NO COLOURS).

How do I make these files?
(Unfamiliar with Ubuntu's file system)
I will use GEdit instead of Code::Blocks now

I will continue reading "Bare Bones" while waiting for a response.
Full Knowledge in:
GML, Ti-Basic, Zilog Z80 Assembly, SX28 Assembly and Blender
Experience in:
C++,OpenGl,NDS C++,Dark Basic,Dark Basic Pro,Dark Gdk and PSP Coding
Using:
Ubuntu ,GEdit ,NASM ,GCC ,LD ,Bochs
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: [?]Help Starting OS [?]

Post by JohnnyTheDon »

How do I make these files?
You mean how do you run a makefile? Look at the docs for make ( http://www.gnu.org/software/make/manual/make.html ).

Basically, you just run make in the directory where your makefile is located. Here is a shell script that will let you do that without opening a terminal:

Code: Select all

#! /bin/sh
make
Locked