0

I have a really old build of Linux (version 2.4.0). Please don't ask me why I have such an old version since it's for a very specialised bit of old hardware. Anyway, problem is, I get this message when attempting to run the system after successful compilation.

Kernel panic: I have no root and I want to scream

The problem seems to be that I need a 'root filesystem', most likely generated by the initial RAM disk (initrd) generation technique. How can I fix this?

t0rxe
  • 9

2 Answers2

3

You don't need an initrd if your kernel includes all the drivers and filesystem support needed for booting. But you need to tell the kernel where your root filesystem is, using the root= kernel parameter, e.g. root=/dev/sda1.

Johan Myréen
  • 13,168
  • What if I don't have a filesystem at all? IE: No HDD. Is there a way I can tell it to use RAM? – t0rxe Nov 25 '17 at 16:48
  • inmitrd would be a way to tell it to use ram. Many embedded systems use SD cards for their filesystem or EMMC (which is like a solderable SD card) – Jasen Nov 25 '17 at 18:43
  • Ok, an initramfs is the way to go, then. An initramfs is a CPIO archive containing the necessary files to get the system up and running. The archive can be either a separate file that is loaded by the boot loader after the kernel has been loaded, or the archive can be part of the kernel image. The kernel documentation directory contains some information, but asaembling the archive is not a trivial task, I am afraid. – Johan Myréen Nov 25 '17 at 20:41
  • Linux needs a root filesystem. It doesn't need to be on a disk - several of mine are NFS-root for instance - but it does need to have the init binary. Initramfs is probably what you want. – Toby Speight Mar 25 '21 at 13:50
0

You do not have to "create" a rootfs. If the kernel is booted without an initrd then ist must be compiled with the necessary drivers for accessing the root device. Which device is used (by default) is hard coded in the kernel. You can override that with the kernel command line, e.g. root=/dev/sda2.

If you use an initrd then the initrd becomes the rootfs automatically and the initrd process later chroots to the real rootfs (using the kernel parameter and maybe some default).

Hauke Laging
  • 90,279
  • What if I don't have a filesystem at all? IE: No HDD. Is there a way I can tell it to use RAM? – t0rxe Nov 25 '17 at 16:48
  • @t0rxe The system has to boot from somewhere, doesn't it? It is possible to run Linux in RAM only. I guess you need a modified initrd to do that (like the live distros do). But that is certainly not an approach for someone "not that tech-savvy in regards to Linux". And even worse: It is really bad style not to mention the most difficult part of your problem in the question... – Hauke Laging Nov 25 '17 at 16:58
  • Ah okay, well is there any reference to a guide or manual of some sort where I can learn or figure out how to modify initrd to do such a task since that is what I'm going to have to do in order to get this working. – t0rxe Nov 25 '17 at 17:04
  • @t0rxe I would look for such information on the web sites of live distros. – Hauke Laging Nov 25 '17 at 17:05