3

Suppose I do not need a filesystem and I have only applications where data reloading may not be required - so MMU may be redundant. Can I remove these two items from Linux, and boot the OS successfully?

I am trying to develop small sized Linux kernel, and I found filesystem and MMU are taking considerable space. So I thought of removing them.

Any advice on this?

closed as unclear what you're asking by Patrick, Anthon, Braiam, Timo, Zelda Mar 2 '14 at 13:18

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • What do you plan on doing with a kernel that has no filesystem? It won't have any processes to run, and thus nothing to do. The MMU is a hardware device, just arbitrarily removing it isn't even possible. – Patrick Feb 24 '14 at 14:17
  • how a system without file system would work on linux as even a printer or ethernet card is considered as a file ? What is your goal here ? what you can do is remove a maximum file system support but you will still need a small one even virtually loaded in ram – Kiwy Feb 24 '14 at 14:18
  • 1
    Why is this being migrated to SO (there has been one vote to close/migrate)? It is not a programming question at all, it is about having a minimal Linux system. – terdon Feb 24 '14 at 14:41
  • Look at Linux on STM32, however this is far beyond Linux as we know it. – user55518 Feb 24 '14 at 15:20
  • @Patrick - The Linux networking stack runs fine without an active userland (e.g. when the kernel has panicked), as far as filtering and forwarding is concerned, at least until your DHCP lease runs out... – LawrenceC Feb 25 '14 at 1:09
6

If you mean "no external filesystem on a block device" support like ext2/3/4, vfat, etc. you can build a kernel without any filesystem modules either built as modules or built into the kernel. I'm not sure if the initramfs support counts as a filesystem - you'll need one of course if you want a shell and other utilities. You can use tmpfs for things (and of course, this is really a RAM filesystem) like /dev. So you can run Linux with only the initramfs mounted on /, as well as things like /proc and such.

Any Linux software will at least minimally reference the filesystem in some way, it's a central concept of UNIX and thus Linux, so you can't get rid of the whole notion of files in Linux and it still be Linux.

You used to be able to disable the block layer when compiling a kernel. I don't know if it's still possible.

The MMU is a CPU hardware feature and Linux requires it. You generally want this as it enables processes to be separate from each other and most of the security aspects of the kernel.

Nonetheless, a project called uCLinux exists which is an implementation of Linux not requiring an MMU. It's meant to enable a Linux-like environment in microcontrollers and such. Processes in uCLinux can overwrite the address space of others, leading to a less stable system if you don't have well-behaved software.

  • Thanks for the valuable info. Could you please explain how do I build without file system ? mean what tools and options etc ?? – user2799508 Feb 25 '14 at 11:07
  • debian-handbook.info/browse/stable/sect.kernel-compilation.html is a good place to start, assuming you are using Debian or Debian-derived distro like Ubuntu. make menuconfig is where you select what is and isn't in the kernel (typically you can build X in to the kernel, build X as a module, or don't build it). You should take the time to just browse and read the help on items that interest you when in make menuconfig. Filesystems will be a module that you can choose to build into or leave out. – LawrenceC Feb 25 '14 at 23:40
1

If you want some sort of minimalistic system, perhaps starting from a full-featured kernel like Linux is overkill. Maybe a microkernel system, like Minix 3 fits the bill better. If open source isn't a requirement, something like QNX should be considered (that one had a demo with the operating system and a graphical web browser on a floppy disk a way back; it is a RTOS for very limited machines).

1

The loader could load the kernel and the processes at fixed places. Then it will gives the control to the kernel. Or perhaps something similar the way hibernation works.

You should preserve a minimalist version of the virtual memory as it solves memory fragmentation problems

Note that this stacked processes, that the loader has to read, may be considered as a file system, like the early unix tape file systems.

Not the answer you're looking for? Browse other questions tagged or ask your own question.