# Can I create my OS based on FreeBSD



## Ahmed El Gohary (Jul 13, 2015)

Hi.
My name is Ahmed. I'm a civil engineer  -but all my works are electrical engineer- I'm a developer at Microsoft Tech Club at all I'm still a student  . I'm new to FreeBSD. I want to create my own OS and for sure it will be Unix based. At first I was thinking of Linux but when I heard that BSD is more advanced and secure than any distro of Linux so I've changed my mind. I want to make new icons on KDE or Gnome and new Boot Screen new look for it and change its name for ex I will call it Ahmed Os which Is Based On FreeBSD and it's going to be open source.

So the question is can I create my own OS based on FreeBSD and it will feature a GUI and a BootScreen and a New Name and custom install. I mean to change the install into a graphical installation program like for example Fedora Linux. Can I do that? So if it's possible I want the tutorials.


----------



## hashime (Jul 14, 2015)

You heard wrong.

Yes you can do that. You can do whatever you want with the code. It's free,
at least the FreeBSD part, Gnome and KDE are under a different license but as long as you provide the source code of your changes, you should be good with that as well.


----------



## uzsolt (Jul 14, 2015)

First use and get to know FreeBSD!


----------



## ANOKNUSA (Jul 14, 2015)

Well, the licensing certainly allows you to do so. You can use the FreeBSD code for just about any (legal, ethical) purpose you want. Whether you'll actually be able to do it is another matter. I don't mean to discourage you, but:



Ahmed El Gohary said:


> Can I do that? So if it's possible I want the tutorials.



...it sounds like you answered your own question. You can read through the documentation and install FreeBSD to get a feel for the system, but there certainly is no ready-made tutorial on making your own *BSD operating system. This isn't like putting together a Linux distribution.


----------



## junovitch@ (Jul 14, 2015)

Can and should are different things.  If you are doing this for your own learning it's one thing but if a wider audience is your goal then keep in mind maintaining something as complex as an operating system is hard work.  We all specialize on what we do for a reason.  We don't all make our own clothes, grow all of our own food, or build our own houses.  If you have to ask for tutorials perhaps your efforts would be better spent joining the community and making it better rather than duplicating efforts all on your own.


----------



## Ahmed El Gohary (Jul 15, 2015)

junovitch said:


> Can and should are different things.  If you are doing this for your own learning it's one thing but if a wider audience is your goal then keep in mind maintaining something as complex as an operating system is hard work.  We all specialize on what we do for a reason.  We don't all make our own clothes, grow all of our own food, or build our own houses.  If you have to ask for tutorials perhaps your efforts would be better spent joining the community and making it better rather than duplicating efforts all on your own.



Thank you for your reply. It's an honor to join a great community like FreeBSD. Me and two other are aiming to build our OS you can called it a Distro of FreeBSD like OS X. We want to make the FreeBSD a perfect OS for the PC not only for severs. The steps of the project.
- Creating new boot screen
- New logo Instead of the FreeBSD Logo at the startup before booting into the system
- New interface and login Screen
- Change the icons instead of the Gnome ones
- Install apps and Wine to run games
- Change the name of the OS into a new one
- Create a graphical installation program
- Create a bootable ISO of the new OS
I want to know from where to start to do that.


----------



## hashime (Jul 15, 2015)

OS X is not a FreeBSD Distribution, nor does it run the FreeBSD kernel.
You can take a look at PC-BSD and maybe contribute there instead of doubling the effort.


----------



## protocelt (Jul 15, 2015)

For ideas on how to implement what your asking, take a look at the PC-BSD project. There is no tutorial to do what you are looking to do. You'll need a good understanding of FreeBSD itself as well as an understanding of scripting and low level programming experience among other things.


----------



## Ahmed El Gohary (Jul 15, 2015)

hashime said:


> OS X is not a FreeBSD Distribution, nor does it run the FreeBSD kernel.
> You can take a look at PC-BSD and maybe contribute there instead of doubling the effort.


I do understand the fact that it's not a distro of it but it's built on BSD. The OS of Sony PS4 is FreeBSD


protocelt said:


> For ideas on how to implement what your asking, take a look at the PC-BSD project. There is no tutorial to do what you are looking to do. You'll need a good understanding of FreeBSD itself as well as an understanding of scripting and low level programming experience among other things.


The programming language I'm using is C# as I am a developer of Windows. Someone told me that FreeBSD and Linux is programmed with C language.


----------



## ANOKNUSA (Jul 16, 2015)

Yes, OS X was built on a foundation of BSD--over the course of several years with a team of full-time, professional, experienced programmers at one of the world's top software companies.

"Distributions" of FreeBSD just aren't really done, at least not in the same sense that Linux distributions are made. PC-BSD and FreeNAS are probably the two most popular FreeBSD spin-offs, and they both a) have features that aren't available in plain FreeBSD, and b) are developed full-time by the same commercial operation. You need to think about what you're getting into--this isn't something you can do by just rearranging a few components, and if all you're going to offer is FreeBSD with new icons, people will just install FreeBSD and download your icons.


----------



## Deleted member 9563 (Jul 16, 2015)

Ahmed El Gohary said:


> We want to make the FreeBSD a perfect OS for the PC not only for severs.


It's great to see your interest and enthusiasm. I hope you do well. I just wanted to say that to some people (at least me) FreeBSD is already the perfect OS for PC. My wife likes it too.


----------



## Beastie7 (Jul 16, 2015)

Ahmed El Gohary said:


> Hi.
> My name is Ahmed. I'm a civil engineer  -but all my works are electrical engineer- I'm a developer at Microsoft Tech Club at all I'm still a student  . I'm new to FreeBSD. I want to create my own OS and for sure it will be Unix based. At first I was thinking of Linux but when I heard that BSD is more advanced and secure than any distro of Linux so I've changed my mind. I want to make new icons on KDE or Gnome and new Boot Screen new look for it and change its name for ex I will call it Ahmed Os which Is Based On FreeBSD and it's going to be open source.
> 
> So the question is can I create my own OS based on FreeBSD and it will feature a GUI and a BootScreen and a New Name and custom install. I mean to change the install into a graphical installation program like for example Fedora Linux. Can I do that? So if it's possible I want the tutorials.



How about this:

1) Get a Mac
2) Learn FreeBSD development
3) Contribute bug fixes/feature requests
4) Earn a commit bit
5) Help change the world


Let the Linux guys worry about re-inventing (and failing) Mac OS X. The project needs more help it can get.


----------



## protocelt (Jul 16, 2015)

Beastie7 said:


> How about this:
> 
> 1) Get a Mac FreeBSD compatible PC
> 2) Learn FreeBSD development
> ...


Fixed that for you.


----------



## Beastie7 (Jul 16, 2015)

That's an option too. LOL


----------



## Ahmed El Gohary (Aug 23, 2015)

*I* want to know what are the tools needed to create an OS based on FreeBSD however I've gotten the source code for PC-BSD as it will make it more easier for me to begin from it not directly for FreeBSD the host OS is Mac OS X Yosemite and in some cases will be Windows 10.
What I want to do is:

Change the bootscreen.
Change the desktop and use GNOME as the default GUI.
Change the name of the OS in a new one.
Create a logo (I know how to design it but don't know how to put it into the system).
Change the graphical installation program with one designed by me.
Pre-install all the programs just like Windows to make it easier for user and at the end how to rebuild it into a full system and create a bootable ISO for download.


----------



## protocelt (Aug 25, 2015)

Ahmed El Gohary said:


> *I* want to know what are the tools needed to create an OS based on FreeBSD however I've gotten the source code for PC-BSD as it will make it more easier for me to begin from it not directly for FreeBSD the host OS is Mac OS X Yosemite and in some cases will be Windows 10.
> What i want to do is:
> 
> Change the bootscreen.
> ...


Please don't start a new thread for the same or similar question. Threads merged.


----------



## sidetone (Aug 27, 2015)

Look into GhostBSD, ArchBSD or MidnightBSD. It'd be better to do something like add functionality like PC-BSD on top of an already existing distribution than to fork. I would have liked to see a BlackBox, Fluxbox or similar ready distribution always built on top of FreeBSD production, but this is easy to do without needing a full distribution.


----------



## protocelt (Aug 27, 2015)

Generally speaking, if you need to ask for tutorials on how to build a derivative of FreeBSD, you are not going to have much success in doing so. Understand the operating system and the intricacies of how it and it's tools work first.


----------



## Maelstorm (Oct 7, 2015)

Ahmed El Gohary said:


> Hi.
> My name is Ahmed. I'm a civil engineer  -but all my works are electrical engineer- I'm a developer at Microsoft Tech Club at all I'm still a student  . I'm new to FreeBSD. I want to create my own OS and for sure it will be Unix based. At first I was thinking of Linux but when I heard that BSD is more advanced and secure than any distro of Linux so I've changed my mind. I want to make new icons on KDE or Gnome and new Boot Screen new look for it and change its name for ex I will call it Ahmed Os which Is Based On FreeBSD and it's going to be open source.
> 
> So the question is can I create my own OS based on FreeBSD and it will feature a GUI and a BootScreen and a New Name and custom install. I mean to change the install into a graphical installation program like for example Fedora Linux. Can I do that? So if it's possible I want the tutorials.



Hello Ahmed,

I have been developing for FreeBSD for 15 years now and I still don't have it all down yet.  I also write code for Microsoft Windows (Applications that run on Windows, not Windows itself as I don't work for Microsoft), and I am a member of the Windows Insider Program, Microsoft Developer Network, and Microsoft TechNet.  As you probably know, programming is both an art and a science.  To answer your question, in terms of the law, yes.  You can build your own derivative of FreeBSD.  However, there is a lot of code that forms the base system.  Not just the tools and such, but also the kernel.  As other people have stated, if you are asking for tutorials to do what you are asking, you won't get very far.  Entire books have been written about the subject and there's still more to write.

Remember when I said that programming is both an art and a science? Well, kernel development, and OS development in general goes so far beyond being an art and a science it can be considered to be magic.  I have personally written code that runs in kernel space, and it is very easy to panic (BSOD) the system when coding on the other side of the system call tree.  I have written a *very* simple OS myself that consists of 384 bytes of program which ran on a PIC microcontroller.  That environment uses something called cooperative multitasking which means that the programs on there play nice with each other and the OS.  However, Windows, Linux, *BSDs, Mac OSX, and others use something known as preemptive multitasking.  That type of multitasking is when a program is running along happily minding it's own business and the operating system comes in and rudely severs the program from the CPU and gives it to another program.  To pull this off is quite complicated and requires a lot of code.  You have to code a scheduler that runs off the interval timer ticks which cuts the CPU time into slices.  Those slices are then given to the programs that are running in the system according to some algorithm or priority scheme.

That is *ONE* consideration.  Another consideration is the platform that this will run on.  I would, could, and did write a simple OS for a microcontroller (although it was just a kernel).  However, I would not recreate an OS for a common platform like IA-32 or AMD-64 (Intel x86 32-bit and 64-bit) as there are plenty of operating systems around, many of which are free (like FreeBSD).  That's when you take an existing system, tailor it for your uses, and then go from there.  Not only that, there are multiple platforms to choose from.  FreeBSD has Tier 1 support for several (IA-32 & AMD-64 being among them).  FreeBSD also has Tier 2 support for other (Sun Sparc comes to mind) platforms as well.  Check out the release notes.

So here's a basic list of what you need to consider (What I can think of):

What are you trying to accomplish?

What hardware will it run on?
What peripherals are available?
How much memory is there?
How much mass storage is there?
What type of mass storage?
What file system will be on the mass storage?

Communications (Input/Output/Networking)
What language will it be written in?
What administrative tools will be available?
I'm sure that others will add to that list.  The language bullet point requires a little bit of explanation.  FreeBSD, and all Unix to my knowledge is written primarily in C.  There is some C++, but it's mostly in C.  The rest of it, is written in machine dependent assembler.  This is to perform some actions with the hardware that is machine dependent which C doesn't support.  Additionally, you will also need to write a device driver for each peripheral that the machine will have attached to it, or potentially have attached.

And then there are the tools that come with the system.  The reason why I like the *BSDs, vendor unix's, and Windows, is that it is a fully defined operating system with a kernel, support tools and utilities, a compiler with support tools, and a shell.  When dealing with Linux, that's just a kernel.  You have to add everything else to it.  Hence the 200+ distributions.  There's some rather complete and standard ones like SuSE, Slackware, Debian, Red Hat, Fedora Core, etc... however, there's others that leave a bad taste in my mouth like Lindows/Linspire.  That one doesn't have the man command.  Yes, you read that right.  There is no manual with the system.

All of this is just for the OS.  The GUI is another type of animal all together.  The GUI runs on top of the OS, and it can potentially have even *MORE* code than the OS itself has (and often does).  With a GUI, the biggest consideration is the video driver.  I have written display drives for software pre-Windows 95 running under DOS.  What mode will it run in?  What resolution?  Most of the graphical installers use a standard non-accelerated mode like a VGA 640x480x4 (16 colors) which is available on all VGA cards since about 1993 or so.  Once you have decided that, you have to write routines to draw lines, circles, text, window bounds, field bounds, BIT-BLK, etc.  Because of the object oriented organization of the interface, C++ is generally used here.  The low level routines are generally written in C for administrative routines, or assembler for the actual drawing routines.  Then things get more complicated with the accelerators.  There is a reason why GPU manufacturers supply their own drivers for their chipsets.  Each chipset has its own hardware interface and custom routines.  Don't second guess the vendor on how to program their cards. 

Now, we need to talk about the installer.  The things to consider for the installer are as follows, and I'm sure people will add to this list as well:

What is the archive format?
Is the archive compressed?
What is the disk layout?
What is the disk format?
What tools and utilities will the installer have available?
What is the file database format?
And this is the short list.  The archive format is how the files are stored in the source media.  FreeBSD uses chunks when installing, but I don't know the details of the actual format those chunks are in.  Source files are generally compressed to save space on the installation media or to save network bandwidth.  So you will need to consider what compression algorithm do you want to use, if any.  The disk layout is how you want things organized.  The usual file setup is as follows:

/boot
/bin
/sbin
/libexec
/tmp
/home
/usr
/usr/tmp
/usr/bin
/usr/sbin
/usr/src (usually linked as /src)
/var
/etc
Solaris and other System V (including most Linux) systems have a /net where some programs go.  Not sure behind the rhyme or reason of what goes in /net vs. /usr though.  In addition to where to put files, you also have to consider partitioning as well.  For me personally, I run two disk systems with the following configurations:

ada0
/
swap

/tmp
/var
/home

ada1
/usr

Then you have to consider the format of the file database.  This contains the names of the files in the archive, where they will be installed too, and what permissions to install them with.


So, for what your are asking, there's a lot to consider.  If you choose to go through with it, then by all means.  Open a new project on sourceforge or github, get people to join your project, because it is a project.  I am not trying to discourage you, just trying to give you a glimpse into the realities of what you are trying to accomplish.  Besides, it's not impossible as this has been done at least twice before (that I am aware of).  Apple Macintosh OS-X userland was based on a FreeBSD 4.x using their Mach kernel.  The other one was a full fork known as DragonflyBSD.  I don't know the details of the reasons behind the fork, but I do know that it was highly political, which I try to avoid.

Have fun and keep coding.


----------



## PatMac (May 24, 2016)

As a reply to Maelstorm this can't be done nowadays from scratch anymore, specially on your own, it takes years and years of debugging, planning, designing and the list continues. I'm an OS X developer, and service engineer and became interested in how the boot process works and the kernel ect. I just made my own operating system (Jippie) and all it says is welcome to PatOS and that is the first step the Bootloader, Which I got working. Now if you want to start building on BSD you need to know the system and all the ins and outs, also we are moving to GPT partitioning now which adds extra hassle as you have to write efi software. if you decide to go for BSD then by all means go for it, but don't expect OSX as it is 100% not compatible, BSD uses a completly different file system then OS X to begin with. Apple has spend 20 years on perfecting it with a team of highly skilled engineers. Apple at the time was desperate (To Quote Maelstorm again) to get rid of their outdates system at the time which was still using coorparative miltitasking, and after loads of debates bought NeXT Step and NeXT Computers which had a very powerfull c based programing language and a preepmtive multitasking system called NeXTStep which is what OS X is based on. (One add on to maelstorm: coorparative miltitasking was stacked, so one program could crash the whole system). My point is quite the same as maelstorms, What do you want to do? what will your interface be like? have you got all the graphics and faults buttons, etc. worked out? Again with the video, will there be a use for the system? Is there any productive software, having a hobby fine, but no one will run it when there is no software. DO you know anything about linux/unix? Have you ever programmed in lets say C and compiled it using GCC? By all means keep on going, but I think you are better off coding a usefull app first or a driver for an existing system, learn filesystems and all the ins and outs before you even try this. One more add, Apple's Kernel is also open source they just released 11.2 and is available for download at their website, you have to be a registered developer to download it, all the hardware drivers are there as well (OSX is protected by copyright DARWIN is Not)...

Addendum... Hardware keeps changing and changing faster and faster, so you need something that can deal with that.... you can program for the I5 now and by the time you are done the I12 is out USB 6 and WIFI 1TB or something... So you need to make sure you are part of a team if it is for a PC or a Mac and the underlaying system/Kernel has to be upgradable.... Thats just my opinion (Moore's law)


----------



## big_girl (May 27, 2016)

Reduce, then rebuild. 

If it were up to me, I'd start the quest by making a teeny tiny FreeBSD for an embedded device (see the Lucas FreeBSD book for how to do this with NanoBSD). Then find a use for it, like a router or running your dorm fridge.


----------



## coolguy129 (Aug 22, 2020)

You definatly could, but un less you are familiar with the freebsd system, it would be quite hard. You should really start out with a normal freebsd installation and install a desktop environment such as gnome or kde plasma following the instructions in the handbook. You could then treat the installation similarly to linux and costomize it to however you want. If you have any questions, simply look at the handbook as it is really comprehensive.


----------



## Argentum (Aug 23, 2020)

Ahmed El Gohary said:


> What I want to do is:
> 
> Change the bootscreen.
> Change the desktop and use GNOME as the default GUI.
> ...



My little bit of advice is that you could look into NomadBSD project. This is full FreeBSD, capable of booting from USB stick and everything you describe in your post has been done there. Why don't you just take it and reconfigure for your taste. Or at least - you can investigate how they have done it. Another such project is FuryBSD. 

Good Luck!


----------



## Mjölnir (Aug 23, 2020)

No. You _can not_ do that yet, because your question reveals that you're lacking the skills needed for that.  Do not read the FreeBSD documentation, and do not read the sources & man pages, especially not release(7) & build(7).  It's not worth it.  Too complicated.  Better do not install plain vanilla FreeBSD or NomadBSD & learn & explore how it all fits together.  Do not install your experiments into a jail(8) or bhyve(8) VM.  Avoid frustrating experiences.

AchmedOS is a nice name, it reminds me on Archimedes (RISC OS).
Now seriously: forget FuryBSD.  It's broken.


----------



## ekvz (Aug 23, 2020)

Do necromancers count as daemons? From the last couple of posts it sure looks like it


----------



## Mjölnir (Aug 23, 2020)

ekvz said:


> Do necromancers count as daemons? From the last couple of posts it sure looks like it


That photograph is black & white, in reality I'm not that pale...


----------



## BostonBSD (Jan 19, 2021)

If I ever did that I would make the logo a harp seal; after the Beastie is freed it turns out to be a cute fluffy seal who lives in the Arctic.






{from how2drawanimals.com}
* I wasn't planning on doing this, but I hope someone does, I think it's a good idea.


----------



## Snurg (Jan 19, 2021)

And we FVWM users want a FelineBSD  





Just kidding ^ ^


----------

