View previous topic :: View next topic |
Author |
Message |
D-LINC Tux's lil' helper
Joined: 31 Jan 2011 Posts: 135 Location: Alaska
|
Posted: Sat Oct 06, 2012 11:09 pm Post subject: Including genkernel initramfs in a static kernel |
|
|
Hey guys, I have a somewhat unusual situation: One of my Gentoo systems does not have a boot directory, but instead boots off a kernel on a cdrom. (I won't bore you with the story of why I have to do this.) The kernel is built as a static kernel (no loadable module support) and I include the initramfs directly in the kernel, through the field in menuconfig that allows me to specify the path to the initramfs to include. In the past I have not used genkernel for any of this, but instead I hand crafted my own initramfs, and then used "make menuconfig" and "make isoimage", and this worked well enough.
However, my hand-crafted initramfs has some issues, and I was hoping instead to use a proper initramfs built by some other program. My thought was to use "genkernel initramfs" to produce the initramfs (with LVM, RAID, and other special support that I need) and then just include this in the kernel like I did the handcrafted one. However, the kernel doesn't seem to be work with the initramfs produced by genkernel -- like there is some kind of file formatting issue. When I first tried to build the kernel, the build process immediately croaked and spit out a bunch of mangled error data complaining about not being able to read the initramfs file or something like that. I thought maybe it needed to be gzipped, so I gzipped the initramfs and tried again. This time, the kernel iso image successfully built, but when I tried to boot into the new kernel, it died with a kernel panic, and gave some kind of error about the "initramfs magic".
So, do I need to process the genkernel-produced initramfs first in some special way? _________________ frigidcode.com |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Mon Oct 08, 2012 6:05 am Post subject: |
|
|
D-LINC ...
I the option is INITRAMFS_SOURCE and can be a .cpio (uncompressed) or a directory containing the files to be included, I think at some point I too had issues when providing a cpio image, though I can't remember the circumstances exactly.
If your needs are one or more of the following: LVM, dmcrypt/LUKS, software RAID, Tuxonice, swsusp/uswsusp, rescue shell, then you might want to take a look at better-initramfs, the build process is simple, transparent, and configurable. Simply edit bootstrap/bootstrap-all.conf and define the features (above) you require, then run 'bootstrap/bootstrap-all && make prepare', 'sourceroot' would then be the directory to provide to INITRAMFS_SOURCE.
HTH & best ... khay |
|
Back to top |
|
|
nerdboy n00b
Joined: 07 Oct 2012 Posts: 3 Location: California
|
Posted: Wed Apr 23, 2014 11:36 pm Post subject: Re: Including genkernel initramfs in a static kernel |
|
|
D-LINC wrote: | So, do I need to process the genkernel-produced initramfs first in some special way? |
To do this manually and test it, use lzma to decompress the genkernel initramfs and use the unpacked file in the kernel config. If you need fsck for separate /usr in your initramfs, then you can try the patched genkernel in my overlay with USE="premount" and then run genkernel with the overlay path shown in the einfo.
https://github.com/sarnold/portage-overlay
HTH... |
|
Back to top |
|
|
lexming Tux's lil' helper
Joined: 04 Jan 2007 Posts: 123 Location: Barcelona
|
Posted: Thu Apr 24, 2014 2:10 pm Post subject: |
|
|
I would also recommend sys-kernel/dracut. Using Code: | dracut --no-compress | will generate an initramfs in cpio format suitable to be included in the kernel image. Additionally, dracut is very easy to set up, it generates initramfs based on the utilities already present on your system. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|