OSDev.org

The Place to Start for Operating System Developers
It is currently Mon Jun 21, 2021 5:10 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: How to rewrite xv6 from scratch?
PostPosted: Wed Jul 29, 2020 2:18 am 
Offline

Joined: Wed Jul 29, 2020 1:36 am
Posts: 1
I dont know how to use Makefile to reimplement an os .which files should i first write and how to write my makefile to verification ?
I have rewrite bootasm.S and bootmain.c,but the Makefile need kernel ,and kernel need more.Thus i dont know how to develop it


Top
 Profile  
 
 Post subject: Re: How to rewrite xv6 from scratch?
PostPosted: Tue May 25, 2021 3:42 pm 
Offline
Member
Member
User avatar

Joined: Sun Mar 21, 2021 1:09 pm
Posts: 25
Location: current location
Hello, I advise you to learn how makefiles work: they are very useful, tedious, but useful.

Code:
#basic makefile (not applicable to the xv6 project)
.PHONY clean # if you have a directory named clean, it gets ignored so you can $ make clean

CFLAGS=-ffreestanding -Iinc #freestanding, that means that you it is compiled without system files -Iinc looks for headers in inc

kernel:
    gcc $$(find  ./ -name '*.c' -or -name '*.S') $(CFLAGS) # cflags are the ones specified above, gcc is the compiler !INSERT CROSSCOMPILER HERE!
   # find name '*.c" finds all c source files and .S files in the current directory, change ./ to your source directory
   # do a few more for obj's and stuff


#




dzwduan wrote:
how to write my makefile to verification

what do you mean? to verify what?
I think you mean to use the xv6 makefile right?

remember xv6 is a not easy to achieve, I myself am not very experienced, but I know that getting to a tasking operating system is hard.
you do not need to write it from scratch, modify and add functionality yourself, or start with the barebones given on the osdev wiki
(wiki.osdev.org/barebones)
as this is old and your only post, maybe you have given up, but try again later if you want and have got a better grasp of makefiles and etc.
note: OSDev takes time, a lot of time, at least for me. as much as a full time job, thankfully I'm a student so I got that time)

also theres a page on the wiki, which specifies the order you should do things in.

start with a basic way of communicating to you, via a serial buffer or vga. such as printf. print to serial is the next, as it is not volatile like the vga buffer is. then make an interrupt handling system, with exceptions, a tutorial is on the wiki.
if you don't understand any thing, google it with the suffix osdev eg. multithreading osdev.
grab an intel manual for the target processor. (x86 programmer manual) or volume 3 of the x86_64 specification.


GOOD LUCK

_________________
debugging tutorials is annoying, but bring much more knowledge than the tutorials themselves can


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group