Can't re-create initrd

CLOSE Dave Dave.Close at us.thalesgroup.com
Sun Oct 12 19:39:28 UTC 2014


I wrote:

> Eventually, I want to modify the initrd. But first I want to find a
> working procedure to create the revised version. So, without changing
> anything, I'm trying to recreate the initrd. If I can't get an
> unmodified version to work, I probably have no hope for a modified one.
>
> My current command sequence is,
>
>     # mkdir newrd; cd newrd
>     # unxz <../initrd.img | cpio -im
>     # unxz <../initrd.img | cpio -it | cpio -oc | xz >../initrd2.img
>
> The result is slightly smaller than the original. lsinitrd shows both
> images to have exactly the same content in the same sequence but with
> different timestamps on directories and links.
>
> Without changing the PXE instructions, either the kernel or the append
> lines, I move the new file on top of the original and try to PXE boot.
> That's when it fails. It does appear to find the root as several screens
> worth of messages fly by. The last few I see make reference to sda and
> sdb (the target has two disks). But I can't read fast enough to see the
> last messages before the kernel panic (which fills the screen).

Well, I've found a procedure that can successfully create a new initrd. 
It was suggested that I use the xz_wrap.sh script included with the 
kernel. That script is probably used for the initramfs associated with 
the real kernel but doesn't appear to be used for the PXE kernel and 
initrd. Using it didn't work but did point me to the various xz options 
which might be relevant. I also found some clues reviewing the output of 
"xv -lvv" on the standard initrd. Here is the procedure which works.

find . | cpio -oc | xz --check=crc32 --lzma2=dict=1MiB >../initrd2.img

Probably the most critical part of that is the crc32. xz defaults to 
crc64 but I'm told that the kernel doesn't include the code for that.
-- 
Dave Close, Thales Avionics, Irvine California USA.
cell +1 949 394 2124, dave.close at us.thalesgroup.com

"If a cluttered desk is a sign of a cluttered mind,
of what then is an empty desk?" --Albert Einstein


More information about the users mailing list