OSDev.org
https://forum.osdev.org/

How to rewrite xv6 from scratch?
https://forum.osdev.org/viewtopic.php?f=15&t=37052
Page 1 of 1

Author:  dzwduan [ Wed Jul 29, 2020 2:18 am ]
Post subject:  How to rewrite xv6 from scratch?

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

Author:  acccidiccc [ Tue May 25, 2021 3:42 pm ]
Post subject:  Re: How to rewrite xv6 from scratch?

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

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/