Trimming down freebsd [closed] - c

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I am trying to trim down FreeBSD to understand/learn how things work. I have a few questions if someone can help me with that:
1) when we say kernel, can I separate code wise from the rest of the FreeBSD code? What I mean is, I want to know what all files/dirs come under kernel.
2) I know a book called Linux from scratch. Is there any related book for FreeBSD?
Any pointers are most welcome.
Thank you.

FreeBSD is one cohesive system. Whereas Linux is a kernel plus a bunch of packages, all of FreeBSD core is built together (everything but the ports tree). The FreeBSD Handbook is the best resource to start from for learning FreeBSD. There is also a Developer's handbook that can be found on the FreeBSD website. As for what the kernel is in terms of source files, anything under /usr/src/sys is kernel source code. If you want to know about the workings of the kernel, the book "The Design and Implementation of the FreeBSD Operating System" is the definitive guide to the details of the kernel.

Related

How does C access files? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 11 months ago.
Improve this question
everyone! I'm learning how to access files in C but, I wonder how my program(or C) access files(drive sectors)? I'm searching the Internet for answers but they don't have some proper explanation on how C(or my program), loads drive sectors to memory. Please give me some clarity, and thanks in advance.
C programs use functions of the kernel or a device driver to access hardware. A computing platform (Windows, Linux, OSX, etc) that supports C provides an implementation of the C standard library for programmers. This library contains system specific implementations of functions for accessing files, like fopen. The systems implementation of the standard library is most often just a wrapper around their specific system calls. For example on Windows, the C standard library is going to end up calling these functions: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/

Configuration Linux Kernel [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I need to compile kernel linux 3.4.4. I use "make menuconfig" to have a user-friendly interface to choose configuration.
I haven't understood an aspect of the kernel configuration: what is the difference between i choose to include an option during the configuration and i choose to include, as a module, an option during the configuration?
Thanks
When compiled as a module, the code of that feature/component is built as a separate file, as know as kernel module, separating from the kernel's main image. To use the feature, you have to load it into the kernel with commands like modprobe or insmod. Of course you can later unload this module, to remove the feature/component. The kernel modules are normally placed at /lib/modules/{uname -r} on your system.
While compiled as 'y' means the code will be compiled into the main kernel image, which will be always available when the kernel is loaded and running.

Which Linux distro uses Linux kernel as is with no modification [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm trying to do some learning with Linux kernel and as you all know there is nothing better than playing with the code itself, Can you please let me know which one of the Linux distros is the easiest to work with? In other words, As far as I know Ubuntu for example modify the kernel for their distro, so the question again, which distro is using the Linux kernel as is with no modification?
Appreciate your guidance.
When it comes to no-frills (no external patches to the kernel) have a look at Slackware. Or follow "Linux from Scratch", that's as bare-bones as it gets.
If you want to start playing with the Linux kernel, I'd recommend a distribution which makes it particularily easy to compile the kernel yourself. Although I cannot provide detailed guidance, Gentoo seems to do so (although gentoo has other drawbacks, I don't know a single person in real life who actually used gentoo for more than two years).
I would not try and look for distributions not modifying the kernel, it's probably not worth the effort. Patches will probably be minor compared to the overall size of the kernel.
You can easily run Ubuntu for example with a vanilla kernel by following https://wiki.ubuntu.com/KernelTeam/GitKernelBuild.

License issue - Can I build a commercial OS based on FreeBSD? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Can I build a commercial OS based on FreeBSD? Can I distribute such a system without source code? I dont wanna have any legal issue. What is the true way to distribute a new Os based on freebsd without any legal issue?
The BSD license is a permissive license, so yes, you can base a commercial product upon BSD-licensed code (which, for the most part, FreeBSD is).
Be aware, however, that some of the code in the base FreeBSD distribution is actually licensed under the GPL (or other non-permissive licenses). You would need to ensure that you didn't use any such code in your project.
Yes, you can build a commercial OS based on FreeBSD. You can distribute it without any source code, as long as you distribute it with a notice saying your OS contains FreeBSD code and a copy of the FreeBSD license.
More information here: http://en.wikipedia.org/wiki/BSD_licenses

simple Filesystem [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I wanna implement a very, very simple filesystem. I just came across the following resource
and I am wondering if maybe someone tried to do the same and could point me out where
it is best to start for me.
Many thanks
http://web.archive.org/web/20091027130707/http://geocities.com/ravikiran_uvs/articles/rkfs.html
You could look at FUSE - Filesystem in Userspace. It is a system that makes filesystem development much easier than normal filesystem development inside the Kernel. For example the hellofs is a small, extremely limited filesystem in less than 100 lines of C code.
I designed a small series of homeworks for students to development an really simple filesystem using FUSE. Unfortunatelly, the resources for the course are currently only available in German. The filesystem used is based on the book "UNIX Filesystems" by Steve Pate - A pretty good resource on filesystem development.
Try and look at some of the first, non-journaling filesystems on Minix or Linux. You should be able to find something to look at by browsing their legacy code.
Also pick up a book like Modern Operating Systems by Tanenbaum. This contains some low-level theory. If you want to write the driver for Linux then there is a free book on writing drivers/fs modules for Linux
Good Luck
FAT (specifically FAT16) is an extremely simple filesystem -- so simple in fact that building a FAT16 filesystem driver was a single programming lab assignment for a 200-level Computer Science course when I was in school.
If you want to get an idea of the minimum complexity necessary for a real-world filesystem, that's a decent one to look at.

Resources