DevHeads.net

How to update modules in iniramfs fastly

I know dracut can update modules in initramfs, but I think it is too
slow. So I'm wondering what is the fastest way to update modules in
initramfs of CentOS 7?

Thanks!

Comments

Re: How to update modules in iniramfs fastly

By Steven Tardy at 02/25/2018 - 22:48

On Sun, Feb 25, 2018 at 8:29 PM wuzhouhui < ... at mails dot ucas.ac.cn>
wrote:

`dracut` calls `mkinitrd` which rebuilds the initrd file. . . you could do
it manually but that is prone to errors (
<a href="https://access.redhat.com/solutions/24029" title="https://access.redhat.com/solutions/24029">https://access.redhat.com/solutions/24029</a>).

Re: How to update modules in iniramfs fastly

By wuzhouhui at 02/26/2018 - 01:46

gzip: /boot/initramfs-3.10.0-693.el7.x86_64.img: not in gzip format
cpio: premature end of archive

Re: How to update modules in iniramfs fastly

By Leon Fauster at 02/26/2018 - 10:20

Maybe some ucode archive is in front of the initrd archive.

Did you try to unpack it without uncompressing it? Whats the contents?

Re: How to update modules in iniramfs fastly

By wuzhouhui at 02/26/2018 - 21:13

[root@bogon a]# cpio -id < /boot/initramfs-3.10.0-693.el7.x86_64.img
28 blocks
[root@bogon a]# ls -R
.:
early_cpio kernel

./kernel:
x86

./kernel/x86:
microcode

./kernel/x86/microcode:
GenuineIntel.bin

Obviously, above is not what I want. In order to get full contents of initramfs,
I have to use skipcpio to skip initial cpio of initramfs:

[root@bogon a]# /usr/lib/dracut/skipcpio /boot/initramfs-3.10.0-693.el7.x86_64.img | zcat | cpio -id
85469 blocks
[root@bogon a]# ls
bin etc lib proc run shutdown sysroot usr
dev init lib64 root sbin sys tmp var

I can use skipcpio to get full contents of initramfs, and then edit files in it.
But the problem is how to recreate initramfs by extracted contents?

Re: How to update modules in iniramfs fastly

By Robert P. J. Day at 02/26/2018 - 02:05

i think you have that backwards ... mkinitrd is simply a wrapper
around a call to dracut, which builds an initramfs.

it is, but to get to the content, you need to use "skipcpio" to jump
over the initial tiny cpio archive. see, for example:

<a href="https://sites.google.com/site/syscookbook/rhel/rhel-kernel-rebuild" title="https://sites.google.com/site/syscookbook/rhel/rhel-kernel-rebuild">https://sites.google.com/site/syscookbook/rhel/rhel-kernel-rebuild</a>

rday

Re: How to update modules in iniramfs fastly

By wuzhouhui at 02/26/2018 - 05:47

So, in the end, we can't recreate initramfs of CentOS 7 manually just
like <a href="https://access.redhat.com/solutions/24029" title="https://access.redhat.com/solutions/24029">https://access.redhat.com/solutions/24029</a> did in CentOS 6?