LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   kernel panic: init not found (problem with custom built initrd.img) cpio command (https://www.linuxquestions.org/questions/linux-general-1/kernel-panic-init-not-found-problem-with-custom-built-initrd-img-cpio-command-4175511992/)

pumoritech 07-23-2014 01:22 AM

kernel panic: init not found (problem with custom built initrd.img) cpio command
 
I have this python script which builds bootable usb drive with SysLinux based minimal Linux with linux kernel(bzimage), syslinux.cfg, ldlinux.sys and initrd.img. The script also builds initrd.img (a cpio archive) from various files (a linux file structure bin, dev, etc, proc, user, var) init program etc.
But the problem is when i try to boot my x86 machine with this usb driver. Kernel gets loaded then initrd.img but then it errors out saying - kernel panic, init not found.
But I actually also have access to initrd.img that is working (ie. machine is booting without any issues). If I replace my initrd.img with working initrd.img it works so problem is with my initrd.img. I tried to see the contents of initrd.img and compare. I did:
sudo cp initrd.img initrd.gz
sudo gunzip initrd.gz
cpio -i -t < initrd
both of them seem to be same. except for few python libraries in /usr/lib.
I am not sure why my initrd.img is not working. Since I need to modify files in the filesystem I need to run python script to archive and build initrd.img. Is there any way to modify/add or delete files from cpio archive. I tried to do cpio -i initrd. It tries to replace files and directories in my Linux system such as /usr /bin init etc.

business_kid 07-23-2014 02:28 AM

The two initrds could be the same, but the kernel configs different. Itś defficult to provide the details of a fix when we don have the details of a problem. Trace through are yopur chipset/hard disk and filesystems all supported. Thatś the usual issue.

pumoritech 07-23-2014 01:15 PM

Everything else is same. Besides initrd.img, bootable usb driver has
efi bzImage ldlinux.sys startup.nsh and syslinux.cfg. If I replace my initrd.img with working initrd.img and make a bootable USB driver, it works too. so the problem is initrd.img. that is why I want to use cpio tool to modify just one or two files in working initrd.img and try to boot.
My syslinux.cfg looks like this:
default Linux

prompt 1

label Linux

timeout 50

kernel bzImage
append console=tty1 vga=773
initrd initrd.img

business_kid 07-23-2014 02:10 PM

Quote:

Everything else is same.
Kernel .config (and version) identical?

pumoritech 07-23-2014 02:26 PM

yes. btw i actually compiled init from init.c


All times are GMT -5. The time now is 05:56 AM.